aboutsummaryrefslogtreecommitdiff
path: root/support
AgeCommit message (Collapse)Author
2021-01-29elf: Fix tests that rely on ld.so.cache for cross-compilingAdhemerval Zanella
For configurations with cross-compiling equal to 'maybe' or 'no', ldconfig will not run and thus the ld.so.cache will not be created on the container testroot.pristine. This lead to failures on both tst-glibc-hwcaps-prepend-cache and tst-ldconfig-ld_so_conf-update on environments where the same compiler can be used to build different ABIs (powerpc and x86 for instance). This patch addas a new test-container hook, ldconfig.run, that triggers a ldconfig execution prior the test execution. Checked on x86_64-linux-gnu and i686-linux-gnu.
2021-01-11posix: Fix return value of system if shell can not be executed [BZ #27053]Adhemerval Zanella
POSIX states that system returned code for failure to execute the shell shall be as if the shell had terminated using _exit(127). This behaviour was removed with 5fb7fc96350575. Checked on x86_64-linux-gnu.
2021-01-11support: Add xchmod wrapperAdhemerval Zanella
Checked on x86_64-linux-gnu.
2021-01-10 Add xfchmod to libsupportAlexandra Hájková
2021-01-09Add xchdir to libsupport.Alexandra Hájková
2021-01-05support: Add support_small_thread_stack_sizeAdhemerval Zanella
It returns the minimum stack size large enough to cover most internal glibc stack usage.
2021-01-02Update copyright dates with scripts/update-copyrightsPaul Eggert
I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 6694 files FOO. I then removed trailing white space from benchtests/bench-pthread-locks.c and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this diagnostic from Savannah: remote: *** pre-commit check failed ... remote: *** error: lines with trailing whitespace found remote: error: hook declined to update refs/heads/master
2020-12-28support: Make support_process_state_wait wait lessSamuel Thibault
Tests such as posix/tst-waitid.c make heavy use of support_process_state_wait, and thus on non-Linux where it falls back to sleeping, a 2s sleep makes such test time out, while 1s remains fine enough.
2020-12-11support: Add support_slibdir_prefix variableFlorian Weimer
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-11-26support: Add support_copy_fileFlorian Weimer
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-10-16support: Add create_temp_file_in_dirAdhemerval Zanella
It allows created a temporary file in a specified directory.
2020-10-14support: Provide a way to clear the RA bit in DNS server responsesFlorian Weimer
2020-10-14support: Provide a way to reorder responses within the DNS test serverFlorian Weimer
2020-07-14Correct timespec implementation [BZ #26232]H.J. Lu
commit 04deeaa9ea74b0679dfc9d9155a37b6425f19a9f Author: Lucas A. M. Magalhaes <lamm@linux.ibm.com> Date: Fri Jul 10 19:41:06 2020 -0300 Fix time/tst-cpuclock1 intermitent failures has 2 issues: 1. It assumes time_t == long which is false on x32. 2. tst-timespec.c is compiled without -fexcess-precision=standard which generates incorrect results on i686 in support_timespec_check_in_range: double ratio = (double)observed_norm / expected_norm; return (lower_bound <= ratio && ratio <= upper_bound); This patch does 1. Compile tst-timespec.c with -fexcess-precision=standard. 2. Replace long with time_t. 3. Replace LONG_MIN and LONG_MAX with TYPE_MINIMUM (time_t) and TYPE_MAXIMUM (time_t).
2020-07-10Fix time/tst-cpuclock1 intermitent failuresLucas A. M. Magalhaes
This test fails intermittently in systems with heavy load as CLOCK_PROCESS_CPUTIME_ID is subject to scheduler pressure. Thus the test boundaries were relaxed to keep it from failing on such systems. A refactor of the spent time checking was made with some support functions. With the advantage to representing time jitter in percent of the target. The values used by the test boundaries are all empirical. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-07-07string: Add strerror, strerror_r, and strerror_l testAdhemerval Zanella
Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, and s390x-linux-gnu. Tested-by: Carlos O'Donell <carlos@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-06-04support: Fix detecting hole support on >2KB-block filesystemsSamuel Thibault
When detecting hole support, we write at 16MiB, and filesystems will typically need two levels of data to record that. On filesystems with 8KB block, the two indirection blocks will require a total of 16KB overhead, thus 32 512-byte sectors. Spotted on GNU/Hurd with a 4KB blocks filesystem, but also happens on Linux with 4KB or 8KB blocks filesystems. * support/support_descriptor_supports_holes.c (support_descriptor_supports_holes): Set block_headroom to 32.
2020-05-29build: Use FAIL_EXIT1 () on failure to exec child [BZ #23990]Girish Joshi
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-05-12support: Add support_blob_repeat_allocate_sharedFlorian Weimer
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-04-30support: Set errno before testing it.Carlos O'Donell
In test-conainer we should set errno to 0 before calling strtol, and check after with TEST_COMPARE. In tst-support_capture_subprocess we should set errno to 0 before checking it after the call to strtol. Tested on x86_64. Reviewed-by: DJ Delorie <dj@redhat.com>
2020-04-30test-container: Support $(complocaledir) and mkdirp.Carlos O'Donell
Expand the support infrastructure: - Create $(complocaledir) in the testroot.pristine to support localedef. - Add the variable $complocaledir to script support. - Add the script command 'mkdirp'. All localedef tests which run with default paths need to have the $(complocaledir) created in testroot.pristine. The localedef binary will not by itself create the default path, but it will write into the path. By adding this we can simplify the localedef tests. The variable $complocaledir is the value of the configured $(complocaledir) which is the location of the compiled locales that will be searched by the runtime by default. The command mkdirp will be available in script setup and will be equivalent to running `mkdir -p`. The variable and command can be used to write more complex tests. Reviewed-by: DJ Delorie <dj@redhat.com>
2020-04-27support: Implement <support/xthread.h> key create/deleteMathieu Desnoyers
Expose xpthread_key_create and xpthread_key_delete wrappers for tests.
2020-04-26localedef: Add verbose messages for failure paths.Carlos O'Donell
During testing of localedef running in a minimal container there were several error cases which were hard to diagnose since they appeared as strerror (errno) values printed by the higher level functions. This change adds three new verbose messages for potential failure paths. The new messages give the user the opportunity to use -v and display additional information about why localedef might be failing. I found these messages useful myself while writing a localedef container test for --no-hard-links. Since the changes cleanup the code that handle codeset normalization we add tst-localedef-path-norm which contains many sub-tests to verify the correct expected normalization of codeset strings both when installing to default paths (the only time normalization is enabled) and installing to absolute paths. During the refactoring I created at least one buffer-overflow which valgrind caught, but these tests did not catch because the exec in the container had a very clean heap with zero-initialized memory. However, between valgrind and the tests the results are clean. The new tst-localedef-path-norm passes without regression on x86_64. Change-Id: I28b9f680711ff00252a2cb15625b774cc58ecb9d
2020-04-03support: Change xgetline to return 0 on EOFFlorian Weimer
The advantage is that the buffer will always contain the number of characters as returned from the function, which allows one to use a sequence like /* No more audit module output. */ line_length = xgetline (&buffer, &buffer_length, fp); TEST_COMPARE_BLOB ("", 0, buffer, line_length); to check for an expected EOF, while also reporting any unexpected extra data encountered. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-03-25support/shell-container.c: Add builtin killAdhemerval Zanella
No options supported. Reviewed-by: DJ Delorie <dj@redhat.com>
2020-03-25support/shell-container.c: Add builtin exitAdhemerval Zanella
Reviewed-by: DJ Delorie <dj@redhat.com>
2020-03-25support/shell-container.c: Return 127 if execve failsAdhemerval Zanella
Reviewed-by: DJ Delorie <dj@redhat.com>
2020-03-11test-container: print errno when execvp failsMichael Hudson-Doyle
I'm debugging a situation where lots of tests using test-container fail and it's possible knowing errno would help understand why. Reviewed-by: DJ Delorie <dj@redhat.com>
2020-03-02Fixed typo in run_command_array() in support/shell-container.cGirish Joshi
https://sourceware.org/bugzilla/show_bug.cgi?id=23991
2020-02-27support: Add support_process_state_waitAdhemerval Zanella
It allows parent process to wait for child state using a polling strategy over procfs on Linux. The polling is used over ptrace to avoid the need to handle signals on the target pid and to handle some system specific limitation (such as YAMA). The polling has some limitations, such as resource consumption due the procfs read in a loop and the lack of synchronization after the state is obtained. The interface idea is to simplify some sleep synchronization waitid tests and is to reduce timeouts by replacing arbitrary waits.
2020-02-09support: Add the xlstat functionFlorian Weimer
2020-02-03test-container: add exec, cwdDJ Delorie
exec <path_to_test_binary> [optional_argv_0] copies test binary to specified location and runs it from there. If the second argument is provided, that will be used for argv[0] cwd <directory> attempts to chdir(directory) before running test Note: "cwd" not "cd" as it takes effect just before the test binary runs, not when it's encountered in the script, so it can't be used as a path shortcut like "cd" would imply. cleanup: use xstrdup() instead of strdup() Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-01-01Update copyright dates with scripts/update-copyrights.Joseph Myers
2019-11-27resolv: Implement trust-ad option for /etc/resolv.conf [BZ #20358]Florian Weimer
This introduces a concept of trusted name servers, for which the AD bit is passed through to applications. For untrusted name servers (the default), the AD bit in responses are cleared, to provide a safe default. This approach is very similar to the one suggested by Pavel Šimerda in <https://bugzilla.redhat.com/show_bug.cgi?id=1164339#c15>. The DNS test framework in support/ is enhanced with support for setting the AD bit in responses. Tested on x86_64-linux-gnu. Change-Id: Ibfe0f7c73ea221c35979842c5c3b6ed486495ccc
2019-11-13support: Fix support_set_small_thread_stack_size to build on HurdFlorian Weimer
PTHREAD_STACK_MIN comes from <limits.h>, so include it explicitly. However, it is not defined on Hurd, so compensate for that as well. Built on x86_64-linux-gnu, i686-linux-gnu, i686-gnu. Change-Id: Ifacc888ef86731c2639721b0932ae59583bd6b3e Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-11-11support: Add xsetlocale functionArjun Shankar
2019-11-11support: Add support_set_small_thread_stack_sizeFlorian Weimer
And support_small_stack_thread_attribute Change-Id: I1cf79a469984f8f30a4a947ee9ec2a5e74de8926
2019-10-31Sync timespec-{add,sub} with gnulibAdhemerval Zanella
It sync with gnulib commit 06011ed74e978613422aca43c0bd92dc44213933. Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
2019-10-30Change most internal uses of __gettimeofday to __clock_gettime.Zack Weinberg
Since gettimeofday will shortly be implemented in terms of clock_gettime on all platforms, internal code should use clock_gettime directly; in addition to removing a layer of indirection, this will allow us to remove the PLT-bypass gunk for gettimeofday. (We can't quite do that yet, but it'll be coming later in this patch series.) In many cases, the changed code does fewer conversions. The changed code always assumes __clock_gettime (CLOCK_REALTIME) cannot fail. Most of the call sites were assuming gettimeofday could not fail, but a few places were checking for errors. POSIX says clock_gettime can only fail if the clock constant is invalid or unsupported, and CLOCK_REALTIME is the one and only clock constant that's required to be supported. For consistency I grepped the entire source tree for any other places that checked for errors from __clock_gettime (CLOCK_REALTIME), found one, and changed it too. (For the record, POSIX also says gettimeofday can never fail.) (It would be nice if we could declare that GNU systems will always support CLOCK_MONOTONIC as well as CLOCK_REALTIME; there are several places where we are using CLOCK_REALTIME where _MONOTONIC would be more appropriate, and/or trying to use _MONOTONIC and then falling back to _REALTIME. But the Hurd doesn't support CLOCK_MONOTONIC yet, and it looks like adding it would involve substantial changes to gnumach's internals and API. Oh well.) A few Hurd-specific files were changed to use __host_get_time instead of __clock_gettime, as this seemed tidier. We also assume this cannot fail. Skimming the code in gnumach leads me to believe the only way it could fail is if __mach_host_self also failed, and our Hurd-specific code consistently assumes that can't happen, so I'm going with that. With the exception of support/support_test_main.c, test cases are not modified, mainly because I didn't want to have to figure out which test cases were testing gettimeofday specifically. The definition of GETTIME in sysdeps/generic/memusage.h had a typo and was not reading tv_sec at all. I fixed this. It appears nobody has been generating malloc traces on a machine that doesn't have a superseding definition. There are a whole bunch of places where the code could be simplified by factoring out timespec subtraction and/or comparison logic, but I want to keep this patch as mechanical as possible. Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, powerpc64-linux-gnu, powerpc-linux-gnu, and aarch64-linux-gnu. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-10-24Add wait-for-debugger test harness hooksDJ Delorie
If WAIT_FOR_DEBUGGER is set to a non-zero value in the environment, any test that runs will print some useful gdb information and wait for gdb to attach to it and clear the "wait_for_debugger" variable. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2019-09-19Fix building support_ptrace.c on i686-gnu.Stefan Liebler
On i686-gnu the build is broken: In file included from support_ptrace.c:22: ../include/sys/prctl.h:2:15: fatal error: sys/prctl.h: No such file or directory #include_next <sys/prctl.h> This patch just removes the unused prctl.h inclusion. ChangeLog: * support/support_ptrace.c: Remove inclusion of sys/prctl.h.
2019-09-18Add UNSUPPORTED check in elf/tst-pldd.Stefan Liebler
The testcase forks a child process and runs pldd with PID of this child. On systems where /proc/sys/kernel/yama/ptrace_scope differs from zero, pldd will fail with /usr/bin/pldd: cannot attach to process 3: Operation not permitted This patch checks if ptrace_scope exists, is zero "classic ptrace permissions" or one "restricted ptrace". If ptrace_scope exists and has a higher restriction, then the test is marked as UNSUPPORTED. The case "restricted ptrace" is handled by rearranging the processes involved during the test. Now we have the following process tree: -parent: do_test (performs output checks) --subprocess 1: pldd_process (becomes pldd via execve) ---subprocess 2: target_process (ptraced via pldd) ChangeLog: * elf/tst-pldd.c (do_test): Add UNSUPPORTED check. Rearrange subprocesses. (pldd_process): New function. * support/Makefile (libsupport-routines): Add support_ptrace. * support/xptrace.h: New file. * support/support_ptrace.c: Likewise.
2019-09-07Prefer https to http for gnu.org and fsf.org URLsPaul Eggert
Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-08-14support: Include <support/descriptors.h> in support_descriptors.cFlorian Weimer
2019-07-10nss_db: fix endent wrt NULL mappings [BZ #24695] [BZ #24696]DJ Delorie
nss_db allows for getpwent et al to be called without a set*ent, but it only works once. After the last get*ent a set*ent is required to restart, because the end*ent did not properly reset the module. Resetting it to NULL allows for a proper restart. If the database doesn't exist, however, end*ent erroniously called munmap which set errno. The test case runs "makedb" inside the testroot, so needs selinux DSOs installed.
2019-06-28support: Add xdlvsym functionFlorian Weimer
2019-06-21support: Invent verbose_printf macroMike Crowe
Make it easier for tests to emit progress messages only when --verbose is specified. * support/test-driver.h: Add verbose_printf macro.
2019-06-21support: Add xclock_now helper function.Mike Crowe
It's easier to read and write tests with: const struct timespec ts = xclock_now(CLOCK_REALTIME); than struct timespec ts; xclock_gettime(CLOCK_REALTIME, &ts); * support/xtime.h: Add xclock_now() helper function.
2019-05-20support: Expose sbindir as support_sbindir_prefixFlorian Weimer
2019-05-20support: Add missing EOL terminators on timespecMike Crowe
The original implementations of test_timespec_before_impl and test_timespec_equal_or_after in 519839965197291924895a3988804e325035beee were missing the backslash required for a newline. Checked on x86_64-linux-gnu. * support/timespec.c: Add backslash to correct newline in failure message. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>