aboutsummaryrefslogtreecommitdiff
path: root/support
AgeCommit message (Collapse)Author
2018-12-06support: Implement <support/descriptors.h> to track file descriptorsFlorian Weimer
2018-12-04test-container: add "su" command to run test as root, add unshare hintsDJ Delorie
* support/test-container.c (check_for_unshare_hints): New. (main): Call it if unshare fails. Add support for "su" scriptlet command.
2018-12-01support: Close original descriptors in support_capture_subprocessFlorian Weimer
2018-11-28support: Add signal support to support_capture_subprocess_checkFlorian Weimer
Signal zero does not terminate a process, so it is safe to use negative values for signal numbers. Adjust libio/tst-vtables-common.c to use this new functionality, instead of determining the termination status for a signal indirectly.
2018-11-28support_quote_string: Do not use str parameter nameFlorian Weimer
This avoids a build failure if this identifier is used as a macro in a test.
2018-11-27support: Implement support_quote_stringFlorian Weimer
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
2018-11-19support: Print timestamps in timeout handlerFlorian Weimer
This is sometimes useful to determine if a test truly got stuck, or if it was making progress (logging information to standard output) and was merely slow to finish.
2018-11-07support: Fix printf format for TEST_COMPARE_STRINGAdhemerval Zanella
Fix the following on 32 bits targets: support_test_compare_string.c: In function ‘support_test_compare_string’: support_test_compare_string.c:80:37: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘size_t’ {aka ‘unsigned int’} [-Werror=format=] printf (" string length: %lu bytes\n", left_length); ~~^ ~~~~~~~~~~~ %u Checked on arm-linux-gnueabihf. * support/support_test_compare_string.c (support_test_compare_string): Fix printf format.
2018-11-07support: Implement TEST_COMPARE_STRINGFlorian Weimer
2018-11-02support/shell-container.c: Use support_copy_file_rangeFlorian Weimer
Reviewed-by: DJ Delorie <dj@redhat.com>
2018-11-02support/test-container.c: Include <libc-pointer-arith.h>Florian Weimer
Reviewed-by: DJ Delorie <dj@redhat.com>
2018-10-30support_blob_repeat: Call mkstemp directory for the backing fileFlorian Weimer
This avoids a warning during post-test cleanup.
2018-10-30stdlib/test-bz22786: Avoid spurious test failures using alias mappingsFlorian Weimer
On systems without enough random-access memory, stdlib/test-bz22786 will go deeply into swap and time out, even with a substantial TIMEOUTFACTOR. This commit adds a facility to construct repeating strings with alias mappings, so that the requirement for physical memory, and uses it in stdlib/test-bz22786.
2018-10-04Adjust name of ld.so in test-container.c.Stefan Liebler
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.
2018-08-31test-container: Use xcopy_file_range for cross-device copy [BZ #23597]H.J. Lu
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.
2018-08-28test-container: EPERM from unshare is UNSUPPORTEDFlorian Weimer
For example, the security policy on the Fedora build daemons results in this EPERM error.
2018-08-27links-dso-program: Fix build-programs=no build case.DJ Delorie
* support/Makefile (others): Don't list programs explicitly as a dependency of "others".
2018-08-24Fix IA64 links-dso-program link.DJ Delorie
* support/Makefile (LDLIBS-links-dso-program): Add -lgcc and $(libunwind).
2018-08-22Add test-in-container infrastructure.DJ Delorie
* 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.
2018-08-21Avoid running some tests if the file system does not support holesFlorian Weimer
Otherwise, these tests fills up the entire disk (or just run very slowly and eventually time out).
2018-06-26support: Add TEST_NO_SETVBUFFlorian Weimer
This is sometimes needed for testing stdio streams, where the setvbuf call in the test driver could interfere with the test.
2018-05-29support: Add wrappers for pthread_barrierattr_tFlorian Weimer
2018-05-23Switch IDNA implementation to libidn2 [BZ #19728] [BZ #19729] [BZ #22247]Florian Weimer
This provides an implementation of the IDNA2008 standard and fixes CVE-2016-6261, CVE-2016-6263, CVE-2017-14062.
2018-05-16support: Add TEST_COMPARE_BLOB, support_quote_blobFlorian Weimer
The declaration of support_test_compare_blob uses unsigned long int, to avoid including <stddef.h>. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2018-04-01support_format_addrinfo: Include unknown error number in resultFlorian Weimer
2018-03-13[BZ 1190] Make EOF sticky in stdio.Zack Weinberg
C99 specifies that the EOF condition on a file is "sticky": once EOF has been encountered, all subsequent reads should continue to return EOF until the file is closed or something clears the "end-of-file indicator" (e.g. fseek, clearerr). This is arguably a change from C89, where the wording was ambiguous; the BSDs always had sticky EOF, but the System V lineage would attempt to read from the underlying fd again. GNU libc has followed System V for as long as we've been using libio, but nowadays C99 conformance and BSD compatibility are more important than System V compatibility. You might wonder if changing the _underflow impls is sufficient to apply the C99 semantics to all of the many stdio functions that perform input. It should be enough to cover all paths to _IO_SYSREAD, and the only other functions that call _IO_SYSREAD are the _seekoff impls, which is OK because seeking clears EOF, and the _xsgetn impls, which, as far as I can tell, are unused within glibc. The test programs in this patch use a pseudoterminal to set up the necessary conditions. To facilitate this I added a new test-support function that sets up a pair of pty file descriptors for you; it's almost the same as BSD openpty, the only differences are that it allocates the optionally-returned tty pathname with malloc, and that it crashes if anything goes wrong. [BZ #1190] [BZ #19476] * libio/fileops.c (_IO_new_file_underflow): Return EOF immediately if the _IO_EOF_SEEN bit is already set; update commentary. * libio/oldfileops.c (_IO_old_file_underflow): Likewise. * libio/wfileops.c (_IO_wfile_underflow): Likewise. * support/support_openpty.c, support/tty.h: New files. * support/Makefile (libsupport-routines): Add support_openpty. * libio/tst-fgetc-after-eof.c, wcsmbs/test-fgetwc-after-eof.c: New test cases. * libio/Makefile (tests): Add tst-fgetc-after-eof. * wcsmbs/Makefile (tests): Add tst-fgetwc-after-eof.
2018-01-12support: Preserve errno in write_message, TEST_VERIFY and other checksFlorian Weimer
These facilities could clobber errno, which makes it difficult to write certain checks because a specific order has to be used.
2018-01-08resolv: Support binary labels in test frameworkFlorian Weimer
The old implementation based on hsearch_r used an ad-hoc C string encoding and produced an incorrect format on the wire for domain names which contained bytes which needed escaping when printed. This commit switches to ns_name_pton for the wire format conversion (now that we have separate tests for it) and uses a tsearch tree with a suitable comparison function to locate compression targets.
2018-01-08support: Increase usability of TEST_COMPAREFlorian Weimer
The previous implementation of the TEST_COMPARE macro would fail to compile code like this: int ret = res_send (query, sizeof (query), buf, sizeof (buf)); TEST_COMPARE (ret, sizeof (query) + 2 /* Compression reference. */ + 2 + 2 + 4 + 2 /* Type, class, TTL, RDATA length. */ + 1 /* Pascal-style string length. */ + strlen (expected_name)); This resulted in a failed static assertion, "integer conversions may alter sign of operands". A user of the TEST_COMPARE would have to add a cast to fix this. This patch reverts to the original proposed solution of a run-time check, making TEST_COMPARE usable for comparisons of numbers with types with different signedness in more contexts.
2018-01-08support: Define support_static_assert for use with C and C++Florian Weimer
And update TEST_COMPARE to use it, to make it usable from C++.
2018-01-04support_enter_mount_namespace: Fix indentationSamuel Thibault
* support/support_enter_mount_namespace.c: Fix indentation.
2018-01-04hurd: Fix support/support_enter_mount_namespace.c buildSamuel Thibault
* support/support_enter_mount_namespace.c [!CLONE_NEWNS]: Do not include <sys/mount.h>.
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-12-22copy_file_range: New function to copy file dataFlorian Weimer
The semantics are based on the Linux system call, but a very close emulation in user space is provided.
2017-12-14support: Simplify compiling most of support/ outside of glibcFlorian Weimer
Some include files were missing because they are implied by the in-tree build process. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-05Linux: Implement interfaces for memory protection keysFlorian Weimer
This adds system call wrappers for pkey_alloc, pkey_free, pkey_mprotect, and x86-64 implementations of pkey_get and pkey_set, which abstract over the PKRU CPU register and hide the actual number of memory protection keys supported by the CPU. pkey_mprotect with a -1 key is implemented using mprotect, so it will work even if the kernel does not support the pkey_mprotect system call. The system call wrapers use unsigned int instead of unsigned long for parameters, so that no special treatment for x32 is needed. The flags argument is currently unused, and the access rights bit mask is limited to two bits by the current PKRU register layout anyway. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2017-12-05support/tst-test_compare: Fix 32-bit/64-bit expected output mismatchFlorian Weimer
The use of a long type resulted in test output differences between 32-bit and 64-bit architectures, causing the test to fail on 32-bit architectures.
2017-12-04support: Add TEST_COMPARE macroFlorian Weimer
2017-11-18support_become_root: Fix comment styleChristian Brauner
2017-11-18support_become_root: Don't fail when /proc/<pid/setgroups is missingChristian Brauner
The requirement to write "deny" to /proc/<pid>/setgroups for a given user namespace before being able to write a gid mapping was introduced in Linux 3.19. Before that this requirement including the file did not exist. So don't fail when errno == ENOENT.
2017-11-18support_enter_mount_namespace: Unshare with mount --make-rprivateFlorian Weimer
System defaults vary, and a mere unshare (CLONE_NEWNS) (which is part of support_become_root) is no longer sufficient. Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-18support_create_temp_directory: Align behavior with create_temp_fileFlorian Weimer
create_temp_file automatically supplies the test directory and the XXXXXX suffix. support_create_temp_directory required the caller to specify them, which was confusing. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
2017-11-17support_become_root: Enable file creation in user namespacesFlorian Weimer
Without UID/GID maps, file creation will file with EOVERFLOW. This patch is based on DJ Delorie's work on container testing. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
2017-11-13support: Add <support/next_to_fault.h>Florian Weimer
Based on the implementation in resolv/tst-inet_pton.c.
2017-11-12support: Add xstrndup, xunlink, xreadlink, support_create_temp_directoryFlorian Weimer
2017-10-05support_format_hostent: Add more error information for NETDB_INTERNALFlorian Weimer
2017-09-25Revert "resolv_test.c: also cope with CONNREFUSED errors returned by recvfrom"Samuel Thibault
This reverts commit 6174537c24cfe324d6e8f5a2a421883df12b8b6a.
2017-09-25resolv_test.c: also cope with CONNREFUSED errors returned by recvfromSamuel Thibault
server_thread_udp_process_one already takes care of calling sendto() instead of xsendto to be able to ignore the case where the client has closed the socket. Depending on the TCP/IP stack behavior, this error could be notified later through recvfrom(), so we need to ignore it there too. * support/resolv_test.c (server_thread_udp_process_one): Call recvfrom instead of xrecvfrom, and ignore ECONNREFUSED errors.
2017-09-20Implement xdlopen, xdlsym and xdlclose routines which terminate testPaul Pluzhnikov
program with appropriate message if the corresponding dlfcn.h routine returns an error. Use them in stdlib/tst-tls-atexit.c
2017-09-01support_chroot_create: Add support for /etc/hosts, /etc/host.confFlorian Weimer