about summary refs log tree commit diff
path: root/support/support.h
Commit message (Collapse)AuthorAgeFilesLines
* support: Add support_create_timerAdhemerval Zanella2021-06-221-0/+11
| | | | | | | | It is a simple wrapper over timer_create, timer_settime, and sigaction. It will be used to check for large timeout to trigger an EINTR and to avoid use a large timeout (as for alarm()). Reviewed-by: Lukasz Majewski <lukma@denx.de>
* io: Fix sporadic test failures in io/tst-statFlorian Weimer2021-06-101-1/+2
| | | | | | | | support_stat_nanoseconds cannot restore the ctime time, and this may lead to sporadic test failures. Therefore, probe for nanoseconds support before the initial statx call. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* libsupport: Add support_select_normalizes_timeoutAdhemerval Zanella2021-04-121-0/+4
| | | | It will be used on a select() test.
* libsupport: Add support_select_modifies_timeoutAdhemerval Zanella2021-04-121-0/+4
| | | | It will be used on a select() test.
* io: Check at runtime if timestamp supports nanosecondsAdhemerval Zanella2021-03-311-1/+1
| | | | | | | | 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-291-2/+9
| | | | It allows to check for support on arbitrary timestamp values.
* S390: Don't test nanoseconds in io/tst-stat.cStefan Liebler2021-03-261-0/+3
| | | | | | | | | | | 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>
* io: Return UNSUPPORTED if filesystem do not support 64 bit timestampsAdhemerval Zanella2021-03-121-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Update copyright dates with scripts/update-copyrightsPaul Eggert2021-01-021-1/+1
| | | | | | | | | | | | | | | | 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: Add support_slibdir_prefix variableFlorian Weimer2020-12-111-0/+2
| | | | Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* support: Add support_copy_fileFlorian Weimer2020-11-261-0/+5
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* string: Add strerror, strerror_r, and strerror_l testAdhemerval Zanella2020-07-071-0/+4
| | | | | | | | 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>
* localedef: Add verbose messages for failure paths.Carlos O'Donell2020-04-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-011-1/+1
|
* support: Add xsetlocale functionArjun Shankar2019-11-111-0/+1
|
* Prefer https to http for gnu.org and fsf.org URLsPaul Eggert2019-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* support: Expose sbindir as support_sbindir_prefixFlorian Weimer2019-05-201-0/+2
|
* support: Add support_install_rootsbindirAlexandra Hájková2019-05-151-0/+2
| | | | Reviewed by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* support: Export bindir path on support_pathAdhemerval Zanella2019-05-141-0/+2
| | | | | | | | | | Checked on x86_64-linux-gnu. * support/Makefile (CFLAGS-support_paths.c): Add -DBINDIR_PATH. * support/support.h (support_bindir_prefix): New variable. * support/support_paths.c [BINDIR_PATH] (support_bindir_prefix): Reviewed-by: DJ Delorie <dj@redhat.com>
* Fix alignment of TLS variables for tls variant TLS_TCB_AT_TP [BZ #23403]Stefan Liebler2019-02-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The alignment of TLS variables is wrong if accessed from within a thread for architectures with tls variant TLS_TCB_AT_TP. For the main thread the static tls data is properly aligned. For other threads the alignment depends on the alignment of the thread pointer as the static tls data is located relative to this pointer. This patch adds this alignment for TLS_TCB_AT_TP variants in the same way as it is already done for TLS_DTV_AT_TP. The thread pointer is also already properly aligned if the user provides its own stack for the new thread. This patch extends the testcase nptl/tst-tls1.c in order to check the alignment of the tls variables and it adds a pthread_create invocation with a user provided stack. The test itself is migrated from test-skeleton.c to test-driver.c and the missing support functions xpthread_attr_setstack and xposix_memalign are added. ChangeLog: [BZ #23403] * nptl/allocatestack.c (allocate_stack): Align pointer pd for TLS_TCB_AT_TP tls variant. * nptl/tst-tls1.c: Migrate to support/test-driver.c. Add alignment checks. * support/Makefile (libsupport-routines): Add xposix_memalign and xpthread_setstack. * support/support.h: Add xposix_memalign. * support/xthread.h: Add xpthread_attr_setstack. * support/xposix_memalign.c: New File. * support/xpthread_attr_setstack.c: Likewise.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2019-01-011-1/+1
| | | | | | | * 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.
* support_quote_string: Do not use str parameter nameFlorian Weimer2018-11-281-2/+2
| | | | | This avoids a build failure if this identifier is used as a macro in a test.
* support: Implement support_quote_stringFlorian Weimer2018-11-271-0/+5
| | | | Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
* Adjust name of ld.so in test-container.c.Stefan Liebler2018-10-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | The test-container.c file assumes that ld.so is always named something like /elf/ld-linux-*. But e.g. on s390x it is named ld64.so.1 or ld.so.1 on s390. There are other architectures like power or mips with similar names. This patch introduces the new global variable support_objdir_elf_ldso which contains the absolute path to the runtime linker used by the testsuite, e.g. OBJDIR_PATH/elf/ld-linux-x86-64.so.2. The check in test-container.c is now comparing against this path. Without this patch, test-container.c is searching invalid files / directories and fails to find glibc/nss/tst-nss-test3.root/tst-nss-test3.script. Then the test tst-nss-test3 fails! Reviewed-by: Carlos O'Donell <carlos@redhat.com> ChangeLog: * support/support.h (support_objdir_elf_ldso): New variable. * support/support_paths.c (support_objdir_elf_ldso): Likewise. * support/Makefile (CFLAGS-support_paths.c): Add definition for OBJDIR_ELF_LDSO_PATH. * support/test-container.c (main): Search for the ld.so which is also used by the testsuite.
* test-container: Use xcopy_file_range for cross-device copy [BZ #23597]H.J. Lu2018-08-311-0/+5
| | | | | | | | | | | | | | | | | | | | copy_file_range can't be used to copy a file from glibc source directory to glibc build directory since they may be on different filesystems. This patch adds xcopy_file_range for cross-device copy. Reviewed-by: Carlos O'Donell <carlos@redhat.com> [BZ #23597] * support/Makefile (libsupport-routines): Add support_copy_file_range and xcopy_file_range. * support/support.h: Include <sys/types.h>. (support_copy_file_range): New prototype. * support/support_copy_file_range.c: New file. Copied and modified from io/copy_file_range-compat.c. * support/test-container.c (copy_one_file): Call xcopy_file_rang instead of copy_file_range. * support/xcopy_file_range.c: New file. * support/xunistd.h (xcopy_file_range): New prototype.
* Add test-in-container infrastructure.DJ Delorie2018-08-221-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | * Makefile (testroot.pristine): New rules to initialize the test-in-container "testroot". * Makerules (all-testsuite): Add tests-container. * Rules (tests-expected): Add tests-container. (binaries-all-tests): Likewise. (tests-container): New, run these tests in the testroot container. * support/Makefile (others): Add *-container, support_paths.c, xmkdirp, and links-dso-program. * support/links-dso-program-c.c: New. * support/links-dso-program.cc: New. * support/test-container.c: New. * support/shell-container.c: New. * support/echo-container.c: New. * support/true-container.c: New. * support/xmkdirp.c: New. * support/xsymlink.c: New. * support/support_paths.c: New. * support/support.h: Add support paths prototypes. * support/xunistd.h: Add xmkdirp () and xsymlink (). * nss/tst-nss-test3.c: Convert to test-in-container. * nss/tst-nss-test3.root/: New.
* Avoid running some tests if the file system does not support holesFlorian Weimer2018-08-211-0/+6
| | | | | Otherwise, these tests fills up the entire disk (or just run very slowly and eventually time out).
* support: Add TEST_COMPARE_BLOB, support_quote_blobFlorian Weimer2018-05-161-0/+6
| | | | | | | The declaration of support_test_compare_blob uses unsigned long int, to avoid including <stddef.h>. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Update copyright dates with scripts/update-copyrights.Joseph Myers2018-01-011-1/+1
| | | | | | | * 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.
* support: Add xstrndup, xunlink, xreadlink, support_create_temp_directoryFlorian Weimer2017-11-121-0/+1
|
* resolv: Tests for various versions of res_initFlorian Weimer2017-06-021-0/+15
|
* Update copyright dates with scripts/update-copyrights.Joseph Myers2017-01-011-1/+1
|
* resolv: Add beginnings of a libresolv test suiteFlorian Weimer2016-12-311-0/+1
|
* support: Introduce new subdirectory for test infrastructureFlorian Weimer2016-12-091-0/+58
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.