Browse Source

fixup! tests: consolidate rtc, signal, pci into x86 test

routes
Emery Hemingway 5 months ago
parent
commit
1400dded7e

+ 5
- 2
packages/genodelabs/default.nix View File

@@ -251,10 +251,13 @@ in genodeSources // {
251 251
   inherit buildUpstream buildDepot ports specs toolchain genodeBase;
252 252
 
253 253
   make = target:
254
-    buildUpstream {
254
+    let
255 255
       name = builtins.replaceStrings [ "/" ] [ "-" ] target;
256
+      attrs = buildOverrides.${name} or { };
257
+    in buildUpstream ({
258
+      inherit name;
256 259
       targets = [ target ];
257
-    };
260
+    } // attrs);
258 261
 
259 262
   depot = name:
260 263
     let attrs = buildOverrides.${name} or { };

+ 7
- 0
packages/genodelabs/targets.nix View File

@@ -23,6 +23,13 @@ with ports; {
23 23
     buildInputs = with buildPackages; [ zlib ];
24 24
   };
25 25
 
26
+  # The following are tests that never exit
27
+  # and have no conventions on log output.
28
+
29
+  "test-pci".patches = [ ./test-pci.patch ];
30
+
31
+  "test-signal".patches = [ ./test-signal.patch ];
32
+
26 33
   usb_drv.portInputs = [ dde_linux ];
27 34
 
28 35
   vbox5 = {

+ 10
- 0
packages/genodelabs/test-pci.patch View File

@@ -0,0 +1,10 @@
1
+diff --git a/repos/os/src/test/pci/test.cc b/repos/os/src/test/pci/test.cc
2
+index c6d9e2012b..050de6136c 100644
3
+--- a/repos/os/src/test/pci/test.cc
4
++++ b/repos/os/src/test/pci/test.cc
5
+@@ -92,4 +92,5 @@ void Component::construct(Genode::Env &env)
6
+ 	pci.release_device(prev_device_cap);
7
+ 
8
+ 	log("--- Platform test finished ---");
9
++	env.parent().exit(0);
10
+ }

+ 12
- 0
packages/genodelabs/test-signal.patch View File

@@ -0,0 +1,12 @@
1
+diff --git a/repos/os/src/test/signal/main.cc b/repos/os/src/test/signal/main.cc
2
+index 4e16765ada..88769a2399 100644
3
+--- a/repos/os/src/test/signal/main.cc
4
++++ b/repos/os/src/test/signal/main.cc
5
+@@ -693,6 +693,7 @@ struct Main
6
+ 	{
7
+ 		test_8.destruct();
8
+ 		log("--- Signalling test finished ---");
9
++		env.parent().exit(0);
10
+ 	}
11
+ 
12
+ 	Main(Env &env) : env(env)

+ 5
- 12
tests/default.nix View File

@@ -1,11 +1,6 @@
1 1
 # SPDX-License-Identifier: CC0-1.0
2 2
 
3
-let
4
-  tests = call:
5
-    {
6
-      log = call ./log.nix { };
7
-      signal = call ./signal.nix { };
8
-    } // call ./solo5 { };
3
+let tests = call: { log = call ./log.nix { }; };
9 4
 
10 5
 in { apps, buildPackages, depot, genodepkgs, lib, nixpkgs }:
11 6
 
@@ -32,18 +27,16 @@ let
32 27
     ((tests call) // {
33 28
       driver_manager = call ./driver_manager.nix { };
34 29
       noux = call ./noux.nix { };
35
-      pci = call ./pci.nix { };
36
-      rtc = call ./rtc.nix { };
37
-    })) (import ./driver-nova.nix {
30
+      x86 = call ./x86.nix { };
31
+    } // call ./solo5 { })) (import ./driver-nova.nix {
38 32
       inherit apps addManifest buildPackages depot lib nixpkgs testPkgs;
39 33
     }).callTest;
40 34
 
