Browse Source

tests: consolidate sotest to a single project

Make one SoTest run per hydra evaluation.
undefined
Emery Hemingway 5 months ago
parent
commit
f374b4362c
5 changed files with 45 additions and 54 deletions
  1. 1
    0
      flake.nix
  2. 39
    13
      tests/default.nix
  3. 2
    18
      tests/driver-hw.nix
  4. 3
    22
      tests/driver-nova.nix
  5. 0
    1
      tests/solo5/default.nix

+ 1
- 0
flake.nix View File

@@ -120,6 +120,7 @@
120 120
       checks = let
121 121
         checks' = forAllCrossSystems ({ system, localSystem, crossSystem }:
122 122
           import ./tests {
123
+            inherit self;
123 124
             apps = self.apps.${system};
124 125
             buildPackages = nixpkgsFor.${localSystem};
125 126
             depot = genode-depot.packages.${system};

+ 39
- 13
tests/default.nix View File

@@ -2,7 +2,7 @@
2 2
 
3 3
 let tests = call: { log = call ./log.nix { }; };
4 4
 
5
-in { apps, buildPackages, depot, genodepkgs, lib, nixpkgs }:
5
+in { self, apps, buildPackages, depot, genodepkgs, lib, nixpkgs }:
6 6
 
7 7
 let
8 8
   testPkgs = genodepkgs;
@@ -47,17 +47,43 @@ let
47 47
       value = test;
48 48
     }) (builtins.attrValues tests);
49 49
 
50
-  hw-sotest = map ({ name, value }: {
51
-    name = name + "-sotest";
52
-    value = value.sotest;
53
-  }) (builtins.filter ({ name, value }: !isNull value.sotest) (testsToList hw));
50
+in with builtins;
51
+listToAttrs ((concatLists (map (testsToList) [ linux hw nova ]))) // {
52
+  sotest = let
53
+    hwTests = [ hw.multi hw.x86 ];
54
+    novaTests = [ nova.multi nova.x86 nova.vmm ];
55
+    allTests = hwTests ++ novaTests;
54 56
 
55
-  nova-sotest = map ({ name, value }: {
56
-    name = name + "-sotest";
57
-    value = value.sotest;
58
-  }) (builtins.filter ({ name, value }: !isNull value.sotest)
59
-    (testsToList nova));
57
+    projectCfg.boot_items =
60 58
 
61
-in with builtins;
62
-listToAttrs ((concatLists (map (testsToList) [ linux hw nova ])) ++ hw-sotest
63
-  ++ nova-sotest)
59
+      (map (test: {
60
+        inherit (test) name;
61
+        exec = "bender";
62
+        load = [ test.image.name ];
63
+      }) hwTests)
64
+
65
+      ++ (map (test: {
66
+        inherit (test) name;
67
+        exec = "bender";
68
+        load = [ "hypervisor serial novga iommu" test.image.name ];
69
+      }) novaTests);
70
+
71
+  in buildPackages.stdenv.mkDerivation {
72
+    pname = "sotest";
73
+    version = self.lastModified;
74
+    buildCommand = ''
75
+      mkdir zip; cd zip
76
+      cp "${testPkgs.bender}" bender
77
+      cp "${testPkgs.NOVA}/hypervisor-x86_64" hypervisor
78
+      ${concatStringsSep "\n"
79
+      (map (test: "cp ${test.image} ${test.image.name}") allTests)}
80
+      mkdir -p $out/nix-support
81
+      ${buildPackages.zip}/bin/zip "$out/binaries.zip" *
82
+      cat << EOF > "$out/project.json"
83
+      ${builtins.toJSON projectCfg}
84
+      EOF
85
+      echo file sotest-binaries $out/binaries.zip >> "$out/nix-support/hydra-build-products"
86
+      echo file sotest-config $out/project.json >> "$out/nix-support/hydra-build-products"
87
+    '';
88
+  };
89
+}

+ 2
- 18
tests/driver-hw.nix View File

@@ -38,7 +38,7 @@ let
38 38
     ''run_genode_until {child "init" exited with exit value 0} 120'';
39 39
 
40 40
   mkTest = { name ? "unamed", testScript ? defaultScript, testConfig
41
-    , testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], sotest ? false, ... }@t:
41
+    , testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], ... }@t:
42 42
     let
