2
0
Förgrening 0

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

This commit is contained in:
Emery Hemingway 2020-04-26 10:45:21 +05:30
förälder ae135e118d
incheckning 1400dded7e
18 ändrade filer med 105 tillägg och 125 borttagningar

Visa fil

@ -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 { };

Visa fil

@ -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 = {

Visa fil

@ -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);
}

Visa fil

@ -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)

Visa fil

@ -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;

Visa fil

@ -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";

Visa fil

@ -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}" \

Visa fil

@ -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" ]);

Visa fil

@ -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
'';
}

Visa fil

@ -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 }

Visa fil

@ -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";
}

Visa fil

@ -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" ]
}
}
}

Visa fil

@ -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";
}

Visa fil

@ -36,7 +36,6 @@ let
"nic_bridge"
"nic_loopback"
"sequence"
"rtc_drv"
]);
}

Visa fil

@ -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 }
]
}

Visa fil

@ -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"
]
}

Visa fil

@ -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
}

17
tests/x86.nix Normal file
Visa fil

@ -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" ]);
}