diff --git a/packages/genodelabs/default.nix b/packages/genodelabs/default.nix index d30902f..7ca6c99 100644 --- a/packages/genodelabs/default.nix +++ b/packages/genodelabs/default.nix @@ -251,10 +251,13 @@ in genodeSources // { inherit buildUpstream buildDepot ports specs toolchain genodeBase; make = target: - buildUpstream { + let name = builtins.replaceStrings [ "/" ] [ "-" ] target; + attrs = buildOverrides.${name} or { }; + in buildUpstream ({ + inherit name; targets = [ target ]; - }; + } // attrs); depot = name: let attrs = buildOverrides.${name} or { }; diff --git a/packages/genodelabs/targets.nix b/packages/genodelabs/targets.nix index 4ad8a46..b075c28 100644 --- a/packages/genodelabs/targets.nix +++ b/packages/genodelabs/targets.nix @@ -23,6 +23,13 @@ with ports; { buildInputs = with buildPackages; [ zlib ]; }; + # The following are tests that never exit + # and have no conventions on log output. + + "test-pci".patches = [ ./test-pci.patch ]; + + "test-signal".patches = [ ./test-signal.patch ]; + usb_drv.portInputs = [ dde_linux ]; vbox5 = { diff --git a/packages/genodelabs/test-pci.patch b/packages/genodelabs/test-pci.patch new file mode 100644 index 0000000..51c9d06 --- /dev/null +++ b/packages/genodelabs/test-pci.patch @@ -0,0 +1,10 @@ +diff --git a/repos/os/src/test/pci/test.cc b/repos/os/src/test/pci/test.cc +index c6d9e2012b..050de6136c 100644 +--- a/repos/os/src/test/pci/test.cc ++++ b/repos/os/src/test/pci/test.cc +@@ -92,4 +92,5 @@ void Component::construct(Genode::Env &env) + pci.release_device(prev_device_cap); + + log("--- Platform test finished ---"); ++ env.parent().exit(0); + } diff --git a/packages/genodelabs/test-signal.patch b/packages/genodelabs/test-signal.patch new file mode 100644 index 0000000..67fb2f8 --- /dev/null +++ b/packages/genodelabs/test-signal.patch @@ -0,0 +1,12 @@ +diff --git a/repos/os/src/test/signal/main.cc b/repos/os/src/test/signal/main.cc +index 4e16765ada..88769a2399 100644 +--- a/repos/os/src/test/signal/main.cc ++++ b/repos/os/src/test/signal/main.cc +@@ -693,6 +693,7 @@ struct Main + { + test_8.destruct(); + log("--- Signalling test finished ---"); ++ env.parent().exit(0); + } + + Main(Env &env) : env(env) diff --git a/tests/default.nix b/tests/default.nix index 644c7ac..9c00c20 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -1,11 +1,6 @@ # SPDX-License-Identifier: CC0-1.0 -let - tests = call: - { - log = call ./log.nix { }; - signal = call ./signal.nix { }; - } // call ./solo5 { }; +let tests = call: { log = call ./log.nix { }; }; in { apps, buildPackages, depot, genodepkgs, lib, nixpkgs }: @@ -32,18 +27,16 @@ let ((tests call) // { driver_manager = call ./driver_manager.nix { }; noux = call ./noux.nix { }; - pci = call ./pci.nix { }; - rtc = call ./rtc.nix { }; - })) (import ./driver-nova.nix { + x86 = call ./x86.nix { }; + } // call ./solo5 { })) (import ./driver-nova.nix { inherit apps addManifest buildPackages depot lib nixpkgs testPkgs; }).callTest; hw = (call: ((tests call) // { # noux = call ./noux.nix { }; - pci = call ./pci.nix { }; - rtc = call ./rtc.nix { }; - })) (import ./driver-hw.nix { + x86 = call ./x86.nix { }; + } // call ./solo5 { })) (import ./driver-hw.nix { inherit apps addManifest buildPackages depot lib nixpkgs testPkgs; }).callTest; diff --git a/tests/driver-hw.nix b/tests/driver-hw.nix index 460e2eb..ab7b6f1 100644 --- a/tests/driver-hw.nix +++ b/tests/driver-hw.nix @@ -35,13 +35,14 @@ let }; defaultScript = - ''run_genode_until {[init] child "harness" exited with exit value 0} 60''; + ''run_genode_until {child "init" exited with exit value 0} 120''; mkTest = { name ? "unamed", testScript ? defaultScript, testConfig , testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], sotest ? false, ... }@t: let - manifest = lib.mergeManifests (map addManifest - (with testPkgs; [ base-hw-pc init sotest-producer ] ++ testInputs)); + manifest = lib.mergeManifests (map addManifest (with testPkgs; + [ base-hw-pc sotest-producer ] + ++ map genodeSources.depot [ "init" "rtc_drv" ] ++ testInputs)); testConfig' = "${./test-wrapper.dhall} ${testConfig} (toMap ${manifest})"; testEnv' = { DHALL_GENODE = "${testPkgs.dhallGenode}/source.dhall"; diff --git a/tests/driver-nova.nix b/tests/driver-nova.nix index ebf94d8..f196ffc 100644 --- a/tests/driver-nova.nix +++ b/tests/driver-nova.nix @@ -35,13 +35,14 @@ let }; defaultScript = - ''run_genode_until {[init] child "harness" exited with exit value 0} 60''; + ''run_genode_until {child "init" exited with exit value 0} 120''; mkTest = { name ? "unamed", testScript ? defaultScript, testConfig , testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], sotest ? false, ... }@t: let manifest = lib.mergeManifests (map addManifest (with testPkgs; - [ base-nova (genodeSources.make "init") sotest-producer ] + [ base-nova sotest-producer ] + ++ map genodeSources.depot [ "init" "rtc_drv" ] ++ testInputs)); testConfig' = "${./test-wrapper.dhall} ${testConfig} (toMap ${manifest})"; testEnv' = { @@ -93,7 +94,8 @@ let global spawn_id set TEST_MIB [expr (([file size ${image}] + $env(TEST_RAM)) >> 20) + 24] spawn ${buildPackages.qemu_test}/bin/qemu-system-x86_64 \ - -machine q35 -serial mon:stdio -nographic \ + -machine q35 -cpu phenom -smp 2 \ + -serial mon:stdio -nographic \ -m size=$TEST_MIB \ -kernel "${testPkgs.bender}" \ -initrd "${testPkgs.NOVA}/hypervisor-x86_64 arg=iommu novpid serial,${image}" \ diff --git a/tests/driver_manager.nix b/tests/driver_manager.nix index 422bf49..8379220 100644 --- a/tests/driver_manager.nix +++ b/tests/driver_manager.nix @@ -19,7 +19,6 @@ testEnv.mkTest { "ps2_drv" "report_rom" "rom_reporter" - "rtc_drv" "usb_drv" "vesa_drv" ]) ++ (map pkgs.genodeSources.make [ "test/driver_manager" ]); diff --git a/tests/pci.nix b/tests/pci.nix deleted file mode 100644 index 73c62a0..0000000 --- a/tests/pci.nix +++ /dev/null @@ -1,17 +0,0 @@ -# SPDX-License-Identifier: CC0-1.0 - -{ testEnv, pkgs, ... }: -with pkgs; - -testEnv.mkTest { - name = "pci"; - meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ]; - - testConfig = ./pci.dhall; - testInputs = - (map pkgs.genodeSources.depot [ "acpi_drv" "platform_drv" "report_rom" ]) - ++ (map pkgs.genodeSources.make [ "test/pci" ]); - testScript = '' - run_genode_until ".*--- Platform test finished ---.*\n" 60 - ''; -} diff --git a/tests/rtc.dhall b/tests/rtc.dhall deleted file mode 100644 index b7eb8d9..0000000 --- a/tests/rtc.dhall +++ /dev/null @@ -1,32 +0,0 @@ --- SPDX-License-Identifier: CC0-1.0 - -let Test = ./test.dhall ? env:DHALL_GENODE_TEST - -let Genode = Test.Genode - -let Child = Genode.Init.Child - -let init = - Genode.Init::{ - , children = toMap - { test-rtc = - Child.flat - Child.Attributes::{ - , binary = "test-rtc" - , exitPropagate = True - , routes = - [ Genode.Init.ServiceRoute.parent "Timer" - , Genode.Init.ServiceRoute.child "Rtc" "rtc_drv" - ] - } - , rtc_drv = - Child.flat - Child.Attributes::{ - , binary = "rtc_drv" - , provides = [ "Rtc" ] - , routes = [ Genode.Init.ServiceRoute.parent "IO_PORT" ] - } - } - } - -in Test::{ children = Test.initToChildren init } diff --git a/tests/rtc.nix b/tests/rtc.nix deleted file mode 100644 index fea9572..0000000 --- a/tests/rtc.nix +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-License-Identifier: CC0-1.0 - -{ testEnv, pkgs, ... }: -with pkgs; - -testEnv.mkTest { - name = "rtc"; - meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ]; - - testConfig = ./rtc.dhall; - testInputs = map pkgs.genodeSources.depot [ "rtc_drv" "test-rtc" ]; - testScript = "run_genode_until {--- RTC test finished ---} 40"; -} diff --git a/tests/signal.dhall b/tests/signal.dhall deleted file mode 100644 index a5a4d4f..0000000 --- a/tests/signal.dhall +++ /dev/null @@ -1,26 +0,0 @@ --- SPDX-License-Identifier: CC0-1.0 - -let Test = ./test.dhall ? env:DHALL_GENODE_TEST - -let Genode = Test.Genode - -let Init = Genode.Init - -let Child = Init.Child - -in Test::{ - , children = toMap - { test-signal = - Child.flat - Child.Attributes::{ - , binary = "test-signal" - , exitPropagate = True - , priority = 5 - , resources = Init.Resources::{ - , caps = 500 - , ram = Genode.units.MiB 10 - } - , routes = [ Init.ServiceRoute.parent "Timer" ] - } - } - } diff --git a/tests/signal.nix b/tests/signal.nix deleted file mode 100644 index 39d5584..0000000 --- a/tests/signal.nix +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-License-Identifier: CC0-1.0 - -{ testEnv, pkgs, ... }: -with pkgs; - -testEnv.mkTest rec { - name = "signal"; - meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ]; - - testConfig = ./signal.dhall; - testInputs = [ (pkgs.genodeSources.depot "test-signal") ]; - testScript = "run_genode_until {--- Signalling test finished ---} 120"; -} diff --git a/tests/solo5/default.nix b/tests/solo5/default.nix index 3a27fdd..6d0d775 100644 --- a/tests/solo5/default.nix +++ b/tests/solo5/default.nix @@ -36,7 +36,6 @@ let "nic_bridge" "nic_loopback" "sequence" - "rtc_drv" ]); } diff --git a/tests/test-wrapper.dhall b/tests/test-wrapper.dhall index 91eb074..dc82812 100644 --- a/tests/test-wrapper.dhall +++ b/tests/test-wrapper.dhall @@ -30,7 +30,9 @@ let wrapHarness , Init.ServiceRoute.parent "IO_MEM" , Init.ServiceRoute.parent "IO_PORT" , Init.ServiceRoute.parent "IRQ" + , Init.ServiceRoute.parent "VM" , Init.ServiceRoute.child "Timer" "timer" + , Init.ServiceRoute.child "Rtc" "rtc" ] } @@ -47,6 +49,15 @@ in λ(test : Test.Type) , provides = [ "Timer" ] } } + , { mapKey = "rtc" + , mapValue = + Child.flat + Child.Attributes::{ + , binary = "rtc_drv" + , provides = [ "Rtc" ] + , routes = [ Init.ServiceRoute.parent "IO_PORT" ] + } + } , { mapKey = "harness", mapValue = wrapHarness test.children } ] } diff --git a/tests/test.dhall b/tests/test.dhall index 9ee791e..f53cdf8 100644 --- a/tests/test.dhall +++ b/tests/test.dhall @@ -25,6 +25,7 @@ in { Genode = Genode , Init.ServiceRoute.parent "IO_MEM" , Init.ServiceRoute.parent "IO_PORT" , Init.ServiceRoute.parent "IRQ" + , Init.ServiceRoute.parent "VM" , Init.ServiceRoute.child "Timer" "timer" ] } diff --git a/tests/pci.dhall b/tests/x86.dhall similarity index 76% rename from tests/pci.dhall rename to tests/x86.dhall index 88f0b22..adb88d9 100644 --- a/tests/pci.dhall +++ b/tests/x86.dhall @@ -16,7 +16,27 @@ let ServiceRoute = Init.ServiceRoute let label = λ(_ : Text) → { local = _, route = _ } : Child.Attributes.Label -let init = +let signal = + Child.flat + Child.Attributes::{ + , binary = "test-signal" + , exitPropagate = True + , priority = 5 + , resources = Init.Resources::{ caps = 500, ram = Genode.units.MiB 10 } + , routes = [ Init.ServiceRoute.parent "Timer" ] + } + +let rtc = + Child.flat + Child.Attributes::{ + , binary = "test-rtc" + , routes = + [ Genode.Init.ServiceRoute.parent "Timer" + , Genode.Init.ServiceRoute.parent "Rtc" + ] + } + +let pciInit = Init::{ , verbose = True , children = toMap @@ -74,4 +94,10 @@ let init = } } -in Test::{ children = Test.initToChildren init } +in Test::{ + , children = + [ { mapKey = "signal", mapValue = signal } + , { mapKey = "rtc", mapValue = rtc } + ] + # Test.initToChildren pciInit + } diff --git a/tests/x86.nix b/tests/x86.nix new file mode 100644 index 0000000..aa2662e --- /dev/null +++ b/tests/x86.nix @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: CC0-1.0 + +{ testEnv, pkgs, ... }: +with pkgs; + +testEnv.mkTest { + name = "x86"; + meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ]; + + testConfig = ./x86.dhall; + testInputs = (map pkgs.genodeSources.depot [ + "acpi_drv" + "platform_drv" + "report_rom" + "test-signal" + ]) ++ (map pkgs.genodeSources.make [ "test/pci" "test/rtc" ]); +}