41 35
   hw = (call:
42 36
     ((tests call) // {
43 37
       # noux = call ./noux.nix { };
44
-      pci = call ./pci.nix { };
45
-      rtc = call ./rtc.nix { };
46
-    })) (import ./driver-hw.nix {
38
+      x86 = call ./x86.nix { };
39
+    } // call ./solo5 { })) (import ./driver-hw.nix {
47 40
       inherit apps addManifest buildPackages depot lib nixpkgs testPkgs;
48 41
     }).callTest;
49 42
 

+ 4
- 3
tests/driver-hw.nix View File

@@ -35,13 +35,14 @@ let
35 35
     };
36 36
 
37 37
   defaultScript =
38
-    ''run_genode_until {[init] child "harness" exited with exit value 0} 60'';
38
+    ''run_genode_until {child "init" exited with exit value 0} 120'';
39 39
 
40 40
   mkTest = { name ? "unamed", testScript ? defaultScript, testConfig
41 41
     , testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], sotest ? false, ... }@t:
42 42
     let
43
-      manifest = lib.mergeManifests (map addManifest
44
-        (with testPkgs; [ base-hw-pc init sotest-producer ] ++ testInputs));
43
+      manifest = lib.mergeManifests (map addManifest (with testPkgs;
44
+        [ base-hw-pc sotest-producer ]
45
+        ++ map genodeSources.depot [ "init" "rtc_drv" ] ++ testInputs));
45 46
       testConfig' = "${./test-wrapper.dhall} ${testConfig} (toMap ${manifest})";
46 47
       testEnv' = {
47 48
         DHALL_GENODE = "${testPkgs.dhallGenode}/source.dhall";

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

@@ -35,13 +35,14 @@ let
35 35
     };
36 36
 
37 37
   defaultScript =
38
-    ''run_genode_until {[init] child "harness" exited with exit value 0} 60'';
38
+    ''run_genode_until {child "init" exited with exit value 0} 120'';
39 39
 
40 40
   mkTest = { name ? "unamed", testScript ? defaultScript, testConfig
41 41
     , testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], sotest ? false, ... }@t:
42 42
     let
43 43
       manifest = lib.mergeManifests (map addManifest (with testPkgs;
44
-        [ base-nova (genodeSources.make "init") sotest-producer ]
44
+        [ base-nova sotest-producer ]
45
+        ++ map genodeSources.depot [ "init" "rtc_drv" ]
45 46
         ++ testInputs));
46 47
       testConfig' = "${./test-wrapper.dhall} ${testConfig} (toMap ${manifest})";
47 48
       testEnv' = {
@@ -93,7 +94,8 @@ let
93 94
           global spawn_id
94 95
           set TEST_MIB [expr (([file size ${image}] + $env(TEST_RAM)) >> 20) + 24]
95 96
           spawn ${buildPackages.qemu_test}/bin/qemu-system-x86_64 \
96
-            -machine q35 -serial mon:stdio -nographic \
97
+            -machine q35 -cpu phenom -smp 2 \
98
+            -serial mon:stdio -nographic \
97 99
             -m size=$TEST_MIB \
98 100
             -kernel "${testPkgs.bender}" \
99 101
             -initrd "${testPkgs.NOVA}/hypervisor-x86_64 arg=iommu novpid serial,${image}" \

+ 0
- 1
tests/driver_manager.nix View File

@@ -19,7 +19,6 @@ testEnv.mkTest {
19 19
     "ps2_drv"
20 20
     "report_rom"
21 21
     "rom_reporter"
22
-    "rtc_drv"
23 22
     "usb_drv"
24 23
     "vesa_drv"
25 24
   ]) ++ (map pkgs.genodeSources.make [ "test/driver_manager" ]);

+ 0
- 17
tests/pci.nix View File

