about summary refs log tree commit diff
path: root/support
Commit message (Collapse)AuthorAgeFilesLines
...
* support: Do not build xpthread_attr_setaffinity_np for hurdAdhemerval Zanella2021-05-282-0/+4
| | | | It does not provide pthread_attr_setaffinity_np extension.
* support: Add xpthread_attr_setaffinity_np wrapperAdhemerval Zanella2021-05-273-0/+32
|
* support: Free gdb_script_nameSiddhesh Poyarekar2021-05-131-0/+1
| | | | Identified by static analysis.
* support: Close fds in copy_funcSiddhesh Poyarekar2021-05-131-8/+13
| | | | | copy_func may leave file descriptors open on error, so close them on function exit.
* libsupport: Add support_select_normalizes_timeoutAdhemerval Zanella2021-04-123-0/+34
| | | | It will be used on a select() test.
* libsupport: Add support_select_modifies_timeoutAdhemerval Zanella2021-04-123-0/+34
| | | | It will be used on a select() test.
* support: Add capability to fork an sgid childSiddhesh Poyarekar2021-04-124-0/+150
| | | | | | | | | | | | | | | | | | | | Add a new function support_capture_subprogram_self_sgid that spawns an sgid child of the running program with its own image and returns the exit code of the child process. This functionality is used by at least three tests in the testsuite at the moment, so it makes sense to consolidate. There is also a new function support_subprogram_wait which should provide simple system() like functionality that does not set up file actions. This is useful in cases where only the return code of the spawned subprocess is interesting. This patch also ports tst-secure-getenv to this new function. A subsequent patch will port other tests. This also brings an important change to tst-secure-getenv behaviour. Now instead of succeeding, the test fails as UNSUPPORTED if it is unable to spawn a setgid child, which is how it should have been in the first place. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* support: Fix hurd build after bfddda2570331dAdhemerval Zanella2021-04-011-1/+1
|
* io: Check at runtime if timestamp supports nanosecondsAdhemerval Zanella2021-03-312-8/+34
| | | | | | | | Now that non-LFS stat function is implemented on to on LFS, it will use statx when available. It allows to check for nanosecond timestamp if the kernel supports __NR_statx. Checked on s390-linux-gnu with 4.12.14 kernel.
* support: Add support_path_support_time64_valueAdhemerval Zanella2021-03-292-9/+12
| | | | It allows to check for support on arbitrary timestamp values.
* S390: Don't test nanoseconds in io/tst-stat.cStefan Liebler2021-03-263-0/+35
| | | | | | | | | | | Both new tests io/tst-stat and io/tst-stat-lfs (_FILE_OFFSET_BITS=64) are comparing the nanosecond fields with the statx result. Unfortunately on s390(31bit) those fields are always zero if old KABI with non-LFS support is used. With _FILE_OFFSET_BITS=64 stat is using statx internally. As suggested by Adhemerval this patch disables the nanosecond check for s390(31bit). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* support: Use syscall function instead of INLINE_SYSCALL_CALLAdhemerval Zanella2021-03-181-1/+1
| | | | | It fixes the build on ARM in thumb mode that requires an out of the line helper (__libc_do_syscall) to issue the syscall.
* support: Pass environ to child processSiddhesh Poyarekar2021-03-161-1/+1
| | | | | Pass environ to posix_spawn so that the child process can inherit environment of the test.
* support: Typo and formatting fixesSiddhesh Poyarekar2021-03-152-4/+4
| | | | | - Add a newline to the end of error messages in transfer(). - Fixed the name of support_subprocess_init().
* support: Add xpthread_killAdhemerval Zanella2021-03-123-0/+29
| | | | Checked on x86_64-linux-gnu.
* io: Return UNSUPPORTED if filesystem do not support 64 bit timestampsAdhemerval Zanella2021-03-123-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some Linux filesystems might not fully support 64 bit timestamps [1], which make some Linux specific tests to fail when they check for the functionality. This patch adds a new libsupport function, support_path_support_time64, that returns whether the target file supports or not 64 bit timestamps. The support is checked by issuing a utimensat and verifying both the last access and last modification time against a statx call. The tests that might fail are also adjusted to check the file support as well: $ dd if=/dev/zero of=loopbackfile.img bs=100M count=1 1+0 records in 1+0 records out 104857600 bytes (105 MB, 100 MiB) copied, 0,0589568 s, 1,8 GB/s $ sudo losetup -fP loopbackfile.img $ mkfs.xfs loopbackfile.img meta-data=loopbackfile.img isize=512 agcount=4, agsize=6400 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 data = bsize=4096 blocks=25600, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=1368, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 $ mkdir loopfs $ sudo mount -o loop /dev/loop0 loopfs/ $ sudo chown -R azanella:azanella loopfs $ TMPDIR=loopfs/ ./testrun.sh misc/tst-utimes error: ../sysdeps/unix/sysv/linux/tst-utimes.c:55: File loopfs//utimesfECsK1 does not support 64-bit timestamps [1] https://bugzilla.redhat.com/show_bug.cgi?id=1795576
* test-container: Always copy test-specific support files [BZ #27537]DJ Delorie2021-03-111-11/+12
| | | | | | | | | | | There's a small chance that a fresh checkout will result in some of the test-specific container files will have the same timestamp and size, which breaks the rsync logic in test-container, resulting in tests running with the wrong support files. This patch changes the rsync logic to always copy the test-specific files, which normally would always be copied anyway. The rsync logic for the testroot itself is unchanged.
* support: Provide xclock_settime test helper functionLukasz Majewski2021-03-083-0/+40
| | | | | | | | | | | | The xclock_settime is a wrapper function on the clock_settime syscall to be used in the test code. It checks if the GLIBC_TEST_ALLOW_TIME_SETTING env variable is defined in the environment in which test is executed. If it is not - the test ends as unsupported. Otherwise, the clock-settime is executed and return value is assessed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* elf: Fix tests that rely on ld.so.cache for cross-compilingAdhemerval Zanella2021-01-291-0/+26
| | | | | | | | | | | | | | | | 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.
* posix: Fix return value of system if shell can not be executed [BZ #27053]Adhemerval Zanella2021-01-111-0/+1
| | | | | | | | 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.
* support: Add xchmod wrapperAdhemerval Zanella2021-01-112-0/+31
| | | | Checked on x86_64-linux-gnu.
* Add xfchmod to libsupportAlexandra Hájková2021-01-103-0/+30
|
* Add xchdir to libsupport.Alexandra Hájková2021-01-093-0/+30
|
* support: Add support_small_thread_stack_sizeAdhemerval Zanella2021-01-052-3/+11
| | | | | It returns the minimum stack size large enough to cover most internal glibc stack usage.
* Update copyright dates with scripts/update-copyrightsPaul Eggert2021-01-02205-205/+205
| | | | | | | | | | | | | | | | 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
* support: Make support_process_state_wait wait lessSamuel Thibault2020-12-281-1/+1
| | | | | | | 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.
* support: Add support_slibdir_prefix variableFlorian Weimer2020-12-113-0/+10
| | | | Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* support: Add support_copy_fileFlorian Weimer2020-11-263-0/+49
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* support: Add create_temp_file_in_dirAdhemerval Zanella2020-10-162-4/+15
| | | | It allows created a temporary file in a specified directory.
* support: Provide a way to clear the RA bit in DNS server responsesFlorian Weimer2020-10-142-1/+7
|
* support: Provide a way to reorder responses within the DNS test serverFlorian Weimer2020-10-145-28/+135
|
* Correct timespec implementation [BZ #26232]H.J. Lu2020-07-144-54/+71
| | | | | | | | | | | | | | | | | | | | | | | | 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).
* Fix time/tst-cpuclock1 intermitent failuresLucas A. M. Magalhaes2020-07-104-0/+393
| | | | | | | | | | | | | | 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>
* string: Add strerror, strerror_r, and strerror_l testAdhemerval Zanella2020-07-074-0/+67
| | | | | | | | 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>
* support: Fix detecting hole support on >2KB-block filesystemsSamuel Thibault2020-06-041-2/+4
| | | | | | | | | | | | | 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.
* build: Use FAIL_EXIT1 () on failure to exec child [BZ #23990]Girish Joshi2020-05-291-1/+1
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* support: Add support_blob_repeat_allocate_sharedFlorian Weimer2020-05-123-20/+68
| | | | Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* support: Set errno before testing it.Carlos O'Donell2020-04-302-1/+5
| | | | | | | | | | | | 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>
* test-container: Support $(complocaledir) and mkdirp.Carlos O'Donell2020-04-301-3/+39
| | | | | | | | | | | | | | | | | | | | | | | 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>
* support: Implement <support/xthread.h> key create/deleteMathieu Desnoyers2020-04-274-0/+56
| | | | | Expose xpthread_key_create and xpthread_key_delete wrappers for tests.
* localedef: Add verbose messages for failure paths.Carlos O'Donell2020-04-263-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* support: Change xgetline to return 0 on EOFFlorian Weimer2020-04-033-10/+19
| | | | | | | | | | | | | | | 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>
* support/shell-container.c: Add builtin killAdhemerval Zanella2020-03-251-0/+25
| | | | | | No options supported. Reviewed-by: DJ Delorie <dj@redhat.com>
* support/shell-container.c: Add builtin exitAdhemerval Zanella2020-03-251-0/+13
| | | | Reviewed-by: DJ Delorie <dj@redhat.com>
* support/shell-container.c: Return 127 if execve failsAdhemerval Zanella2020-03-251-1/+1
| | | | Reviewed-by: DJ Delorie <dj@redhat.com>
* test-container: print errno when execvp failsMichael Hudson-Doyle2020-03-111-1/+1
| | | | | | | 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>
* Fixed typo in run_command_array() in support/shell-container.cGirish Joshi2020-03-021-1/+1
| | | | https://sourceware.org/bugzilla/show_bug.cgi?id=23991
* support: Add support_process_state_waitAdhemerval Zanella2020-02-276-0/+278
| | | | | | | | | | | | | | 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.
* support: Add the xlstat functionFlorian Weimer2020-02-093-0/+30
|
* test-container: add exec, cwdDJ Delorie2020-02-031-13/+65
| | | | | | | | | | | | | | | | | | | | 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>