summaryrefslogtreecommitdiff
path: root/tests/guix-pack-relocatable.sh
AgeCommit message (Collapse)Author
2023-04-21tests: Fix checks for expected failures.Eric Bavier
Addresses <https://issues.guix.gnu.org/62406>. With 'set -e', a return status inverted with '!' does not cause the shell to exit immediately. Instead use '&& false' to indicate an expected failure. * tests/guix-archive.sh, tests/guix-build-branch.sh, tests/guix-build.sh, tests/guix-daemon.sh, tests/guix-download.sh, tests/guix-environment-container.sh, tests/guix-environment.sh, tests/guix-gc.sh, tests/guix-git-authenticate.sh, tests/guix-graph.sh, tests/guix-hash.sh, tests/guix-home.sh, tests/guix-pack-relocatable.sh, tests/guix-pack.sh, tests/guix-package-aliases.sh, tests/guix-package-net.sh, tests/guix-package.sh, tests/guix-refresh.sh, tests/guix-shell.sh, tests/guix-style.sh, tests/guix-system.sh: Replace uses of '! ...' with '... && false' or `test ! ...` as appropriate. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-02-27pack: Adjust shell tests to read-only tarball root.Ludovic Courtès
Fixes <https://issues.guix.gnu.org/61853>. Fixes a regression introduced in 68380db4c40a2ee1156349a87254fd7b1f1a52d5, whereby the tarball's root entry is now read-only, due to the creation of "profile-directory" in the store. * tests/guix-pack.sh: Remove and recreate $test_directory before transformation option test. * tests/guix-pack-relocatable.sh: Add "chmod +w $test_directory" lines before attempts to write to it.
2020-12-04tests: pack-relocatable: Ensure commands can run in the current namespace.Paul Garlick
* tests/guix-pack-relocatable (run_without_store): Use subshell to run commands in the current namespace. This avoids shell syntax and parsing errors.
2020-10-31pack: Relocatable wrapper leaves root available to child processes.Ludovic Courtès
Fixes <https://bugs.gnu.org/44261>. Reported by Jan Nieuwenhuizen <janneke@gnu.org>. * gnu/packages/aux-files/run-in-namespace.c (exec_in_user_namespace): Add call to 'prctl'. Call 'mount' for NEW_ROOT and define 'is_tmpfs'. When IS_TMPFS is true, call 'umount' and 'rmdir' after 'waitpid'; otherwise, call 'rm_rf' only when 'waitpid' returns -1 the second time. (exec_with_loader): Call 'prctl'. Remove NEW_ROOT only when 'waitpid' returns -1 the second time, otherwise leave it behind. * tests/guix-pack-relocatable.sh (wait_for_file): New function. Add test.
2020-10-30guix: pack: Only wrap executable files.Eric Bavier
* guix/scripts/pack.scm (wrapped-package)<build>: Build wrappers for executable files and symlink others. * tests/guix-pack-relocatable.sh: Test relocatable example of mixed executable and non-executable files.
2020-09-28tests: Simplify shell exit status negation;Eric Bavier
* tests/guix-archive.sh, tests/guix-build-branch.sh, tests/guix-build.sh, tests/guix-daemon.sh, tests/guix-download.sh, tests/guix-environment.sh, tests/guix-gc.sh, tests/guix-git-authenticate.sh, tests/guix-graph.sh, tests/guix-hash.sh, tests/guix-lint.sh, tests/guix-pack-relocatable.sh, tests/guix-pack.sh, tests/guix-package-aliases.sh, tests/guix-package-net.sh, tests/guix-package.sh: Use the shell '!' keyword to negate command exit status in place of 'if ...; then false; else true; fi'
2020-07-28pack: "fakechroot" engine always creates its store.Ludovic Courtès
Previously it would silently fail to create the /gnu/store symlink when the host has a read-only /gnu as is the case in these tests. * gnu/packages/aux-files/run-in-namespace.c (exec_with_loader): Unlink the ancestor of ORIGINAL_STORE under NEW_ROOT. Check the return value of 'symlink' when creating NEW_STORE. * tests/guix-pack-relocatable.sh: Check the contents of the store as seen by the wrapped executable, with all three engines, and with both "/gnu" and "/gnu/store" erased.
2020-07-28pack: "fakechroot" execution engine can load its audit module.Ludovic Courtès
Fixes <https://bugs.gnu.org/42558>. Until now, loading 'pack-audit.so' in a truly non-Guix environment would usually fail because 'pack-audit.so' depends on 'libgcc_s.so' and 'libc.so', none of which could be found. Furthermore, the test was not working as expected: the trick unshare -mrf sh -c 'mount -t tmpfs none /gnu ; ...' would allow the fakechroot engine to make its store available as /gnu/store as a result of another bug. * gnu/packages/aux-files/run-in-namespace.c (relocated_search_path): New function. (exec_with_loader): Pass "--library-path" to the loader. * guix/scripts/pack.scm (wrapped-package)[build](runpath): New procedure. (elf-loader-compile-flags): Pass "-DLOADER_AUDIT_RUNPATH". * tests/guix-pack-relocatable.sh: Remove 'STORE_PARENT'. (run_without_store): New function. Erase $NIX_STORE_DIR instead of $STORE_PARENT. Use 'run_without_store' throughout.
2020-07-24pack: '-R' applies to propagated inputs too.Ludovic Courtès
Fixes <https://bugs.gnu.org/42510>. * guix/scripts/pack.scm (wrapped-manifest-entry): Recurse on 'dependencies' field. * tests/guix-pack-relocatable.sh: Add test.
2020-05-14pack: Add relocation via ld.so and fakechroot.Ludovic Courtès
* gnu/packages/aux-files/run-in-namespace.c (HAVE_EXEC_WITH_LOADER): New macro. (bind_mount): Rename to... (mirror_directory): ... this. Add 'firmlink' argument and use it instead of calling mkdir/open/close/mount directly. (bind_mount, make_symlink): New functions. (exec_in_user_namespace): Adjust accordingly. (exec_with_loader) [HAVE_EXEC_WITH_LOADER]: New function. (exec_performance): New function. (engines): Add them. * guix/scripts/pack.scm (wrapped-package)[fakechroot-library] [audit-module]: New procedures. [audit-source]: New variable. [build](elf-interpreter, elf-loader-compile-flags): New procedures. (build-wrapper): Use them. * tests/guix-pack-relocatable.sh: Test with 'GUIX_EXECUTION_ENGINE=fakechroot'. * doc/guix.texi (Invoking guix pack): Document the 'performance' and 'fakechroot' engines. * gnu/packages/aux-files/pack-audit.c: New file. * Makefile.am (AUX_FILES): Add it.
2020-05-14pack: Wrapper honors 'GUIX_EXECUTION_ENGINE' environment variable.Ludovic Courtès
* gnu/packages/aux-files/run-in-namespace.c (struct engine): New type. (exec_default): New function. (engines): New variable. (execution_engine): New function. (main): Use it instead of calling 'exec_in_user_namespace' and 'exec_with_proot' directly. * tests/guix-pack-relocatable.sh: Add test with 'GUIX_EXECUTION_ENGINE'. * doc/guix.texi (Invoking guix pack): Document 'GUIX_EXECUTION_ENGINE'.
2020-04-24pack: 'guix pack -R' wrapper correctly reports exit code.Ludovic Courtès
Fixes <https://bugs.gnu.org/40816>. Reported by Jan (janneke) Nieuwenhuizen <janneke@gnu.org>. * gnu/packages/aux-files/run-in-namespace.c (main): In the 'default' case, check 'WIFEXITED (status)' and exit with the corresponding code in that case. Exit with 255 in other cases. * tests/guix-pack-relocatable.sh: Add test.
2019-08-23pack: '-R' honors the requested output.Ludovic Courtès
Fixes <https://bugs.gnu.org/36925>. Reported by Jesse Gibbons <jgibbons2357@gmail.com>. * guix/scripts/pack.scm (wrapped-package): Add 'output*' parameter. [build]: Define 'input' and 'target'; use them instead of #$package and #$output, respectively. (wrapped-manifest-entry): New procedure. (map-manifest-entries): Call PROC directly. (guix-pack): Pass WRAPPED-MANIFEST-ENTRY to 'map-manifest-entries'.
2019-05-18pack: '--localstatedir' and '-R' tests gracefully handle missing /gnu/store.Ludovic Courtès
Fixes <https://bugs.gnu.org/35776>. Reported by Ting-Wei Lan <lantw44@gmail.com>. * tests/guix-pack-localstatedir.sh: Set 'storedir' before 'NIX_STORE_DIR'. * tests/guix-pack-relocatable.sh: Likewise.
2019-05-09tests: Ensure 'unshare' works before relying on it.Ludovic Courtès
Fixes <https://bugs.gnu.org/35642>. Reported by Josh Holland <josh@inv.alid.pw>. * tests/guix-pack-relocatable.sh: Before invoking 'unshare' at the bottom, add "if unshare -r true" condition. * tests/guix-pack.sh: Likewise.
2019-03-15pack: "-RR" produces PRoot-enabled relocatable binaries.Ludovic Courtès
* gnu/packages/aux-files/run-in-namespace.c (exec_with_proot): New function. (main): When 'clone' fails, call 'rm_rf'. [PROOT_PROGRAM]: When 'clone' fails, call 'exec_with_proot'. * guix/scripts/pack.scm (wrapped-package): Add #:proot?. [proot]: New procedure. [build]: Compile with -DPROOT_PROGRAM when PROOT? is true. * guix/scripts/pack.scm (%options): Set the 'relocatable?' value to 'proot when "-R" is passed several times. (guix-pack): Pass #:proot? to 'wrapped-package'. * tests/guix-pack-relocatable.sh: Use "-RR" on Intel systems that lack user namespace support. * doc/guix.texi (Invoking guix pack): Document -RR.
2018-11-06pack: Add test for '--relocatable'.Ludovic Courtès
* tests/guix-pack-relocatable.sh: New file. * Makefile.am (SH_TESTS): Add it.