43 43
       manifest = lib.mergeManifests (map addManifest (with testPkgs;
44 44
         [ base-hw-pc sotest-producer ]
@@ -49,7 +49,7 @@ let
49 49
         DHALL_GENODE_TEST = "${./test.dhall}";
50 50
       } // testEnv;
51 51
 
52
-      image = lib.hwImage name testEnv' testConfig';
52
+      image = lib.hwImage ("hw-" + name) testEnv' testConfig';
53 53
 
54 54
       baseSetup = ''
55 55
         ##
@@ -142,22 +142,6 @@ let
142 142
       xml = buildPackages.runCommand (name + ".config") testEnv'
143 143
         ''${apps.render-init.program} <<< "(${testConfig'}).config" > $out'';
144 144
 
145
-      sotest = if sotest then
146
-        buildPackages.runCommand "hw-${name}-sotest" testEnv' ''
147
-          cp "${testPkgs.bender}" bender
148
-          cp ${image} image.elf
149
-          mkdir -p $out/nix-support
150
-          ${buildPackages.zip}/bin/zip "$out/binaries.zip" \
151
-            image.elf
152
-          ${apps.dhall-to-yaml.program} < ${
153
-            ./sotest_hw_config.dhall
154
-          } > "$out/sotest_config.yaml"
155
-          echo file sotest-binaries $out/binaries.zip >> "$out/nix-support/hydra-build-products"
156
-          echo file sotest-config $out/sotest_config.yaml >> "$out/nix-support/hydra-build-products"
157
-        ''
158
-      else
159
-        null;
160
-
161 145
     };
162 146
 
163 147
 in {

+ 3
- 22
tests/driver-nova.nix View File

@@ -38,19 +38,18 @@ let
38 38
     ''run_genode_until {child "init" exited with exit value 0} 120'';
39 39
 
40 40
   mkTest = { name ? "unamed", testScript ? defaultScript, testConfig
41
-    , testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], sotest ? false, ... }@t:
41
+    , testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], ... }@t:
42 42
     let
43 43
       manifest = lib.mergeManifests (map addManifest (with testPkgs;
44 44
         [ base-nova sotest-producer ]
45
-        ++ map genodeSources.depot [ "init" "rtc_drv" ]
46
-        ++ testInputs));
45
+        ++ map genodeSources.depot [ "init" "rtc_drv" ] ++ testInputs));
47 46
       testConfig' = "${./test-wrapper.dhall} ${testConfig} (toMap ${manifest})";
48 47
       testEnv' = {
49 48
         DHALL_GENODE = "${testPkgs.dhallGenode}/source.dhall";
50 49
         DHALL_GENODE_TEST = "${./test.dhall}";
51 50
       } // testEnv;
52 51
 
53
-      image = lib.novaImage name testEnv' testConfig';
52
+      image = lib.novaImage ("nova-" + name) testEnv' testConfig';
54 53
       build = lib.compileBoot name testEnv' testConfig';
55 54
 
56 55
       baseSetup = ''
@@ -144,24 +143,6 @@ let
144 143
       compile = lib.compileBoot name testConfig';
145 144
 
146 145
       iso = apps.nova-iso.function testEnv' "${testConfig'}";
147
-
148
-      sotest = if sotest then
149
-        buildPackages.runCommand "nova-${name}-sotest" testEnv' ''
150
-          cp "${testPkgs.bender}" bender
151
-          cp "${testPkgs.NOVA}/hypervisor-x86_64" hypervisor
152
-          cp ${image} image.elf
153
-          mkdir -p $out/nix-support
154
-          ${buildPackages.zip}/bin/zip "$out/binaries.zip" \
155
-            hypervisor image.elf
156
-          ${apps.dhall-to-yaml.program} < ${
157
-            ./sotest_nova_config.dhall
158
-          } > "$out/sotest_config.yaml"
159
-          echo file sotest-binaries $out/binaries.zip >> "$out/nix-support/hydra-build-products"
160
-          echo file sotest-config $out/sotest_config.yaml >> "$out/nix-support/hydra-build-products"
161
-        ''
162
-      else
163
-        null;
164
-
165 146
     };
166 147
 
167 148
 in {

+ 0
- 1
tests/solo5/default.nix View File

@@ -29,7 +29,6 @@ let
29 29
   tests = [
30 30
     {
31 31
       name = "multi";
32
-      sotest = true;
33 32
       testConfig = "${./.}/solo5.dhall";
34 33
       testInputs = map genodeMake [ "app/ping" ] ++ (map genodeDepot [
35 34
         "ram_block"

Loading…
Cancel
Save