diff --git a/tests/default.nix b/tests/default.nix index 308b9fb..c726384 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -8,8 +8,7 @@ let libc = call ./libc.nix { }; log = call ./log.nix { }; signal = call ./signal.nix { }; - solo5 = call ./solo5.nix { }; - solo5-ping = call ./solo5-ping.nix { }; + solo5 = call ./solo5 { }; }; in { genodepkgs ? import ./../default.nix { }, nixpkgs ? import ./../nixpkgs.nix diff --git a/tests/solo5-ping.nix b/tests/solo5-ping.nix deleted file mode 100644 index bcf98ce..0000000 --- a/tests/solo5-ping.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ testEnv, pkgs }: -with pkgs; - -testEnv.mkTest rec { - name = "solo5"; - meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ]; - - testConfig = testEnv.lib.renderDhallInit ./solo5-ping.dhall "{=}"; - - bootModules = { - nic_bridge = "${genode.os}/bin/nic_bridge"; - nic_loopback = "${genode.os}/bin/nic_loopback"; - ping = "${genode.os}/bin/ping"; - "solo5.lib.so" = "${solo5}/lib/solo5-bindings-genode/solo5.lib.so"; - solo5-test_net = "${solo5.tests}/bin/solo5-test_net"; - }; - - testScript = '' - run_genode_until {child "ping" exited with exit value 0} 30 - ''; -} diff --git a/tests/solo5.dhall b/tests/solo5.dhall deleted file mode 100644 index f51c8db..0000000 --- a/tests/solo5.dhall +++ /dev/null @@ -1,45 +0,0 @@ -let Genode = env:DHALL_GENODE - -in λ(_ : {}) - → { nic = - Genode.Init.Start.defaults - ⫽ { binary = "nic_loopback", provides = [ "Nic" ] } - , block = - Genode.Init.Start.defaults - ⫽ { binary = "ram_block" - , provides = [ "Block" ] - , resources = { caps = 96, ram = Genode.units.MiB 9 } - , config = - Genode.Prelude.XML.text - '' - - '' - } - , test = - Genode.Init.Start.defaults - ⫽ { binary = "sequence" - , resources = { caps = 256, ram = Genode.units.MiB 10 } - , routes = - [ Genode.ServiceRoute.parent "Timer" - , Genode.ServiceRoute.child "Block" "block" - , Genode.ServiceRoute.child "Nic" "nic" - ] - , config = - Genode.Prelude.XML.text - '' - - - - Hello_Solo5 - - - - - - - - - - '' - } - } diff --git a/tests/solo5.nix b/tests/solo5.nix deleted file mode 100644 index ca521ff..0000000 --- a/tests/solo5.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ testEnv, pkgs }: -with pkgs; - -testEnv.mkTest rec { - name = "solo5"; - meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ]; - - testConfig = testEnv.lib.renderDhallInit ./solo5.dhall "{=}"; - - bootModules = { - sequence = "${genode.os}/bin/sequence"; - solo5-test_blk = "${solo5.tests}/bin/solo5-test_blk"; - solo5-test_fpu = "${solo5.tests}/bin/solo5-test_fpu"; - solo5-test_globals = "${solo5.tests}/bin/solo5-test_globals"; - solo5-test_hello = "${solo5.tests}/bin/solo5-test_hello"; - solo5-test_quiet = "${solo5.tests}/bin/solo5-test_quiet"; - solo5-test_ssp = "${solo5.tests}/bin/solo5-test_ssp"; - "solo5.lib.so" = "${solo5}/lib/solo5-bindings-genode/solo5.lib.so"; - nic_loopback = "${genode.os}/bin/nic_loopback"; - ram_block = "${genode.os}/bin/ram_block"; - }; - - testScript = '' - run_genode_until "Error: stack protector check failed" 30 - ''; -} diff --git a/tests/solo5/blk.dhall b/tests/solo5/blk.dhall new file mode 100644 index 0000000..b0d34d3 --- /dev/null +++ b/tests/solo5/blk.dhall @@ -0,0 +1,24 @@ +let Genode = env:DHALL_GENODE + +in λ(_ : {}) + → { solo5 = + Genode.Init.Start.defaults + ⫽ { binary = "test" + , resources = { caps = 256, ram = Genode.units.MiB 3 } + , routes = + [ Genode.ServiceRoute.parent "Timer" + , Genode.ServiceRoute.child "Block" "block" + ] + } + , block = + Genode.Init.Start.defaults + ⫽ { binary = "ram_block" + , provides = [ "Block" ] + , resources = { caps = 96, ram = Genode.units.MiB 9 } + , config = + Genode.Prelude.XML.text + '' + + '' + } + } diff --git a/tests/solo5/default.nix b/tests/solo5/default.nix new file mode 100644 index 0000000..3ef5dd8 --- /dev/null +++ b/tests/solo5/default.nix @@ -0,0 +1,161 @@ +{ testEnv, pkgs }: +with pkgs; + +let + defaultScript = '' + run_genode_until {child "solo5" exited with exit value 0} 30 + ''; + + mkTest' = { name, bootModules, testScript ? defaultScript, ... }@attrs: + testEnv.mkTest (attrs // { + name = "solo5-" + name; + inherit testScript; + bootModules = { + "solo5.lib.so" = "${solo5}/lib/solo5-bindings-genode/solo5.lib.so"; + } // bootModules; + meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ehmry ]; + }); + + applyMkTest = x: { + inherit (x) name; + value = mkTest' x; + }; + + mkTests = testList: builtins.listToAttrs (map applyMkTest testList); + + tests = [ + { + name = "blk"; + bootModules = { + test = "${solo5.tests}/bin/solo5-test_blk"; + ram_block = "${genode.os}/bin/ram_block"; + }; + testConfig = testEnv.lib.renderDhallInit ./blk.dhall "{=}"; + } + + /* { + name = "dumpcore"; + bootModules.test = "${solo5.tests}/bin/solo5-test_dumpcore"; + testConfig = testEnv.lib.renderDhallInit ./simple.dhall "{=}"; + } + */ + + /* { + name = "exception"; + bootModules.test = "${solo5.tests}/bin/solo5-test_exception"; + testConfig = testEnv.lib.renderDhallInit ./simple.dhall "{=}"; + } + */ + + { + name = "fpu"; + bootModules.test = "${solo5.tests}/bin/solo5-test_fpu"; + testConfig = testEnv.lib.renderDhallInit ./simple.dhall "{=}"; + } + + { + name = "globals"; + bootModules.test = "${solo5.tests}/bin/solo5-test_globals"; + testConfig = testEnv.lib.renderDhallInit ./simple.dhall "{=}"; + } + + { + name = "hello"; + bootModules.test = "${solo5.tests}/bin/solo5-test_hello"; + testConfig = testEnv.lib.renderDhallInit ./simple.dhall "{=}"; + } + + /* { + name = "mft_maxdevices"; + bootModules = { + test = "${solo5.tests}/bin/solo5-test_mft_maxdevices"; + rom_block = "${genode.os}/bin/rom_block"; + }; + testConfig = testEnv.lib.renderDhallInit ./mft_maxdevices.dhall "{=}"; + } + */ + + { + name = "net"; + bootModules = { + test = "${solo5.tests}/bin/solo5-test_net"; + nic_bridge = "${genode.os}/bin/nic_bridge"; + nic_loopback = "${genode.os}/bin/nic_loopback"; + ping = "${genode.os}/bin/ping"; + }; + testConfig = testEnv.lib.renderDhallInit ./net.dhall "{=}"; + testScript = '' + run_genode_until {child "ping" exited with exit value 0} 30 + ''; + } + + { + name = "net_2if"; + bootModules = { + test = "${solo5.tests}/bin/solo5-test_net_2if"; + sequence = "${genode.os}/bin/sequence"; + nic_bridge = "${genode.os}/bin/nic_bridge"; + nic_loopback = "${genode.os}/bin/nic_loopback"; + ping = "${genode.os}/bin/ping"; + }; + testConfig = testEnv.lib.renderDhallInit ./net_2if.dhall "{=}"; + testScript = '' + run_genode_until {child "clients" exited with exit value 0} 30 + ''; + qemuMem = 64; + } + + /* { + name = "notls"; + bootModules = { test = "${solo5.tests}/bin/solo5-test_notls"; }; + testConfig = testEnv.lib.renderDhallInit ./simple.dhall "{=}"; + } + */ + + { + name = "quiet"; + bootModules = { test = "${solo5.tests}/bin/solo5-test_quiet"; }; + testConfig = testEnv.lib.renderDhallInit ./simple.dhall "{=}"; + } + + { + name = "ssp"; + bootModules = { test = "${solo5.tests}/bin/solo5-test_ssp"; }; + testConfig = testEnv.lib.renderDhallInit ./simple.dhall "{=}"; + testScript = '' + run_genode_until {Error: stack protector check failed} 30 + ''; + } + + /* { + name = "wnox"; + bootModules = { test = "${solo5.tests}/bin/solo5-test_wnox"; }; + testConfig = testEnv.lib.renderDhallInit ./simple.dhall "{=}"; + } + */ + + /* { + name = "xnow"; + bootModules = { test = "${solo5.tests}/bin/solo5-test_xnow"; }; + testConfig = testEnv.lib.renderDhallInit ./simple.dhall "{=}"; + } + */ + + /* { + name = "zeropage"; + bootModules = { test = "${solo5.tests}/bin/solo5-test_zeropage"; }; + testConfig = testEnv.lib.renderDhallInit ./simple.dhall "{=}"; + } + */ + ] ++ (testEnv.lib.optional (!testEnv.isLinux) { + name = "time"; + bootModules = { + test = "${solo5.tests}/bin/solo5-test_time"; + rtc_drv = "${genode.os}/bin/rtc_drv"; + }; + testConfig = testEnv.lib.renderDhallInit ./time.dhall "{=}"; + } + + ); + +in mkTests tests diff --git a/tests/solo5-ping.dhall b/tests/solo5/net.dhall similarity index 92% rename from tests/solo5-ping.dhall rename to tests/solo5/net.dhall index d8240db..40bccb7 100644 --- a/tests/solo5-ping.dhall +++ b/tests/solo5/net.dhall @@ -14,14 +14,14 @@ in λ(_ : {}) Genode.Prelude.XML.text '' - + '' } - , ping_serve = + , solo5 = Genode.Init.Start.defaults - ⫽ { binary = "solo5-test_net" + ⫽ { binary = "test" , resources = { caps = 256, ram = Genode.units.MiB 3 } , routes = [ Genode.ServiceRoute.parent "Timer" diff --git a/tests/solo5/net_2if.dhall b/tests/solo5/net_2if.dhall new file mode 100644 index 0000000..ad0e1f7 --- /dev/null +++ b/tests/solo5/net_2if.dhall @@ -0,0 +1,63 @@ +let Genode = env:DHALL_GENODE + +in λ ( _ + : {} + ) + → { nic = + Genode.Init.Start.defaults + ⫽ { binary = "nic_loopback", provides = [ "Nic" ] } + , bridge = + Genode.Init.Start.defaults + ⫽ { binary = "nic_bridge" + , resources = { caps = 200, ram = Genode.units.MiB 8 } + , provides = [ "Nic" ] + , routes = [ Genode.ServiceRoute.child "Nic" "nic" ] + , config = + Genode.Prelude.XML.text + '' + + + + + + '' + } + , solo5 = + Genode.Init.Start.defaults + ⫽ { binary = "test" + , resources = { caps = 256, ram = Genode.units.MiB 4 } + , routes = + [ Genode.ServiceRoute.parent "Timer" + , Genode.ServiceRoute.child "Nic" "bridge" + ] + , config = + Genode.Prelude.XML.text + '' + limit + '' + } + , clients = + Genode.Init.Start.defaults + ⫽ { binary = + "sequence" + , resources = { caps = 256, ram = Genode.units.MiB 8 } + , routes = + [ Genode.ServiceRoute.parent "Timer" + , Genode.ServiceRoute.child "Nic" "bridge" + ] + , config = + Genode.Prelude.XML.text + '' + + + + + + + + + + + '' + } + } diff --git a/tests/solo5/simple.dhall b/tests/solo5/simple.dhall new file mode 100644 index 0000000..700d14e --- /dev/null +++ b/tests/solo5/simple.dhall @@ -0,0 +1,17 @@ +let Genode = env:DHALL_GENODE + +in λ(_ : {}) + → { solo5 = + Genode.Init.Start.defaults + ⫽ { binary = "test" + , resources = { caps = 256, ram = Genode.units.MiB 3 } + , routes = [ Genode.ServiceRoute.parent "Timer" ] + , config = + Genode.Prelude.XML.text + '' + + Hello_Solo5 + + '' + } + } diff --git a/tests/solo5/time.dhall b/tests/solo5/time.dhall new file mode 100644 index 0000000..969bd1a --- /dev/null +++ b/tests/solo5/time.dhall @@ -0,0 +1,21 @@ +let Genode = env:DHALL_GENODE + +in λ(_ : {}) + → { solo5 = + Genode.Init.Start.defaults + ⫽ { binary = "test" + , resources = { caps = 256, ram = Genode.units.MiB 3 } + , routes = + [ Genode.ServiceRoute.parent "Timer" + , Genode.ServiceRoute.child "Rtc" "clock" + ] + } + , clock = + Genode.Init.Start.defaults + ⫽ { binary = "rtc_drv" + , provides = [ "Rtc" ] + , routes = + [ Genode.ServiceRoute.parent "IO_PORT" + ] + } + }