@@ -1,17 +0,0 @@
1
-# SPDX-License-Identifier: CC0-1.0
2
-
3
-{ testEnv, pkgs, ... }:
4
-with pkgs;
5
-
6
-testEnv.mkTest {
7
-  name = "pci";
8
-  meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ];
9
-
10
-  testConfig = ./pci.dhall;
11
-  testInputs =
12
-    (map pkgs.genodeSources.depot [ "acpi_drv" "platform_drv" "report_rom" ])
13
-    ++ (map pkgs.genodeSources.make [ "test/pci" ]);
14
-  testScript = ''
15
-    run_genode_until ".*--- Platform test finished ---.*\n" 60
16
-  '';
17
-}

+ 0
- 31
tests/rtc.dhall View File

@@ -1,32 +0,0 @@
1
-
2
-let Test = ./test.dhall ? env:DHALL_GENODE_TEST
3
-
4
-let Genode = Test.Genode
5
-
6
-let Child = Genode.Init.Child
7
-
8
-let init =
9
-      Genode.Init::{
10
-      , children = toMap
11
-          { test-rtc =
12
-              Child.flat
13
-                Child.Attributes::{
14
-                , binary = "test-rtc"
15
-                , exitPropagate = True
16
-                , routes =
17
-                  [ Genode.Init.ServiceRoute.parent "Timer"
18
-                  , Genode.Init.ServiceRoute.child "Rtc" "rtc_drv"
19
-                  ]
20
-                }
21
-          , rtc_drv =
22
-              Child.flat
23
-                Child.Attributes::{
24
-                , binary = "rtc_drv"
25
-                , provides = [ "Rtc" ]
26
-                , routes = [ Genode.Init.ServiceRoute.parent "IO_PORT" ]
27
-                }
28
-          }
29
-      }
30
-
31
-in  Test::{ children = Test.initToChildren init }

+ 0
- 13
tests/rtc.nix View File

@@ -1,13 +0,0 @@
1
-# SPDX-License-Identifier: CC0-1.0
2
-
3
-{ testEnv, pkgs, ... }:
4
-with pkgs;
5
-
6
-testEnv.mkTest {
7
-  name = "rtc";
8
-  meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ];
9
-
10
-  testConfig = ./rtc.dhall;
11
-  testInputs = map pkgs.genodeSources.depot [ "rtc_drv" "test-rtc" ];
12
-  testScript = "run_genode_until {--- RTC test finished ---} 40";
13
-}

+ 0
- 25
tests/signal.dhall View File

@@ -1,26 +0,0 @@
1
-
2
-let Test = ./test.dhall ? env:DHALL_GENODE_TEST
3
-
4
-let Genode = Test.Genode
5
-
6
-let Init = Genode.Init
7
-
8
-let Child = Init.Child
9
-
10
-in  Test::{
11
-    , children = toMap
12
-        { test-signal =
13
-            Child.flat
14
-              Child.Attributes::{
15
-              , binary = "test-signal"
16
-              , exitPropagate = True
17
-              , priority = 5
18
-              , resources = Init.Resources::{
19
-                , caps = 500
20
-                , ram = Genode.units.MiB 10
21
-                }
22
-              , routes = [ Init.ServiceRoute.parent "Timer" ]
23
-              }
24
-        }
25
-    }

+ 0
- 13
tests/signal.nix View File

@@ -1,13 +0,0 @@
1
-# SPDX-License-Identifier: CC0-1.0
2
-
3
-{ testEnv, pkgs, ... }:
4
-with pkgs;
5
-
6
-testEnv.mkTest rec {
7
-  name = "signal";
8
-  meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ];
9
-
10
-  testConfig = ./signal.dhall;
11
-  testInputs = [ (pkgs.genodeSources.depot "test-signal") ];
12
-  testScript = "run_genode_until {--- Signalling test finished ---} 120";
13
-}

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

@@ -36,7 +36,6 @@ let
36 36
         "nic_bridge"
37 37
         "nic_loopback"
38 38
         "sequence"
39
-        "rtc_drv"
40 39
       ]);
41 40
     }
42 41
 

+ 11
- 0
tests/test-wrapper.dhall View File

