public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/poly2tri] rawhide: Run a smoke test during build
@ 2026-11-04 11:22 Roddie Kieley
0 siblings, 0 replies; only message in thread
From: Roddie Kieley @ 2026-11-04 11:22 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/poly2tri
Branch : rawhide
Commit : a9948b00d2b47b07d371b4aec89d156cc8b4c6c8
Author : Roddie Kieley <roddie@kieley.ca>
Date : 2026-11-04T07:23:38-03:30
Stats : +56/-1 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/poly2tri/c/a9948b00d2b47b07d371b4aec89d156cc8b4c6c8?branch=rawhide
Log:
Run a smoke test during build
Signed-off-by: Roddie Kieley <roddie@kieley.ca>
Assisted-by: DeepSeek-V4.1-Flash-1017
---
diff --git a/poly2tri-Makefile b/poly2tri-Makefile
index c38b53d..eb2d2b0 100644
--- a/poly2tri-Makefile
+++ b/poly2tri-Makefile
@@ -5,6 +5,10 @@ LIBS = -lGL
INCLUDE = -I.
+SMOKE_INCLUDE ?= -I.
+SMOKE_LIBDIR ?= .
+SMOKE_LIB ?= libpoly2tri.so.1.0
+
TARGETS = \
common/shapes \
sweep/advancing_front \
@@ -12,13 +16,21 @@ TARGETS = \
sweep/sweep \
sweep/sweep_context \
+.PHONY: all smoke check clean
+
all: libpoly2tri.so.1.0
libpoly2tri.so.1.0: $(patsubst %,%.o, $(TARGETS))
$(CXX) $(LDFLAGS) -shared -Wl,-soname,libpoly2tri.so.1.0 $^ $(LIBS) -o $@
+smoke: smoke.cc libpoly2tri.so.1.0
+ $(CXX) $(CFLAGS) $(LDFLAGS) $(SMOKE_INCLUDE) -o $@ $< $(SMOKE_LIBDIR)/$(SMOKE_LIB)
+
+check: smoke
+ LD_LIBRARY_PATH=$(SMOKE_LIBDIR) ./smoke
+
%.o: %.cc
$(CXX) $(CFLAGS) $(INCLUDE) -c -fPIC $< -o $@
clean:
- rm -f */*.o libpoly2tri.so*
+ rm -f */*.o libpoly2tri.so* smoke
diff --git a/poly2tri-smoke.cc b/poly2tri-smoke.cc
new file mode 100644
index 0000000..c7d3960
--- /dev/null
+++ b/poly2tri-smoke.cc
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: BSD-3-Clause
+//
+// Minimal headless smoke test for the packaged poly2tri library.
+
+#include <cstddef>
+#include <iostream>
+#include <vector>
+
+#include <poly2tri/poly2tri.h>
+
+int main()
+{
+ std::vector<p2t::Point*> polyline;
+ polyline.push_back(new p2t::Point(0.0, 0.0));
+ polyline.push_back(new p2t::Point(1.0, 0.0));
+ polyline.push_back(new p2t::Point(1.0, 1.0));
+ polyline.push_back(new p2t::Point(0.0, 1.0));
+
+ std::size_t triangle_count = 0;
+ {
+ p2t::CDT cdt(polyline);
+ cdt.Triangulate();
+ triangle_count = cdt.GetTriangles().size();
+ }
+
+ for (std::vector<p2t::Point*>::iterator it = polyline.begin();
+ it != polyline.end(); ++it) {
+ delete *it;
+ }
+
+ std::cout << "triangles=" << triangle_count << " (expected 2)" << std::endl;
+ return triangle_count == 2 ? 0 : 1;
+}
diff --git a/poly2tri.spec b/poly2tri.spec
index 2ec3ea8..b5466eb 100644
--- a/poly2tri.spec
+++ b/poly2tri.spec
@@ -12,6 +12,7 @@ Source0: %{url}/archive/%{commit}/%{name}-%{commit}.tar.gz
# The Makefile was created for purposes of this package
# Upstream provides WAF, but it builds example apps and not the library
Source1: %{name}-Makefile
+Source2: %{name}-smoke.cc
BuildRequires: make
BuildRequires: gcc-c++
BuildRequires: mesa-libGL-devel
@@ -30,6 +31,7 @@ Development files for %{name}.
%prep
%setup -qn %{name}-%{commit}
cp %{SOURCE1} %{name}/Makefile
+cp %{SOURCE2} %{name}/smoke.cc
iconv -f iso8859-1 -t utf-8 AUTHORS > AUTHORS.conv && \
touch -r AUTHORS AUTHORS.conv && \
@@ -49,6 +51,14 @@ for H in %{name}/*/*.h %{name}/*.h; do
install -Dpm0644 $H %{buildroot}%{_includedir}/$H
done
+%check
+cd %{name}
+make check \
+ CFLAGS="%{optflags}" \
+ LDFLAGS="%{build_ldflags}" \
+ SMOKE_INCLUDE="-I%{buildroot}%{_includedir}" \
+ SMOKE_LIBDIR="%{buildroot}%{_libdir}"
+
%files
%doc AUTHORS LICENSE README
%{_libdir}/lib%{name}.so.*
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-04 11:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 11:22 [rpms/poly2tri] rawhide: Run a smoke test during build Roddie Kieley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox