From 87b042ff3ba0d49ccdaed6bbaf70423e3cb5cb39 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Fri, 12 Jul 2024 22:17:30 +0200 Subject: [PATCH] package/check: fix build on noMMU configurations check was failing to build on noMMU configurations due to mistake in the build conditionals of the code around the HAVE_FORK macro. This commit brings a patch, submitted upstream, that fixes those issues. Fixes: http://autobuild.buildroot.net/results/1509108aa111da706d544eb67e1ae2c2b34bd4e4/ Signed-off-by: Thomas Petazzoni (cherry picked from commit d10bee42012103fe7974c5e20be3af81e3c1c250) Signed-off-by: Peter Korsgaard --- ...k_run.c-fix-build-on-noMMU-platforms.patch | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 package/check/0002-src-check_run.c-fix-build-on-noMMU-platforms.patch diff --git a/package/check/0002-src-check_run.c-fix-build-on-noMMU-platforms.patch b/package/check/0002-src-check_run.c-fix-build-on-noMMU-platforms.patch new file mode 100644 index 0000000000..173fa4ae5a --- /dev/null +++ b/package/check/0002-src-check_run.c-fix-build-on-noMMU-platforms.patch @@ -0,0 +1,82 @@ +From c9bebf051aa7e3037ca8e0fe554e073204ffedde Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Fri, 12 Jul 2024 21:27:47 +0200 +Subject: [PATCH] src/check_run.c: fix build on noMMU platforms + +src/check_run.c defines sig_handler() under the following conditions: + + #if defined(HAVE_FORK) && HAVE_FORK==1 + +however, it does use sig_handler under the following conditions: + + #if defined(HAVE_SIGACTION) && defined(HAVE_FORK) + +which breaks when HAVE_FORK is defined, but has the value HAVE_FORK=0, +as is the case on noMMU platforms. + +This commit fixes this by ensuring that the build conditions are +aligned throughout check_run.c. + +Fixes: + +src/check_run.c: In function 'srunner_run_tagged': +src/check_run.c:802:38: error: 'sig_handler' undeclared (first use in this function); did you mean 'sa_handler'? +[...] + +Upstream: https://github.com/libcheck/check/pull/354 +Signed-off-by: Thomas Petazzoni +--- + src/check_run.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/check_run.c b/src/check_run.c +index 5f160e5..4c370b3 100644 +--- a/src/check_run.c ++++ b/src/check_run.c +@@ -772,12 +772,12 @@ void srunner_run_tagged(SRunner * sr, const char *sname, const char *tcname, + const char *include_tags, const char *exclude_tags, + enum print_output print_mode) + { +-#if defined(HAVE_SIGACTION) && defined(HAVE_FORK) ++#if defined(HAVE_SIGACTION) && defined(HAVE_FORK) && HAVE_FORK==1 + static struct sigaction sigalarm_old_action; + static struct sigaction sigalarm_new_action; + static struct sigaction sigint_new_action; + static struct sigaction sigterm_new_action; +-#endif /* HAVE_SIGACTION && HAVE_FORK */ ++#endif /* HAVE_SIGACTION && HAVE_FORK && HAVE_FORK==1 */ + + /* Get the selected test suite and test case from the + environment. */ +@@ -797,7 +797,7 @@ void srunner_run_tagged(SRunner * sr, const char *sname, const char *tcname, + eprintf("Bad print_mode argument to srunner_run_all: %d", + __FILE__, __LINE__, print_mode); + } +-#if defined(HAVE_SIGACTION) && defined(HAVE_FORK) ++#if defined(HAVE_SIGACTION) && defined(HAVE_FORK) && HAVE_FORK==1 + memset(&sigalarm_new_action, 0, sizeof(sigalarm_new_action)); + sigalarm_new_action.sa_handler = sig_handler; + sigaction(SIGALRM, &sigalarm_new_action, &sigalarm_old_action); +@@ -809,16 +809,16 @@ void srunner_run_tagged(SRunner * sr, const char *sname, const char *tcname, + memset(&sigterm_new_action, 0, sizeof(sigterm_new_action)); + sigterm_new_action.sa_handler = sig_handler; + sigaction(SIGTERM, &sigterm_new_action, &sigterm_old_action); +-#endif /* HAVE_SIGACTION && HAVE_FORK */ ++#endif /* HAVE_SIGACTION && HAVE_FORK && HAVE_FORK==1 */ + srunner_run_init(sr, print_mode); + srunner_iterate_suites(sr, sname, tcname, include_tags, exclude_tags, + print_mode); + srunner_run_end(sr, print_mode); +-#if defined(HAVE_SIGACTION) && defined(HAVE_FORK) ++#if defined(HAVE_SIGACTION) && defined(HAVE_FORK) && HAVE_FORK==1 + sigaction(SIGALRM, &sigalarm_old_action, NULL); + sigaction(SIGINT, &sigint_old_action, NULL); + sigaction(SIGTERM, &sigterm_old_action, NULL); +-#endif /* HAVE_SIGACTION && HAVE_FORK */ ++#endif /* HAVE_SIGACTION && HAVE_FORK && HAVE_FORK==1 */ + } + + void srunner_run(SRunner * sr, const char *sname, const char *tcname, +-- +2.45.2 +