git: 9b86b272bfdb - main - tests: Move netpfil/pf/divapp to netpfil/common/

From: Igor Ostapenko <igoro_at_FreeBSD.org>
Date: Tue, 15 Oct 2024 17:10:10 UTC
The branch main has been updated by igoro:

URL: https://cgit.FreeBSD.org/src/commit/?id=9b86b272bfdb1fead5bf65d301c5df784c3165af

commit 9b86b272bfdb1fead5bf65d301c5df784c3165af
Author:     Igor Ostapenko <igoro@FreeBSD.org>
AuthorDate: 2024-10-15 17:03:42 +0000
Commit:     Igor Ostapenko <igoro@FreeBSD.org>
CommitDate: 2024-10-15 17:08:01 +0000

    tests: Move netpfil/pf/divapp to netpfil/common/
    
    It's intended to be used by both ipfw and pf.
    
    Reviewed by:    kp, markj
    Approved by:    kp (mentor)
    Differential Revision:  https://reviews.freebsd.org/D47110
---
 ObsoleteFiles.inc                         |  3 +++
 tests/sys/netpfil/common/Makefile         |  3 +++
 tests/sys/netpfil/{pf => common}/divapp.c |  2 +-
 tests/sys/netpfil/pf/Makefile             |  3 ---
 tests/sys/netpfil/pf/divert-to.sh         | 20 ++++++++++----------
 5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index 01f2609353cd..aa4dedbc9265 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -51,6 +51,9 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20241014: move divapp to netpfil/common/
+OLD_FILES+=usr/tests/sys/netpfil/pf/divapp
+
 # 20240930: libmd bumped to version 7
 OLD_LIBS+=lib/libmd.so.6
 
diff --git a/tests/sys/netpfil/common/Makefile b/tests/sys/netpfil/common/Makefile
index 4cd3f1a8a156..0938bd9d9c7e 100644
--- a/tests/sys/netpfil/common/Makefile
+++ b/tests/sys/netpfil/common/Makefile
@@ -1,6 +1,7 @@
 PACKAGE=	tests
 
 TESTSDIR=	${TESTSBASE}/sys/netpfil/common
+BINDIR=		${TESTSDIR}
 
 
 ATF_TESTS_SH+=	\
@@ -16,6 +17,8 @@ ATF_TESTS_SH+=	\
 TEST_METADATA+= execenv="jail"
 TEST_METADATA+= execenv_jail_params="vnet allow.raw_sockets"
 
+PROGS=		divapp
+
 ${PACKAGE}FILES+=	\
 		utils.subr \
 		runner.subr \
diff --git a/tests/sys/netpfil/pf/divapp.c b/tests/sys/netpfil/common/divapp.c
similarity index 99%
rename from tests/sys/netpfil/pf/divapp.c
rename to tests/sys/netpfil/common/divapp.c
index 908c41eaa67f..f3e41f010fef 100644
--- a/tests/sys/netpfil/pf/divapp.c
+++ b/tests/sys/netpfil/common/divapp.c
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  */
 
-/* Used by tests like divert-to.sh */
+/* Used by divert(4) related tests */
 
 #include <errno.h>
 #include <stdlib.h>
diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile
index 38548336377a..7e701cb09c50 100644
--- a/tests/sys/netpfil/pf/Makefile
+++ b/tests/sys/netpfil/pf/Makefile
@@ -1,7 +1,6 @@
 PACKAGE=	tests
 
 TESTSDIR=       ${TESTSBASE}/sys/netpfil/pf
-BINDIR=		${TESTSDIR}
 TESTS_SUBDIRS+=	ioctl
 
 ATF_TESTS_SH+=	altq \
@@ -62,8 +61,6 @@ ATF_TESTS_PYTEST+=	sctp.py
 TEST_METADATA+= execenv="jail"
 TEST_METADATA+= execenv_jail_params="vnet allow.raw_sockets"
 
-PROGS=	divapp
-
 ${PACKAGE}FILES+=	CVE-2019-5597.py \
 			CVE-2019-5598.py \
 			daytime_inetd.conf \
diff --git a/tests/sys/netpfil/pf/divert-to.sh b/tests/sys/netpfil/pf/divert-to.sh
index b27d321d7825..ae44cd5d51af 100644
--- a/tests/sys/netpfil/pf/divert-to.sh
+++ b/tests/sys/netpfil/pf/divert-to.sh
@@ -98,7 +98,7 @@ in_div_body()
 		"pass all" \
 		"pass in inet proto icmp icmp-type echoreq divert-to 127.0.0.1 port 2000"
 