@@ -30,7 +30,9 @@ let wrapHarness
30 30
             , Init.ServiceRoute.parent "IO_MEM"
31 31
             , Init.ServiceRoute.parent "IO_PORT"
32 32
             , Init.ServiceRoute.parent "IRQ"
33
+            , Init.ServiceRoute.parent "VM"
33 34
             , Init.ServiceRoute.child "Timer" "timer"
35
+            , Init.ServiceRoute.child "Rtc" "rtc"
34 36
             ]
35 37
           }
36 38
 
@@ -47,6 +49,15 @@ in    λ(test : Test.Type)
47 49
                   , provides = [ "Timer" ]
48 50
                   }
49 51
             }
52
+          , { mapKey = "rtc"
53
+            , mapValue =
54
+                Child.flat
55
+                  Child.Attributes::{
56
+                  , binary = "rtc_drv"
57
+                  , provides = [ "Rtc" ]
58
+                  , routes = [ Init.ServiceRoute.parent "IO_PORT" ]
59
+                  }
60
+            }
50 61
           , { mapKey = "harness", mapValue = wrapHarness test.children }
51 62
           ]
52 63
         }

+ 1
- 0
tests/test.dhall View File

@@ -25,6 +25,7 @@ in  { Genode = Genode
25 25
                     , Init.ServiceRoute.parent "IO_MEM"
26 26
                     , Init.ServiceRoute.parent "IO_PORT"
27 27
                     , Init.ServiceRoute.parent "IRQ"
28
+                    , Init.ServiceRoute.parent "VM"
28 29
                     , Init.ServiceRoute.child "Timer" "timer"
29 30
                     ]
30 31
                   }

tests/pci.dhall → tests/x86.dhall View File

@@ -16,7 +16,27 @@ let ServiceRoute = Init.ServiceRoute
16 16
 
17 17
 let label = λ(_ : Text) → { local = _, route = _ } : Child.Attributes.Label
18 18
 
19
-let init =
19
+let signal =
20
+      Child.flat
21
+        Child.Attributes::{
22
+        , binary = "test-signal"
23
+        , exitPropagate = True
24
+        , priority = 5
25
+        , resources = Init.Resources::{ caps = 500, ram = Genode.units.MiB 10 }
26
+        , routes = [ Init.ServiceRoute.parent "Timer" ]
27
+        }
28
+
29
+let rtc =
30
+      Child.flat
31
+        Child.Attributes::{
32
+        , binary = "test-rtc"
33
+        , routes =
34
+          [ Genode.Init.ServiceRoute.parent "Timer"
35
+          , Genode.Init.ServiceRoute.parent "Rtc"
36
+          ]
37
+        }
38
+
39
+let pciInit =
20 40
       Init::{
21 41
       , verbose = True
22 42
       , children = toMap
@@ -74,4 +94,10 @@ let init =
74 94
           }
75 95
       }
76 96
 
77
-in  Test::{ children = Test.initToChildren init }
97
+in  Test::{
98
+    , children =
99
+          [ { mapKey = "signal", mapValue = signal }
100
+          , { mapKey = "rtc", mapValue = rtc }
101
+          ]
102
+        # Test.initToChildren pciInit
103
+    }

+ 17
- 0
tests/x86.nix View File

@@ -0,0 +1,17 @@
1
+# SPDX-License-Identifier: CC0-1.0
2
+
3
+{ testEnv, pkgs, ... }:
4
+with pkgs;
5
+
6
+testEnv.mkTest {
7
+  name = "x86";
8
+  meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ];
9
+
10
+  testConfig = ./x86.dhall;
11
+  testInputs = (map pkgs.genodeSources.depot [
12
+    "acpi_drv"
13
+    "platform_drv"
14
+    "report_rom"
15
+    "test-signal"
16
+  ]) ++ (map pkgs.genodeSources.make [ "test/pci" "test/rtc" ]);
17
+}

Loading…
Cancel
Save