net/libnetdude/libnetdude has a test suite but does not build correctly. This diff makes it build and run by doing the following:
- Set REGRESS_DEPENDS = ${FULLPKGPATH} because the test suite needs the libnetdude package itself to be installed in order to build and run. - Make the "check" target in test/Makefile actually execute the test suite, instead of just building the test programs and exiting. - Change the test suite program (test/lnd-test.c) to include netinet/if_ether.h instead of net/ethernet.h which does not exist on OpenBSD. - Fix the last test to report the correct result. - Let lnd-test exit with exit code 1 if any tests fail (previously it would always exit with exit code 0 even if tests fail). The test suite still fails due to the failure of one test, but at least it builds and runs now. :) Tested on amd64. Comments and more tests appreciated. Lawrence Index: Makefile =================================================================== RCS file: /cvs/ports/net/libnetdude/libnetdude/Makefile,v retrieving revision 1.13 diff -N -u -p Makefile --- Makefile 8 Dec 2011 22:16:28 -0000 1.13 +++ Makefile 7 May 2012 03:42:13 -0000 @@ -3,7 +3,7 @@ COMMENT= packet manipulation backend of Netdude framework DISTNAME= libnetdude-0.10a -REVISION= 2 +REVISION= 3 SHARED_LIBS= netdude 1.0 CATEGORIES= net MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=netdude/} @@ -13,6 +13,7 @@ HOMEPAGE= http://netdude.sourceforge.net/ LIB_DEPENDS= net/libpcapnav \ devel/glib \ devel/libtool,-ltdl +REGRESS_DEPENDS= ${FULLPKGPATH} # BSD PERMIT_PACKAGE_CDROM= Yes Index: patches/patch-test_Makefile_in =================================================================== RCS file: patches/patch-test_Makefile_in diff -N -u -p patches/patch-test_Makefile_in --- /dev/null 6 May 2012 21:42:13 -0000 +++ patches/patch-test_Makefile_in 7 May 2012 03:42:13 -0000 @@ -0,0 +1,14 @@ +$OpenBSD$ + +Actually run the test suite when "make check" is executed. + +--- test/Makefile.in.orig Sun Jun 24 17:37:52 2007 ++++ test/Makefile.in Sun May 6 23:35:24 2012 +@@ -405,6 +405,7 @@ distdir: $(DISTFILES) + check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + check: check-am ++ $(srcdir)/lnd-test + all-am: Makefile + installdirs: + install: install-am Index: patches/patch-test_lnd_test_c =================================================================== RCS file: patches/patch-test_lnd_test_c diff -N -u -p patches/patch-test_lnd_test_c --- /dev/null 6 May 2012 21:42:13 -0000 +++ patches/patch-test_lnd_test_c 7 May 2012 03:42:13 -0000 @@ -0,0 +1,43 @@ +$OpenBSD$ + +- OpenBSD does not have net/ethernet.h, use netinet/if_ether.h instead. + +- The "read-write filtering (growing trace)" test should be checking the + res_filters_3 variable for test results. + +- Exit with exit code 1 if any tests fail. + +--- test/lnd-test.c.orig Tue Nov 11 06:32:59 2003 ++++ test/lnd-test.c Sat May 5 00:27:29 2012 +@@ -28,7 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALI + + #include <libnd.h> + +-#include <net/ethernet.h> ++#include <netinet/if_ether.h> + #include <netinet/ip.h> + #include <netinet/udp.h> + +@@ -721,7 +721,21 @@ main(int argc, char **argv) + printf("[%s] editing three overlapping areas\n", res_it_areas_3 ? "ok" : "--"); + printf("[%s] read-only filtering\n", res_filters_1 ? "ok" : "--"); + printf("[%s] read-write filtering (shrinking trace)\n", res_filters_2 ? "ok" : "--"); +- printf("[%s] read-write filtering (growing trace)\n", res_filters_2 ? "ok" : "--"); ++ printf("[%s] read-write filtering (growing trace)\n", res_filters_3 ? "ok" : "--"); ++ ++ if (!res_init || ++ !res_load || ++ !res_jump_time || ++ !res_jump || ++ !res_it_loaded || ++ !res_it_blocks || ++ !res_it_areas_1 || ++ !res_it_areas_2 || ++ !res_it_areas_3 || ++ !res_filters_1 || ++ !res_filters_2 || ++ !res_filters_3) ++ return 1; + + return 0; + }