git: 5132e16e1fd9 - main - libc tests: Rename the quick_exit test file, fix style
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 07 Aug 2024 16:08:38 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5132e16e1fd987d88798fc9dbb7a10ae3413e86f commit 5132e16e1fd987d88798fc9dbb7a10ae3413e86f Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-07-29 14:37:47 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-08-07 16:05:16 +0000 libc tests: Rename the quick_exit test file, fix style Call it libc_exit_test instead of exit_test because the NetBSD test suite already has a file with the latter name. This is in preparation for adding other exit()-related tests. MFC after: 2 weeks --- ObsoleteFiles.inc | 3 +++ lib/libc/tests/stdlib/Makefile | 2 +- .../stdlib/{quick_exit_test.c => libc_exit_test.c} | 18 +++++++++++------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index f6984b49711c..afd22301a39c 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20240729: rename quick_exit_test to libc_exit_test +OLD_FILES+=usr/tests/lib/libc/stdlib/quick_exit_test + # 20240729: retire ifaddr_byindex OLD_FILES+=usr/share/man/man9/ifaddr_byindex.9.gz diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile index cf1a204cfb4a..29cf895006d1 100644 --- a/lib/libc/tests/stdlib/Makefile +++ b/lib/libc/tests/stdlib/Makefile @@ -3,6 +3,7 @@ ATF_TESTS_C+= clearenv_test ATF_TESTS_C+= dynthr_test ATF_TESTS_C+= heapsort_test +ATF_TESTS_C+= libc_exit_test ATF_TESTS_C+= mergesort_test ATF_TESTS_C+= qsort_test .if ${COMPILER_TYPE} == "clang" @@ -11,7 +12,6 @@ ATF_TESTS_C+= qsort_b_test ATF_TESTS_C+= qsort_r_compat_test ATF_TESTS_C+= qsort_r_test ATF_TESTS_C+= qsort_s_test -ATF_TESTS_C+= quick_exit_test ATF_TESTS_C+= set_constraint_handler_s_test ATF_TESTS_C+= strfmon_test ATF_TESTS_C+= tsearch_test diff --git a/lib/libc/tests/stdlib/quick_exit_test.c b/lib/libc/tests/stdlib/libc_exit_test.c similarity index 83% rename from lib/libc/tests/stdlib/quick_exit_test.c rename to lib/libc/tests/stdlib/libc_exit_test.c index 9feed8a6fa63..c47d03d1d598 100644 --- a/lib/libc/tests/stdlib/quick_exit_test.c +++ b/lib/libc/tests/stdlib/libc_exit_test.c @@ -12,32 +12,36 @@ #include <atf-c.h> -static void func_a(void) +static void +func_a(void) { if (write(STDOUT_FILENO, "a", 1) != 1) _Exit(1); } -static void func_b(void) +static void +func_b(void) { if (write(STDOUT_FILENO, "b", 1) != 1) _Exit(1); } -static void func_c(void) +static void +func_c(void) { if (write(STDOUT_FILENO, "c", 1) != 1) _Exit(1); } -static void child(void) +static void +child(void) { - // this will be received by the parent + /* this will be received by the parent */ printf("hello, "); fflush(stdout); - // this won't, because quick_exit() does not flush + /* this won't, because quick_exit() does not flush */ printf("world"); - // these will be called in reverse order, producing "abc" + /* these will be called in reverse order, producing "abc" */ if (at_quick_exit(func_c) != 0 || at_quick_exit(func_b) != 0 || at_quick_exit(func_a) != 0)