-	jexec div $(atf_get_srcdir)/divapp 2000 &
+	jexec div $(atf_get_srcdir)/../common/divapp 2000 &
 	divapp_pid=$!
 	# Wait for the divapp to be ready
 	sleep 1
@@ -137,7 +137,7 @@ in_div_in_body()
 		"pass all" \
 		"pass in inet proto icmp icmp-type echoreq divert-to 127.0.0.1 port 2000 no state"
 
-	jexec div $(atf_get_srcdir)/divapp 2000 divert-back &
+	jexec div $(atf_get_srcdir)/../common/divapp 2000 divert-back &
 	divapp_pid=$!
 	# Wait for the divapp to be ready
 	sleep 1
@@ -177,7 +177,7 @@ out_div_body()
 		"pass in inet proto icmp icmp-type echoreq no state" \
 		"pass out inet proto icmp icmp-type echorep divert-to 127.0.0.1 port 2000 no state"
 
-	jexec div $(atf_get_srcdir)/divapp 2000 &
+	jexec div $(atf_get_srcdir)/../common/divapp 2000 &
 	divapp_pid=$!
 	# Wait for the divapp to be ready
 	sleep 1
@@ -217,7 +217,7 @@ out_div_out_body()
 		"pass in inet proto icmp icmp-type echoreq no state" \
 		"pass out inet proto icmp icmp-type echorep divert-to 127.0.0.1 port 2000 no state"
 
-	jexec div $(atf_get_srcdir)/divapp 2000 divert-back &
+	jexec div $(atf_get_srcdir)/../common/divapp 2000 divert-back &
 	divapp_pid=$!
 	# Wait for the divapp to be ready
 	sleep 1
@@ -271,9 +271,9 @@ in_div_in_fwd_out_div_out_body()
 		"pass in inet proto icmp icmp-type echoreq divert-to 127.0.0.1 port 2001 no state" \
 		"pass out inet proto icmp icmp-type echoreq divert-to 127.0.0.1 port 2002 no state"
 
-	jexec router $(atf_get_srcdir)/divapp 2001 divert-back &
+	jexec router $(atf_get_srcdir)/../common/divapp 2001 divert-back &
 	indivapp_pid=$!
-	jexec router $(atf_get_srcdir)/divapp 2002 divert-back &
+	jexec router $(atf_get_srcdir)/../common/divapp 2002 divert-back &
 	outdivapp_pid=$!
 	# Wait for the divappS to be ready
 	sleep 1
@@ -322,9 +322,9 @@ in_dn_in_div_in_out_div_out_dn_out_body()
 		"pass in inet proto icmp icmp-type echoreq divert-to 127.0.0.1 port 1001 no state" \
 		"pass out inet proto icmp icmp-type echorep divert-to 127.0.0.1 port 1002 no state"
 
-	jexec alcatraz $(atf_get_srcdir)/divapp 1001 divert-back &
+	jexec alcatraz $(atf_get_srcdir)/../common/divapp 1001 divert-back &
 	indivapp_pid=$!
-	jexec alcatraz $(atf_get_srcdir)/divapp 1002 divert-back &
+	jexec alcatraz $(atf_get_srcdir)/../common/divapp 1002 divert-back &
 	outdivapp_pid=$!
 	# Wait for the divappS to be ready
 	sleep 1
@@ -351,9 +351,9 @@ in_dn_in_div_in_out_div_out_dn_out_body()
 		"pass in inet proto icmp icmp-type echoreq divert-to 127.0.0.1 port 2001 no state" \
 		"pass out inet proto icmp icmp-type echorep divert-to 127.0.0.1 port 2002 no state"
 
-	jexec alcatraz $(atf_get_srcdir)/divapp 2001 divert-back &
+	jexec alcatraz $(atf_get_srcdir)/../common/divapp 2001 divert-back &
 	indivapp_pid=$!
-	jexec alcatraz $(atf_get_srcdir)/divapp 2002 divert-back &
+	jexec alcatraz $(atf_get_srcdir)/../common/divapp 2002 divert-back &
 	outdivapp_pid=$!
 	# Wait for the divappS to be ready
 	sleep 1