2
0
Fork 0

tests: consolidate rtc and pci into x86 test

This commit is contained in:
Ehmry - 2020-04-26 10:45:21 +05:30
parent 0905b0e0a5
commit f2defbb7cd
14 changed files with 54 additions and 66 deletions

View File

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

View File

@ -23,6 +23,8 @@ with ports; {
buildInputs = with buildPackages; [ zlib ];
};
"test-pci".patches = [ ./test-pci.patch ];
usb_drv.portInputs = [ dde_linux ];
vbox5 = {

View File

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

View File

@ -32,8 +32,7 @@ let
((tests call) // {
driver_manager = call ./driver_manager.nix { };
noux = call ./noux.nix { };
pci = call ./pci.nix { };
rtc = call ./rtc.nix { };
x86 = call ./x86.nix { };
})) (import ./driver-nova.nix {
inherit apps addManifest buildPackages depot lib nixpkgs testPkgs;
}).callTest;
@ -41,8 +40,7 @@ let
hw = (call:
((tests call) // {
# noux = call ./noux.nix { };
pci = call ./pci.nix { };
rtc = call ./rtc.nix { };
x86 = call ./x86.nix { };
})) (import ./driver-hw.nix {
inherit apps addManifest buildPackages depot lib nixpkgs testPkgs;
}).callTest;

View File

@ -40,8 +40,9 @@ let
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";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,7 +16,17 @@ let ServiceRoute = Init.ServiceRoute
let label = λ(_ : Text) → { local = _, route = _ } : Child.Attributes.Label
let init =
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 +84,4 @@ let init =
}
}
in Test::{ children = Test.initToChildren init }
in Test::{ children = toMap { rtc = rtc } # Test.initToChildren pciInit }

View File

@ -4,14 +4,11 @@
with pkgs;
testEnv.mkTest {
name = "pci";
name = "x86";
meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ];
testConfig = ./pci.dhall;
testConfig = ./x86.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
'';
++ (map pkgs.genodeSources.make [ "test/pci" "test/rtc" ]);
}