summaryrefslogtreecommitdiff
path: root/test-skeleton.c
AgeCommit message (Collapse)Author
2018-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
* All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
2017-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
2016-12-09support: Introduce new subdirectory for test infrastructureFlorian Weimer
The new test driver in <support/test-driver.c> has feature parity with the old one. The main difference is that its hooking mechanism is based on functions and function pointers instead of macros. This commit also implements a new environment variable, TEST_COREDUMPS, which disables the code which disables coredumps (that is, it enables them if the invocation environment has not disabled them). <test-skeleton.c> defines wrapper functions so that it is possible to use existing macros with the new-style hook functionality. This commit changes only a few test cases to the new test driver, to make sure that it works as expected.
2016-11-27Minor problems exposed by compiling C++ tests under _ISOMAC.Zack Weinberg
* libio/libio.h: Use __USE_GNU, not _GNU_SOURCE, in a conditional. * test-skeleton.c: Include stdint.h to ensure uintptr_t is available.
2016-11-07Document do_test in test-skeleton.cSteve Ellcey
* test-skeleton.c: Document do_test usage.
2016-10-07Consolidate fallocate{64} implementationsAdhemerval Zanella
This patch consolidates all the fallocate{64} implementation for Linux in only one (sysdeps/unix/sysv/linux/fallocate{64}.c). It also removes the syscall from the auto-generation using assembly macros. The new macro SYSCALL_LL{64} is used to handle the offset argument. Checked on x86_64, x32, i386, aarch64, and ppc64le. * sysdeps/unix/sysv/linux/Makefile (test): Add tst-fallocate and tst-fallocate64. * sysdeps/unix/sysv/linux/tst-fallocate.c: New file. * sysdeps/unix/sysv/linux/tst-fallocate64.c: Likewise. * sysdeps/unix/sysv/linux/tst-fallocate-common.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c: Remove file. * sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/fallocate64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/fallocate.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/fallocate64.c: Likewise. * sysdeps/unix/sysv/linux/fallocate.c (fallocate): Use SYSCALL_LL macro on offset argument. * sysdeps/unix/sysv/linux/fallocate64.c (fallocate64): Use SYSCALL_LL64 on offset argument. * test-skeleton.c (FAIL_RET): Add macro. (FAIL_EXIT): Likewise. (FAIL_EXIT1): Likewise. (_FAIL): Likewise.
2016-09-23test-skeleton.c: Remove unintended #include <stdarg.h>.Florian Weimer
2016-09-21Add test case for O_TMPFILE handling in open, openatFlorian Weimer
Also put xasprintf into test-skeleton.c (written in such a way that including <stdarg.h> is not needed).
2016-08-26Fix test-skeleton C99 designed initializationAdhemerval Zanella
ISO C forbids empty initializer braces (6.7.9 initializer-list must contain at least one initializer). However GCC allows it, generating a warning depending of the version. With GCC 4.8 on ARM I noticed tst-initializers1.c fails to build with: In file included from tst-initializers1.c:60:0: ../test-skeleton.c: In function 'delayed_exit_thread': ../test-skeleton.c:687:10: error: missing initializer for field 'tv_sec' of 'struct timespec' [-Werror=missing-field-initializers] struct timespec remaining = {} While with GCC 5.1 the same warning is just spilled with -pedantic. To be safe this patch just zero initialize the struct as expected. Tested on armhf. * test-skeleton.c (delayed_exit_thread): Add initializer on struct timespec C99 designated initialization.
2016-08-26nptl: Avoid expected SIGALRM in most tests [BZ #20432]Florian Weimer
Before this change, several tests did not detect early deadlocks because they used SIGALRM as the expected signal, and they ran for the full default TIMEOUT seconds. This commit adds a new delayed_exit function to the test skeleton, along with several error-checking wrappers to pthread functions. Additional error checking is introduced into several tests.
2016-08-02malloc: Run tests without calling mallopt [BZ #19469]Florian Weimer
The compiled tests no longer refer to the mallopt symbol from their main functions. (Some tests still call mallopt explicitly, which is fine.)
2016-06-23test-skeleton.c (xrealloc): Support realloc-as-freeFlorian Weimer
If the requested size is zero, realloc returns NULL, but the deallocation is still successful, unless the pointer is also NULL, when realloc behaves as malloc (0).
2016-06-23test-skeleton.c: xmalloc, xcalloc, xrealloc are potentially unusedFlorian Weimer
__attribute__ ((used)) means that the function has to be emitted in assembly because it is referenced in ways the compiler cannot detect (such as asm statements, or some post-processing on the generated assembly). The unused attribute needs to come first, otherwise it is applied to the return type and not the function definition.
2016-06-23test-skeleton.c: Add write_message functionFlorian Weimer
2016-06-082016-06-09 Paul Pluzhnikov <ppluzhnikov@gmail.com>Paul Pluzhnikov
* test-skeleton.c (oom_error, xmalloc, xcalloc, xrealloc): New functions. (add_temp_file): Use them.
2016-03-07test-skeleton.c: Do not set RLIMIT_DATA [BZ #19648]Florian Weimer
With older kernels, it is mostly ineffective because it causes malloc to switch from sbrk to mmap (potentially invalidating malloc testing compared to what real appliations do). With newer kernels which have switched to enforcing RLIMIT_DATA for mmap as well, some test cases will fail in an unintended fashion because the limit which was set previously does not include room for all mmap mappings.
2016-02-19test-skeleton: increase default TIMEOUT to 20 secondsMike Frysinger
The vast majority of timeouts I've seen w/glibc tests are due to: - slow system (e.g. <1 GHz cpu) - loaded system (e.g. lots of parallelism) Even then, I've seen timeouts on system I don't generally consider slow, or even loaded, and considering TIMEOUT is set to <=10 in ~60 tests (and <=20 in ~75 tests), it seems I'm not alone. I've just gotten in the habit of doing `export TIMEOUTFACTOR=10` on all my setups. In the edge case where there is a bug in the test and the timeout is hit, I think we all agree that's either a problem with the test or a real bug in the library somewhere. In either case, the incident rate should be low, so catering to that seems like the wrong trade-off. Other developers too usually set large timeout factors. Increase the default to 20 seconds to match reality.
2016-01-04Update copyright dates with scripts/update-copyrights.Joseph Myers
2015-08-05test-skeleton: add usage informationMike Frysinger
I keep trying to run tests with --help and then remembering that does nothing when it throws an error. That means I have to dig into the source when I want to refer to flags or env vars and re-read a good amount of code to find the nested locations. Make this all much more user friendly with a usage screen that gets printed out whenever an unknown option is specified.
2015-06-05Avoid outputting to TTY after an expected memory corruption in testcaseTulio Magno Quites Machado Filho
Protect TTY against an expected memory corruption from testcase tst-malloc-backtrace, which is expected to SIGABRT after a forced memory corruption.
2015-05-18Ensure `wint_t' is defined before use in include/stdio.hArjun Shankar
While trying to get nptl/tst-initializers1.c to include the test skeleton, I came across a couple of speed bumps. Firstly: after making the appropriate changes to the test, running `make check' led to this error: > In file included from ../malloc/malloc.h:24:0, .. > from tst-initializers1.c:60: > ../include/stdio.h:111:1: error: unknown type name `wint_t' > extern wint_t __getwc_unlocked (FILE *__fp); So, `wint_t' is used before being defined. Question: Why did test-skeleton.c not cause this error in any of the other tests that include it? Anyway, I noticed include/stdio.h includes stddef.h, which in turn defines `wint_t', but only if `__need_wint_t' is defined. So I put in a `#define __need_wint_t' before the include to get rid of the error. Is that the correct fix? A subsequent `make && make check' led to this second error: > from tst-initializers1-c89.c:1: > ../test-skeleton.c: In function `main': > ../test-skeleton.c:356:11: error: `for' loop initial declarations are only > allowed in C99 mode > for (struct temp_name_list *n = temp_name_list; Although there seem to be several other C89 no-noes in test-skeleton.c, I needed only to fix this specific one for gcc-4.8.3 to stop complaining.
2015-04-27test-skeleton: Support temporary files without memory leaks [BZ#18333]Florian Weimer
add_temp_file now makes a copy which is freed by delete_temp_files. Callers to create_temp_file can now free the returned file name to avoid the memory leak. These changes do not affect the leak behavior of existing code. Also address a NULL pointer derefence in tzset after a memoru allocation failure, found during testing.
2015-04-09Make test-skeleton.c grok TEST_DIRECT magic environment variable.Roland McGrath
2015-01-02Update copyright dates with scripts/update-copyrights.Joseph Myers
2014-11-12Fix tst-strcoll-overflow returning before timeout (BZ #17506)Leonhard Holz
Modifies the test examination in test-skeleton.c so that a test can be successful if it is interrupted or it returns uninterrupted with the expected status. For this both EXPECTED_SIGNAL and EXPECTED_STATUS have to be set, as is done in tst-strcoll-overflow.c.
2014-06-30test-skeleton: Kill any child process's offspringMaciej W. Rozycki
This makes sure any subprocesses created by the program being tested get killed as well if their parent times out. Otherwise if they are really stuck, they may remain there running forever after the test case and then the whole test suite has completed, until killed by hand. * test-skeleton.c (signal_handler): Kill the whole process group before killing the child individually. (main): Report any failure on `setpgid'.
2014-06-23test-skeleton.c: Use stdout for error messagesWill Newton
At the moment the test skeleton uses a mixture of stdout and stderr for error message output. Using stdout for all test output keeps all output correctly ordered and properly redirected to the output file. The suggestion to use stdout is also made on the wiki: https://sourceware.org/glibc/wiki/Testing/Testsuite#Writing_a_test_case ChangeLog: 2014-06-23 Will Newton <will.newton@linaro.org> * test-skeleton.c (signal_handler): Use printf and %m rather than perror. Use printf rather than fprintf to stderr. Use puts rather than fputs to stderr. (main): Likewise.
2014-02-08tests: unify fortification handler logicMike Frysinger
We have multiple tests that copy & paste the same logic for disabling the fortification output. Let's unify this in the test-skeleton instead. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-01-01Update copyright notices with scripts/update-copyrightsAllan McRae
2013-01-02Update copyright notices with scripts/update-copyrights.Joseph Myers
2012-02-09Replace FSF snail mail address with URLs.Paul Eggert
2009-08-14Improve test-skeleton.c to clean up after dead parent.Ulrich Drepper
2005-12-23(timeout_handler): Rewrite ts initialization for C++.Ulrich Drepper
2005-03-08* malloc/arena.c (ptmalloc_init): Recognize MALLOC_PERTURB_ and callUlrich Drepper
mallopt appropriately. * malloc/malloc.h: Define M_PERTURB. * malloc/malloc.c (perturb_byte): New variable. (alloc_perturb, free_perturb): New macros. (_int_malloc): Before returning, overwrite the memory if this is requested. (_int_free): Overwrite freed memory if requested. (mALLOPt): Handle M_PERTURB. * test-skeleton.c: Add call to mallopt with M_PERTURB command.
2004-12-22(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.Ulrich Drepper
2007-07-122.5-18.1Jakub Jelinek
2004-02-19Update.Ulrich Drepper
2004-02-18 Carlos O'Donell <carlos@baldric.uwo.ca> * test-skeleton.c (main): If set, use environment variable TIMEOUTFACTOR to scale test TIMEOUT.
2003-12-31Update.Ulrich Drepper
* inet/rcmd.c: Provide better error message in case of unknown host. Remove USE_IN_LIBIO. * nscd/nscd.init: Updated version, more conforming with current init file standards. * nscd/nscd-client.h (_PATH_NSCDPID): Move the file into /var/run/nscd directory. (_PATH_NSCDSOCKET): Likewise. * test-skeleton.c (timeout_handler): Fix error message.
2003-06-25* posix/transbug.c: Include <string.h> for memset and strlen Andreas Jaeger
declarations. * stdio-common/tst-sprintf.c: Include <stdlib.h> for free declaration. * stdlib/tst-strtod.c (main): Pass long double value. * test-skeleton.c: Include <time.h> for nanosleep declaration. 2003-06-25 Andreas Jaeger <aj@suse.de> * posix/transbug.c: Include <string.h> for memset and strlen declarations. * stdio-common/tst-sprintf.c: Include <stdlib.h> for free declaration. * stdlib/tst-strtod.c (main): Pass long double value. * test-skeleton.c: Include <time.h> for nanosleep declaration.
2003-06-25Update.Ulrich Drepper
2003-06-19 Jakub Jelinek <jakub@redhat.com> * test-skeleton.c (timeout_handler): If waitpid returned 0, retry once after a second. If killed == 0, assume WTERMSIG (status) == SIGKILL.
2003-06-07Update.Ulrich Drepper
* test-skeleton.c (main): If EXPECTED_STATUS is defined check that returned status from child matches.
2003-06-07Update.Ulrich Drepper
2003-06-07 Ulrich Drepper <drepper@redhat.com> * Makeconfig (gnulib): Add -lgcc_eh once again.
2003-06-07Update.Ulrich Drepper
* test-skeleton.c (main): Use TEMP_FAILURE_RETRY with waitpid.
2003-06-01Update.Ulrich Drepper
* test-skeleton.c (main): Request getopt to not reorder the command line.
2002-12-19Update.Ulrich Drepper
* test-skeleton.c (main): Make sure correct value is seen as argv[0] after adjustment of argv, and argc.
2002-12-13* posix/bug-regex15.c: New file.Roland McGrath
* posix/Makefile (tests): Add it. * test-skeleton.c (TEST_DATA_LIMIT): New macro, default to 64MB. (main): Set RLIMIT_DATA limit to TEST_DATA_LIMIT (or lower if need be).
2002-12-07Update.Ulrich Drepper
* test-skeleton.c (timeout_handler): Allow expected signal to be SIGALRM.
2002-09-302002-09-29 Roland McGrath <roland@redhat.com>Roland McGrath
* test-skeleton.c (timeout_handler): Use WUNTRACED flag in waitpid. Examine the child's status and print something different if it wasn't just killed by our SIGKILL. (main): In the child process call setpgid to put it in its own pgrp.
2002-09-15Update.Ulrich Drepper
* test-skeleton.c (main): Provide more information in case waitpid fails.
2002-09-06(main): Improve error message for unexpected signal case.Ulrich Drepper