nixos/tests/systemd-binfmt: Add ldPreload test for LD_PRELOAD error messages
commitc8d137961d29b7ad1e9470718802209b0e636776
authorRobert Scott <code@humanleg.org.uk>
dateThu 30 Dec 2021, 14:52 (5 years ago)
parent9e5d0a9
nixos/tests/systemd-binfmt.nix+19
@@ -68,4 +68,23 @@ in {
6868 machine.succeed("exec -a meow ${testAarch64} meow")
6969 '';
7070 };
71+
72+ ldPreload = makeTest {
73+ name = "systemd-binfmt-ld-preload";
74+ machine = {
75+ boot.binfmt.emulatedSystems = [
76+ "aarch64-linux"
77+ ];
78+ };
79+ testScript = let
80+ helloAarch64 = pkgs.pkgsCross.aarch64-multiplatform.hello;
81+ libredirectAarch64 = pkgs.pkgsCross.aarch64-multiplatform.libredirect;
82+ in ''
83+ machine.start()
84+
85+ assert "error" not in machine.succeed(
86+ "LD_PRELOAD='${libredirectAarch64}/lib/libredirect.so' ${helloAarch64}/bin/hello 2>&1"
87+ ).lower()
88+ '';
89+ };
7190}