]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3351] use execve to silence valgrind on child exit
authorRazvan Becheriu <razvan@isc.org>
Thu, 17 Oct 2024 17:03:13 +0000 (20:03 +0300)
committerRazvan Becheriu <razvan@isc.org>
Thu, 17 Oct 2024 19:01:29 +0000 (22:01 +0300)
configure.ac
src/lib/process/tests/.gitignore
src/lib/process/tests/Makefile.am
src/lib/process/tests/daemon_unittest.cc
src/lib/process/tests/process_test.sh.in [new file with mode: 0644]

index 9fc41611fcc7f13800a0366b86da7c134f3cae50..5bafc2cb63576fc4cadfbd2596cc4cbf33be4e0b 100644 (file)
@@ -1682,6 +1682,8 @@ AC_CONFIG_FILES([src/lib/process/cfgrpt/Makefile])
 AC_CONFIG_FILES([src/lib/process/cfgrpt/tests/Makefile])
 AC_CONFIG_FILES([src/lib/process/tests/Makefile])
 AC_CONFIG_FILES([src/lib/process/testutils/Makefile])
+AC_CONFIG_FILES([src/lib/process/tests/process_test.sh],
+                [chmod +x src/lib/process/tests/process_test.sh])
 AC_CONFIG_FILES([src/lib/stats/Makefile])
 AC_CONFIG_FILES([src/lib/stats/tests/Makefile])
 AC_CONFIG_FILES([src/lib/stats/testutils/Makefile])
index 21c391e461dd212c5c88beeb5fb0dde85cf8771c..98b8080cfcebe8f478acb4af78da77d857c698b3 100644 (file)
@@ -1 +1,2 @@
 /libprocess_unittests
+/process_test.sh
index f556c76593763fb875b951c3ae8491742003f76e..30e5057b75bf540f557967463b10f8e3587b9af1 100644 (file)
@@ -3,6 +3,7 @@ dhcp_data_dir = @runstatedir@/@PACKAGE@
 AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
 AM_CPPFLAGS += $(BOOST_INCLUDES)
 AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/lib/process/tests\"
+AM_CPPFLAGS += -DTEST_SCRIPT_SH=\"$(abs_top_builddir)/src/lib/process/tests/process_test.sh\"
 AM_CPPFLAGS += -DDATA_DIR="\"$(dhcp_data_dir)\""
 AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
 
index ca0bcd1f317e606c7792cb420880a33700eb7ece..3ac29f29839e0ffdc688d82736596cf406da2350 100644 (file)
@@ -221,8 +221,11 @@ TEST_F(DaemonTest, createPIDFileOverwrite) {
     ASSERT_GE(pid, 0);
 
     if (pid == 0) {
-        // This is the child, die right away. Tragic, no?
-        _exit (0);
+        char name[] = TEST_SCRIPT_SH;
+        char* argv[] = { name, 0 };
+        char* envp[] = { 0 };
+        execve(name, argv, envp);
+        _exit(0);
     }
 
     // Back in the parent test, we need to wait for the child to die
diff --git a/src/lib/process/tests/process_test.sh.in b/src/lib/process/tests/process_test.sh.in
new file mode 100644 (file)
index 0000000..1a24852
--- /dev/null
@@ -0,0 +1 @@
+#!/bin/sh