* HACKING: Document idiom to use with test_exit_status.
* tests/test-c32isalnum.c (main): If there were ASSERT failures, report
them instead of declaring SKIP.
* tests/test-c32isalpha.c (main): Likewise.
* tests/test-c32isblank.c (main): Likewise.
* tests/test-c32iscntrl.c (main): Likewise.
* tests/test-c32isdigit.c (main): Likewise.
* tests/test-c32isgraph.c (main): Likewise.
* tests/test-c32islower.c (main): Likewise.
* tests/test-c32isprint.c (main): Likewise.
* tests/test-c32ispunct.c (main): Likewise.
* tests/test-c32isspace.c (main): Likewise.
* tests/test-c32isupper.c (main): Likewise.
* tests/test-c32isxdigit.c (main): Likewise.
* tests/test-c32rtomb.c (main): Likewise.
* tests/test-c32rtomb-w32.c (main): Likewise.
* tests/test-c32snrtombs.c (main): Likewise.
* tests/test-c32srtombs.c (main): Likewise.
* tests/test-c32stombs.c (main): Likewise.
* tests/test-c32tolower.c (main): Likewise.
* tests/test-c32toupper.c (main): Likewise.
* tests/test-canonicalize.c (main): Likewise.
* tests/test-canonicalize-lgpl.c (main): Likewise.
* tests/test-duplocale.c (main): Likewise.
* tests/test-fbufmode.c (main): Likewise.
* tests/test-fenv-except-state-3.c (main): Likewise.
* tests/test-fenv-except-trapping-1.c (main): Likewise.
* tests/test-fenv-except-trapping-2.c (main): Likewise.
* tests/test-fnmatch.c (main): Likewise.
* tests/test-fnmatch-w32.c (main): Likewise.
* tests/test-fpurge.c (main): Likewise.
* tests/test-freadable.c (main): Likewise.
* tests/test-fseek.c (main): Likewise.
* tests/test-fseeko.c (main): Likewise.
* tests/test-ftell.c (main): Likewise.
* tests/test-ftell3.c (main): Likewise.
* tests/test-ftello.c (main): Likewise.
* tests/test-ftello3.c (main): Likewise.
* tests/test-fwritable.c (main): Likewise.
* tests/test-fwriting.c (main): Likewise.
* tests/test-getrandom.c (main): Likewise.
* tests/test-mbrlen-w32.c (main): Likewise.
* tests/test-mbrtoc16.c (main): Likewise.
* tests/test-mbrtoc16-w32.c (main): Likewise.
* tests/test-mbrtoc32.c (main): Likewise.
* tests/test-mbrtoc32-w32.c (main): Likewise.
* tests/test-mbrtowc-w32.c (main): Likewise.
* tests/test-mbsnrtoc32s.c (main): Likewise.
* tests/test-mbsrtoc32s.c (main): Likewise.
* tests/test-mbstoc32s.c (main): Likewise.
* tests/test-nl_langinfo2.c (main): Likewise.
* tests/test-nstrftime.c (main): Likewise.
* tests/test-passfd.c (main): Likewise.
* tests/test-posix_spawn-script.c (main): Likewise.
* tests/test-posix_spawnp-script.c (main): Likewise.
* tests/test-ptsname.c (main): Likewise.
* tests/test-ptsname_r.c (main): Likewise.
* tests/test-remove.c (main): Likewise.
* tests/test-strfmon_l.c (main): Likewise.
* tests/test-utime.c (main): Likewise.
* tests/test-wcrtomb-w32.c (main): Likewise.
* tests/test-execute-script.c (main): Obey CONTINUE_AFTER_ASSERT better.
* tests/test-spawn-pipe-script.c (main): Likewise.
* tests/test-linkat.c (main): Use the common idiom.
+2024-05-25 Bruno Haible <bruno@clisp.org>
+
+ tests: Before declaring a SKIP, test if there were ASSERT failures.
+ * HACKING: Document idiom to use with test_exit_status.
+ * tests/test-c32isalnum.c (main): If there were ASSERT failures, report
+ them instead of declaring SKIP.
+ * tests/test-c32isalpha.c (main): Likewise.
+ * tests/test-c32isblank.c (main): Likewise.
+ * tests/test-c32iscntrl.c (main): Likewise.
+ * tests/test-c32isdigit.c (main): Likewise.
+ * tests/test-c32isgraph.c (main): Likewise.
+ * tests/test-c32islower.c (main): Likewise.
+ * tests/test-c32isprint.c (main): Likewise.
+ * tests/test-c32ispunct.c (main): Likewise.
+ * tests/test-c32isspace.c (main): Likewise.
+ * tests/test-c32isupper.c (main): Likewise.
+ * tests/test-c32isxdigit.c (main): Likewise.
+ * tests/test-c32rtomb.c (main): Likewise.
+ * tests/test-c32rtomb-w32.c (main): Likewise.
+ * tests/test-c32snrtombs.c (main): Likewise.
+ * tests/test-c32srtombs.c (main): Likewise.
+ * tests/test-c32stombs.c (main): Likewise.
+ * tests/test-c32tolower.c (main): Likewise.
+ * tests/test-c32toupper.c (main): Likewise.
+ * tests/test-canonicalize.c (main): Likewise.
+ * tests/test-canonicalize-lgpl.c (main): Likewise.
+ * tests/test-duplocale.c (main): Likewise.
+ * tests/test-fbufmode.c (main): Likewise.
+ * tests/test-fenv-except-state-3.c (main): Likewise.
+ * tests/test-fenv-except-trapping-1.c (main): Likewise.
+ * tests/test-fenv-except-trapping-2.c (main): Likewise.
+ * tests/test-fnmatch.c (main): Likewise.
+ * tests/test-fnmatch-w32.c (main): Likewise.
+ * tests/test-fpurge.c (main): Likewise.
+ * tests/test-freadable.c (main): Likewise.
+ * tests/test-fseek.c (main): Likewise.
+ * tests/test-fseeko.c (main): Likewise.
+ * tests/test-ftell.c (main): Likewise.
+ * tests/test-ftell3.c (main): Likewise.
+ * tests/test-ftello.c (main): Likewise.
+ * tests/test-ftello3.c (main): Likewise.
+ * tests/test-fwritable.c (main): Likewise.
+ * tests/test-fwriting.c (main): Likewise.
+ * tests/test-getrandom.c (main): Likewise.
+ * tests/test-mbrlen-w32.c (main): Likewise.
+ * tests/test-mbrtoc16.c (main): Likewise.
+ * tests/test-mbrtoc16-w32.c (main): Likewise.
+ * tests/test-mbrtoc32.c (main): Likewise.
+ * tests/test-mbrtoc32-w32.c (main): Likewise.
+ * tests/test-mbrtowc-w32.c (main): Likewise.
+ * tests/test-mbsnrtoc32s.c (main): Likewise.
+ * tests/test-mbsrtoc32s.c (main): Likewise.
+ * tests/test-mbstoc32s.c (main): Likewise.
+ * tests/test-nl_langinfo2.c (main): Likewise.
+ * tests/test-nstrftime.c (main): Likewise.
+ * tests/test-passfd.c (main): Likewise.
+ * tests/test-posix_spawn-script.c (main): Likewise.
+ * tests/test-posix_spawnp-script.c (main): Likewise.
+ * tests/test-ptsname.c (main): Likewise.
+ * tests/test-ptsname_r.c (main): Likewise.
+ * tests/test-remove.c (main): Likewise.
+ * tests/test-strfmon_l.c (main): Likewise.
+ * tests/test-utime.c (main): Likewise.
+ * tests/test-wcrtomb-w32.c (main): Likewise.
+ * tests/test-execute-script.c (main): Obey CONTINUE_AFTER_ASSERT better.
+ * tests/test-spawn-pipe-script.c (main): Likewise.
+ * tests/test-linkat.c (main): Use the common idiom.
+
2024-05-25 Collin Funk <collin.funk1@gmail.com>
byteswap tests: Verify header can be used from C++.
When adding a module, add a unit test module as well. This is our best
chance to catch portability problems.
+A unit test can have many sub-tests. Try to make the sub-tests independent
+of each other, so that it becomes easy to disable some sub-tests by enclosing
+them in #if 0 ... #endif.
+
+The main() function's exit code meaning is:
+ - 0: PASS
+ - 77: SKIP; you should print the reason why the test is skipped.
+ - 99: ERROR, i.e. test framework error
+ - any other exit code < 126: FAIL
+
+In tests that #include "macros.h" and use the ASSERT macro:
+The main() function should, before it returns 0 (for PASS) or 77 (for SKIP)
+test the value of test_exit_status and return that instead. So:
+ - not
+ return 0;
+ but instead
+ return test_exit_status;
+ - not
+ return result; // where result can be 0 or 1
+ but instead
+ return (result ? result : test_exit_status);
+ - not
+ fputs ("Skipping test: <reason>\n", stderr);
+ return 77;
+ but instead
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
+ fputs ("Skipping test: <reason>\n", stderr);
+ return 77;
+ Only at the beginning of the main() function, when ASSERT has not yet been
+ invoked, we know that test_exit_status must be zero and can therefore write
+ fputs ("Skipping test: <reason>\n", stderr);
+ return 77;
+ directly.
+
Maintaining high quality
========================
case '4':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '4':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '4':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '4':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '4':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '4':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '4':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '4':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '4':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '4':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '4':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '4':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
}
if (result == 77)
- fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
- codepage);
+ {
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
+ fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
+ codepage);
+ }
return (result ? result : test_exit_status);
}
case '5':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '5':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '5':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '5':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '4':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '4':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
{
ASSERT (remove (BASE "/tra") == 0);
ASSERT (rmdir (BASE) == 0);
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("skipping test: symlinks not supported on this file system\n",
stderr);
return 77;
{
ASSERT (remove (BASE "/tra") == 0);
ASSERT (rmdir (BASE) == 0);
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("skipping test: symlinks not supported on this file system\n",
stderr);
return 77;
if (skipped)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: Spanish Unicode locale is not installed\n");
return 77;
}
}
}
- if (test_exit_status)
- return test_exit_status;
-
#if defined _WIN32 && !defined __CYGWIN__
/* On native Windows, scripts - even with '#!' marker - are not executable.
Only .bat and .cmd files are. */
ASSERT (fclose (fp) == 0);
ASSERT (unlink (DATA_FILENAME) == 0);
+ if (test_exit_status)
+ return test_exit_status;
fprintf (stderr, "Skipping test: scripts are not executable on this platform.\n");
return 77;
#else
return ret;
skip:
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: file operations failed.\n");
return 77;
}
terminates the program. */
if (sigfpe_on_invalid () < 0)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: trapping floating-point exceptions are not supported on this machine.\n", stderr);
return 77;
}
if (fedisableexcept (FE_ALL_EXCEPT) == -1
|| feenableexcept (uint_to_exceptions (a)) == -1)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: trapping floating-point exceptions are not supported on this machine.\n", stderr);
return 77;
}
#endif
if (known_failure)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: known failure on this platform\n", stderr);
return 77;
}
return test_exit_status;
skip:
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: trapping floating-point exceptions are not supported on this machine.\n", stderr);
return 77;
}
}
if (result == 77)
- fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
- codepage);
+ {
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
+ fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
+ codepage);
+ }
return (result ? result : test_exit_status);
}
case '5':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15)
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
return test_exit_status;
skip:
- fprintf (stderr, "Skipping test: prerequisite file operations failed.\n");
remove (TESTFILE);
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
+ fprintf (stderr, "Skipping test: prerequisite file operations failed.\n");
return 77;
}
return test_exit_status;
skip:
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: file operations failed.\n");
return 77;
}
{
if (FUNC_UNGETC_BROKEN)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n",
stderr);
return 77;
{
if (FUNC_UNGETC_BROKEN)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n",
stderr);
return 77;
{
if (FUNC_UNGETC_BROKEN)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n",
stderr);
return 77;
return test_exit_status;
skip:
- fprintf (stderr, "Skipping test: prerequisite file operations failed.\n");
remove (TESTFILE);
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
+ fprintf (stderr, "Skipping test: prerequisite file operations failed.\n");
return 77;
}
{
if (FUNC_UNGETC_BROKEN)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n",
stderr);
return 77;
return test_exit_status;
skip:
- fprintf (stderr, "Skipping test: prerequisite file operations failed.\n");
remove (TESTFILE);
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
+ fprintf (stderr, "Skipping test: prerequisite file operations failed.\n");
return 77;
}
return test_exit_status;
skip:
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: file operations failed.\n");
return 77;
}
return test_exit_status;
skip:
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: file operations failed.\n");
return 77;
}
if (getrandom (buf1, 1, 0) < 1)
if (getrandom (buf1, 1, GRND_RANDOM) < 1)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: getrandom is ineffective\n", stderr);
return 77;
}
ASSERT (rmdir (BASE "sub1") == 0);
ASSERT (rmdir (BASE "sub2") == 0);
free (cwd);
- if (!test_exit_status)
- {
- fputs ("skipping test: symlinks not supported on this file system\n",
- stderr);
- return 77;
- }
- return test_exit_status;
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
+ fputs ("skipping test: symlinks not supported on this file system\n",
+ stderr);
+ return 77;
}
dfd = open (".", O_RDONLY);
ASSERT (0 <= dfd);
}
if (result == 77)
- fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
- codepage);
+ {
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
+ fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
+ codepage);
+ }
return (result ? result : test_exit_status);
}
}
if (result == 77)
- fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
- codepage);
+ {
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
+ fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
+ codepage);
+ }
return (result ? result : test_exit_status);
}
case '5':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
}
if (result == 77)
- fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
- codepage);
+ {
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
+ fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
+ codepage);
+ }
return (result ? result : test_exit_status);
}
case '5':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
}
if (result == 77)
- fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
- codepage);
+ {
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
+ fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
+ codepage);
+ }
return (result ? result : test_exit_status);
}
case '5':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '5':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
case '5':
/* Locale encoding is GB18030. */
#if (defined __GLIBC__ && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 13 && __GLIBC_MINOR__ <= 15) || (GL_CHAR32_T_IS_UNICODE && (defined __FreeBSD__ || defined __NetBSD__ || defined __sun))
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: The GB18030 converter in this system's iconv is broken.\n", stderr);
return 77;
#endif
if (skipped_all)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: French locale is not installed\n", stderr);
return 77;
}
#if MUSL_LIBC
if (fail == 0)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("Skipping test: musl libc does not come with localizations\n",
stderr);
return 77;
ASSERT(recvfd (0, 0) == -1);
ASSERT(errno == ENOSYS);
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("skipping test: socketpair not supported on this system\n",
stderr);
return 77;
#if defined _WIN32 && !defined __CYGWIN__
/* On native Windows, scripts - even with '#!' marker - are not executable.
Only .bat and .cmd files are. */
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: scripts are not executable on this platform.\n");
return 77;
#else
#if defined _WIN32 && !defined __CYGWIN__
/* On native Windows, scripts - even with '#!' marker - are not executable.
Only .bat and .cmd files are. */
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: scripts are not executable on this platform.\n");
return 77;
#else
fd = open ("/dev/tty", O_RDONLY);
if (fd < 0)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: cannot open controlling tty\n");
return 77;
}
fd = open ("/dev/ptmx", O_RDWR | O_NOCTTY);
if (fd < 0)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: cannot open pseudo-terminal\n");
return 77;
}
fd = open ("/dev/ptc", O_RDWR | O_NOCTTY);
if (fd < 0)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: cannot open pseudo-terminal\n");
return 77;
}
fd = open ("/dev/tty", O_RDONLY);
if (fd < 0)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: cannot open controlling tty\n");
return 77;
}
fd = open ("/dev/ptmx", O_RDWR | O_NOCTTY);
if (fd < 0)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: cannot open pseudo-terminal\n");
return 77;
}
fd = open ("/dev/ptc", O_RDWR | O_NOCTTY);
if (fd < 0)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: cannot open pseudo-terminal\n");
return 77;
}
symlink. */
if (symlink (BASE "dir", BASE "link") != 0)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fputs ("skipping test: symlinks not supported on this file system\n",
stderr);
return 77;
}
}
- if (test_exit_status != EXIT_SUCCESS)
- return test_exit_status;
-
#if defined _WIN32 && !defined __CYGWIN__
/* On native Windows, scripts - even with '#!' marker - are not executable.
Only .bat and .cmd files are. */
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: scripts are not executable on this platform.\n");
return 77;
#else
glibc bug <https://sourceware.org/bugzilla/show_bug.cgi?id=19633>. */
if (setlocale (LC_ALL, "en_US.UTF-8") == NULL)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: English Unicode locale is not installed\n");
return 77;
}
if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL)
{
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
fprintf (stderr, "Skipping test: English Unicode locale is not installed\n");
return 77;
}
if (symlink (BASE "file", BASE "link"))
{
ASSERT (unlink (BASE "file") == 0);
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
if (print)
fputs ("skipping test: symlinks not supported on this file system\n",
stderr);
}
if (result == 77)
- fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
- codepage);
+ {
+ if (test_exit_status != EXIT_SUCCESS)
+ return test_exit_status;
+ fprintf (stderr, "Skipping test: found no locale with codepage %d\n",
+ codepage);
+ }
return (result ? result : test_exit_status);
}