1 # Not everyone has a suitable remote builder set up, so the cross-compilation
2 # tests that _include_ running the result are separate. That way, most people
3 # can run the majority of the test suite without the extra setup.
6 import ./make-test-python.nix ({ pkgs, ... }:
10 if pkgs.stdenv.hostPlatform.system == "aarch64-linux"
14 remoteCrossPkgs = import ../.. /*nixpkgs*/ {
15 # NOTE: This is the machine that runs the build - local from the
16 # 'perspective' of the build script.
17 localSystem = remoteSystem;
19 # NOTE: Since this file can't control where the test will be _run_ we don't
20 # cross-compile _to_ a different system but _from_ a different system
21 crossSystem = pkgs.stdenv.hostPlatform.system;
24 hello1 = remoteCrossPkgs.dockerTools.buildImage {
27 copyToRoot = remoteCrossPkgs.buildEnv {
29 pathsToLink = [ "/bin" ];
30 paths = [ remoteCrossPkgs.hello ];
34 hello2 = remoteCrossPkgs.dockerTools.buildLayeredImage {
37 contents = remoteCrossPkgs.hello;
41 name = "docker-tools";
42 meta = with pkgs.lib.maintainers; {
43 maintainers = [ roberth ];
56 docker.wait_for_unit("sockets.target")
58 with subtest("Ensure cross compiled buildImage image can run."):
60 "docker load --input='${hello1}'"
62 assert "Hello, world!" in docker.succeed(
63 "docker run --rm ${hello1.imageName} hello",
66 "docker rmi ${hello1.imageName}",
69 with subtest("Ensure cross compiled buildLayeredImage image can run."):
71 "docker load --input='${hello2}'"
73 assert "Hello, world!" in docker.succeed(
74 "docker run --rm ${hello2.imageName} hello",
77 "docker rmi ${hello2.imageName}",