git.iko.soy/typeable/nixpkgs
on master help sign in
nixosTests.systemd-binfmt: init

This adds a simple test running GNU Hello cross-compiled for armv7l and aarch64 inside a x86_64 VM with configured binfmt. We already build the cross toolchains in other invocations, and building hello itself is small.

commitfd49155848a8ee8aa2f103fe765ddb9aed1b3d2d authorFlorian Klink <flokli@flokli.de> dateMon 18 May 2020, 11:16 (6 years ago) parent4e27159
2 files changed+25
nixos/tests/all-tests.nix+1 nixos/tests/systemd-binfmt.nix+24
nixos/tests/all-tests.nix+1
@@ -304,6 +304,7 @@ in
304304 syncthing-relay = handleTest ./syncthing-relay.nix {};
305305 systemd = handleTest ./systemd.nix {};
306306 systemd-analyze = handleTest ./systemd-analyze.nix {};
307+ systemd-binfmt = handleTestOn ["x86_64-linux"] ./systemd-binfmt.nix {};
307308 systemd-boot = handleTestOn ["x86_64-linux"] ./systemd-boot.nix {};
308309 systemd-confinement = handleTest ./systemd-confinement.nix {};
309310 systemd-timesyncd = handleTest ./systemd-timesyncd.nix {};
nixos/tests/systemd-binfmt.nixnew file+24
@@ -0,0 +1,24 @@
1+# Teach the kernel how to run armv7l and aarch64-linux binaries,
2+# and run GNU Hello for these architectures.
3+import ./make-test-python.nix ({ pkgs, ... }: {
4+ name = "systemd-binfmt";
5+ machine = {
6+ boot.binfmt.emulatedSystems = [
7+ "armv7l-linux"
8+ "aarch64-linux"
9+ ];
10+ };
11+
12+ testScript = let
13+ helloArmv7l = pkgs.pkgsCross.armv7l-hf-multiplatform.hello;
14+ helloAarch64 = pkgs.pkgsCross.aarch64-multiplatform.hello;
15+ in ''
16+ machine.start()
17+ assert "world" in machine.succeed(
18+ "${helloArmv7l}/bin/hello"
19+ )
20+ assert "world" in machine.succeed(
21+ "${helloAarch64}/bin/hello"
22+ )
23+ '';
24+})