public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Roddie Kieley <roddie@kieley.ca>
To: git-commits@fedoraproject.org
Subject: [rpms/poly2tri] rawhide: Run a smoke test during build
Date: Wed, 04 Nov 2026 11:22:15 GMT	[thread overview]
Message-ID: <179379133546.1.16128710984152712006.rpms-poly2tri-a9948b00d2b4@fedoraproject.org> (raw)

            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.*

                 reply	other threads:[~2026-11-04 11:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179379133546.1.16128710984152712006.rpms-poly2tri-a9948b00d2b4@fedoraproject.org \
    --to=roddie@kieley.ca \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox