about summary refs log tree commit diff
path: root/support/test-container.c
Commit message (Collapse)AuthorAgeFilesLines
* 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: Set errno before testing it.Carlos O'Donell2020-04-301-0/+2
| | | | | | | | | | | | 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>
* 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>
* 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>
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-011-1/+1
|
* Add wait-for-debugger test harness hooksDJ Delorie2019-10-241-0/+22
| | | | | | | | 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>
* 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
* Avoid fall-through in test-container if execlp fails.Joseph Myers2019-02-131-0/+1
| | | | | | | | | | | | | One of the implicit-fallthrough warnings from compiling glibc with -Wextra appears to indicate an actual bug: the test-container code could fall through inappropriately if execlp returns (which only occurs on error). This patch adds appropriate error handling in this case to avoid that fall-through. Tested for x86_64. * support/test-container.c (recursive_remove): Use FAIL_EXIT1 if execlp returns.
* 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.
* test-container: move postclean outside of namespace changesDJ Delorie2018-12-101-8/+37
| | | | | | | | | | | | | | | | | | | | During postclean.req testing it was found that the fork in the parent process (after the unshare syscall) would fail with ENOMEM (see recursive_remove() in test-container.c). While failing with ENOMEM is certainly unexpected, it is simply easier to refactor the design and have the parent remain outside of the namespace. This change moves the postclean.req processing to a distinct process (the parent) that then forks the test process (which will have to fork once more to complete uid/gid transitions). When the test process exists the cleanup process will ensure all files are deleted when a post clean is requested. Signed-off-by: DJ Delorie <dj@redhat.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com> [BZ #23948] * support/test-container.c: Move postclean step to before we change namespaces.
* test-container: add "su" command to run test as root, add unshare hintsDJ Delorie2018-12-041-4/+64
| | | | | | * support/test-container.c (check_for_unshare_hints): New. (main): Call it if unshare fails. Add support for "su" scriptlet command.
* support/test-container.c: Include <libc-pointer-arith.h>Florian Weimer2018-11-021-0/+1
| | | | Reviewed-by: DJ Delorie <dj@redhat.com>
* Adjust name of ld.so in test-container.c.Stefan Liebler2018-10-041-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+1
| | | | | | | | | | | | | | | | | | | | 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.
* test-container: EPERM from unshare is UNSUPPORTEDFlorian Weimer2018-08-281-2/+3
| | | | | For example, the security policy on the Fedora build daemons results in this EPERM error.
* Add test-in-container infrastructure.DJ Delorie2018-08-221-0/+988
* 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.