From 722edd4d8e4c6c2a97e1dc2126f0a75dd61176fa Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Wed, 15 Apr 2020 13:55:32 +0530 Subject: [PATCH] tests: make sotest opt-in Sotest must be explicitly enabled for tests. Use new build-product subtypes for hydra. Use bender binary provided by Cyberus. --- tests/default.nix | 5 +-- tests/driver-hw.nix | 29 +++++++++-------- tests/driver-nova.nix | 31 ++++++++++--------- tests/solo5/default.nix | 1 + tests/sotest_hw_config.dhall | 2 +- ..._config.dhall => sotest_nova_config.dhall} | 2 +- 6 files changed, 39 insertions(+), 31 deletions(-) rename tests/{sotest_config.dhall => sotest_nova_config.dhall} (63%) diff --git a/tests/default.nix b/tests/default.nix index 8c019c9..644c7ac 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -56,12 +56,13 @@ let hw-sotest = map ({ name, value }: { name = name + "-sotest"; value = value.sotest; - }) (testsToList hw); + }) (builtins.filter ({ name, value }: !isNull value.sotest) (testsToList hw)); nova-sotest = map ({ name, value }: { name = name + "-sotest"; value = value.sotest; - }) (testsToList nova); + }) (builtins.filter ({ name, value }: !isNull value.sotest) + (testsToList nova)); in with builtins; listToAttrs ((concatLists (map (testsToList) [ linux hw nova ])) ++ hw-sotest diff --git a/tests/driver-hw.nix b/tests/driver-hw.nix index c7a88ca..460e2eb 100644 --- a/tests/driver-hw.nix +++ b/tests/driver-hw.nix @@ -38,7 +38,7 @@ let ''run_genode_until {[init] child "harness" exited with exit value 0} 60''; mkTest = { name ? "unamed", testScript ? defaultScript, testConfig - , testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], ... }@t: + , testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], sotest ? false, ... }@t: let manifest = lib.mergeManifests (map addManifest (with testPkgs; [ base-hw-pc init sotest-producer ] ++ testInputs)); @@ -141,18 +141,21 @@ let xml = buildPackages.runCommand (name + ".config") testEnv' ''${apps.render-init.program} <<< "(${testConfig'}).config" > $out''; - sotest = buildPackages.runCommand "hw-${name}-sotest" testEnv' '' - cp "${testPkgs.bender}" bender - cp ${image} image.elf - mkdir -p $out/nix-support - ${buildPackages.zip}/bin/zip "$out/binaries.zip" \ - bender image.elf - ${apps.dhall-to-yaml.program} < ${ - ./sotest_hw_config.dhall - } > "$out/sotest_config.yaml" - echo file zip $out/binaries.zip >> "$out/nix-support/hydra-build-products" - echo file config $out/sotest_config.yaml >> "$out/nix-support/hydra-build-products" - ''; + sotest = if sotest then + buildPackages.runCommand "hw-${name}-sotest" testEnv' '' + cp "${testPkgs.bender}" bender + cp ${image} image.elf + mkdir -p $out/nix-support + ${buildPackages.zip}/bin/zip "$out/binaries.zip" \ + image.elf + ${apps.dhall-to-yaml.program} < ${ + ./sotest_hw_config.dhall + } > "$out/sotest_config.yaml" + echo file sotest-binaries $out/binaries.zip >> "$out/nix-support/hydra-build-products" + echo file sotest-config $out/sotest_config.yaml >> "$out/nix-support/hydra-build-products" + '' + else + null; }; diff --git a/tests/driver-nova.nix b/tests/driver-nova.nix index 1206993..ebf94d8 100644 --- a/tests/driver-nova.nix +++ b/tests/driver-nova.nix @@ -38,7 +38,7 @@ let ''run_genode_until {[init] child "harness" exited with exit value 0} 60''; mkTest = { name ? "unamed", testScript ? defaultScript, testConfig - , testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], ... }@t: + , testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], sotest ? false, ... }@t: let manifest = lib.mergeManifests (map addManifest (with testPkgs; [ base-nova (genodeSources.make "init") sotest-producer ] @@ -143,19 +143,22 @@ let iso = apps.nova-iso.function testEnv' "${testConfig'}"; - sotest = buildPackages.runCommand "nova-${name}-sotest" testEnv' '' - cp "${testPkgs.bender}" bender - cp "${testPkgs.NOVA}/hypervisor-x86_64" hypervisor - cp ${image} image.elf - mkdir -p $out/nix-support - ${buildPackages.zip}/bin/zip "$out/binaries.zip" \ - bender hypervisor image.elf - ${apps.dhall-to-yaml.program} < ${ - ./sotest_config.dhall - } > "$out/sotest_config.yaml" - echo file zip $out/binaries.zip >> "$out/nix-support/hydra-build-products" - echo file config $out/sotest_config.yaml >> "$out/nix-support/hydra-build-products" - ''; + sotest = if sotest then + buildPackages.runCommand "nova-${name}-sotest" testEnv' '' + cp "${testPkgs.bender}" bender + cp "${testPkgs.NOVA}/hypervisor-x86_64" hypervisor + cp ${image} image.elf + mkdir -p $out/nix-support + ${buildPackages.zip}/bin/zip "$out/binaries.zip" \ + hypervisor image.elf + ${apps.dhall-to-yaml.program} < ${ + ./sotest_nova_config.dhall + } > "$out/sotest_config.yaml" + echo file sotest-binaries $out/binaries.zip >> "$out/nix-support/hydra-build-products" + echo file sotest-config $out/sotest_config.yaml >> "$out/nix-support/hydra-build-products" + '' + else + null; }; diff --git a/tests/solo5/default.nix b/tests/solo5/default.nix index d17ffd7..3a27fdd 100644 --- a/tests/solo5/default.nix +++ b/tests/solo5/default.nix @@ -29,6 +29,7 @@ let tests = [ { name = "multi"; + sotest = true; testConfig = "${./.}/solo5.dhall"; testInputs = map genodeMake [ "app/ping" ] ++ (map genodeDepot [ "ram_block" diff --git a/tests/sotest_hw_config.dhall b/tests/sotest_hw_config.dhall index 809fc41..e458f29 100644 --- a/tests/sotest_hw_config.dhall +++ b/tests/sotest_hw_config.dhall @@ -1,4 +1,4 @@ { boot_items = [ { exec = "bender", load = [ "image.elf" ], name = "Genode base-hw" } ] -, boot_panic_patterns = [ "Error: init", "PAGE-FAULT IN CORE" ] +, extra_dependencies = [ { name = "bender", url = "https://sotest.io/bender" } ] } diff --git a/tests/sotest_config.dhall b/tests/sotest_nova_config.dhall similarity index 63% rename from tests/sotest_config.dhall rename to tests/sotest_nova_config.dhall index ec6295e..c38b51e 100644 --- a/tests/sotest_config.dhall +++ b/tests/sotest_nova_config.dhall @@ -4,5 +4,5 @@ , name = "NOVA with Genode" } ] -, boot_panic_patterns = [ "Error: init", "PAGE-FAULT IN CORE" ] +, extra_dependencies = [ { name = "bender", url = "https://sotest.io/bender" } ] }