From 5249c0875cdc9f72537ca53a2647d307da5fd979 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Fri, 8 Mar 2013 10:45:44 +0100 Subject: [PATCH] run: extend noux to run automatically natively --- ports/run/noux.run | 28 ++++++----- ports/run/noux_net_netcat.run | 78 +++++++++++++++++++++--------- ports/run/noux_tool_chain.inc | 31 +++++++++--- ports/run/noux_tool_chain_auto.run | 29 +++++++++++ ports/run/noux_tool_chain_foc.run | 4 ++ ports/run/noux_tool_chain_nova.run | 4 ++ 6 files changed, 133 insertions(+), 41 deletions(-) create mode 100644 ports/run/noux_tool_chain_auto.run diff --git a/ports/run/noux.run b/ports/run/noux.run index 753c1915f..4c12258e1 100644 --- a/ports/run/noux.run +++ b/ports/run/noux.run @@ -55,26 +55,30 @@ build_boot_image { libc_noux.lib.so coreutils.tar } -# -# Redirect the output of Noux via the virtual serial port 1 into a file to be -# dumped after the successful completion of the test. -# -set noux_output_file "noux_output.log" +if {[is_qemu_available]} { + # + # Redirect the output of Noux via the virtual serial port 1 into a file to be + # dumped after the successful completion of the test. + # + set noux_output_file "noux_output.log" -append qemu_args " -nographic" -append qemu_args " -serial mon:stdio" -append qemu_args " -serial file:$noux_output_file" + append qemu_args " -nographic" + append qemu_args " -serial mon:stdio" + append qemu_args " -serial file:$noux_output_file" -if {[have_spec x86_64]} { + if {[have_spec x86_64]} { # coreutils.tar is really huge when built for x86_64 append qemu_args " -m 300 " + } } run_genode_until "child /bin/ls exited with exit value 0.*\n" 30 -puts "[exec cat $noux_output_file]" +if {[is_qemu_available]} { + puts "[exec cat $noux_output_file]" -exec rm bin/coreutils.tar -exec rm $noux_output_file + exec rm bin/coreutils.tar + exec rm $noux_output_file +} puts "Test succeeded" diff --git a/ports/run/noux_net_netcat.run b/ports/run/noux_net_netcat.run index 43c4754cc..1a95cb0bb 100644 --- a/ports/run/noux_net_netcat.run +++ b/ports/run/noux_net_netcat.run @@ -3,13 +3,18 @@ if {[have_spec linux]} { exit 0 } -build { +set build_components { core init drivers/timer drivers/uart drivers/nic drivers/pci noux/net lib/libc_noux noux-pkg/netcat } +lappend_if [have_spec acpi] build_components drivers/acpi +lappend_if [have_spec pci] build_components drivers/pci/device_pd + +build $build_components + exec tar cfv bin/noux_netcat.tar -h -C bin/netcat . # @@ -62,11 +67,25 @@ append config { } -append_if [have_spec pci] config { +append_if [have_spec acpi] config { + + + + + + + + + + + + } + +append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - } + + } append config { @@ -96,40 +115,56 @@ set boot_modules { } # platform-specific modules -lappend_if [have_spec pci] boot_modules pci_drv +lappend_if [have_spec pci] boot_modules pci_drv +lappend_if [have_spec acpi] boot_modules acpi_drv +lappend_if [have_spec nova] boot_modules pci_device_pd build_boot_image $boot_modules -# -# Redirect the output of Noux via the virtual serial port 1 into a file to be -# dumped after the successful completion of the test. -# -set noux_output_file "noux_output.log" +if {![is_amt_available]} { + # + # Redirect the output of Noux via the virtual serial port 1 into a file to be + # dumped after the successful completion of the test. + # + set noux_output_file "noux_output.log" -append qemu_args " -nographic" -append qemu_args " -serial mon:stdio" -append qemu_args " -serial file:$noux_output_file" + append qemu_args " -nographic" + append qemu_args " -serial mon:stdio" + append qemu_args " -serial file:$noux_output_file" -append_if [have_spec x86] qemu_args " -net nic,model=e1000 " -append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 " + append_if [have_spec x86] qemu_args " -net nic,model=e1000 " + append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 " -append qemu_args " -net user -redir tcp:5555::5555 " + append qemu_args " -net user -redir tcp:5555::5555 " +} run_genode_until {.*got IP address.*\n} 60 sleep 2 -exec echo -e "Hello Genode" | netcat localhost 5555 +if [is_amt_available] { + set match_string "got IP address" + grep_output $match_string + unify_output {[\r\n\t]+} "" + unify_output {[\033]\[0m} "" + set pos [string first $match_string $output] + set ip_addr [string replace $output 0 [expr $pos+14]] +} else { + set ip_addr "localhost" +} + +exec echo -e "Hello Genode" | netcat $ip_addr 5555 sleep 1 -set output [exec cat $noux_output_file] - -puts "output:\n$output\n" +if {![is_amt_available]} { + set output [exec cat $noux_output_file] + puts "output:\n$output\n" + exec rm $noux_output_file +} exec rm bin/noux_netcat.tar exec rm -r bin/etc -exec rm $noux_output_file if {![regexp {Hello Genode} $output dummy]} { puts stderr "Error: output not as expected" @@ -137,4 +172,3 @@ if {![regexp {Hello Genode} $output dummy]} { } puts "Test succeeded" -exit 0 diff --git a/ports/run/noux_tool_chain.inc b/ports/run/noux_tool_chain.inc index 7613a7ca6..975e1af89 100644 --- a/ports/run/noux_tool_chain.inc +++ b/ports/run/noux_tool_chain.inc @@ -14,6 +14,9 @@ set build_components { test/libports/ncurses } +lappend_if [have_spec acpi] build_components drivers/acpi +lappend_if [have_spec pci] build_components drivers/pci/device_pd + set cc_march "" if {[have_spec arm]} { @@ -103,10 +106,18 @@ append_if [have_spec sdl] config { } -append_if [have_spec pci] config { - - - +append_if [have_spec acpi] config { + + + + + + + + + + + } append_if [have_spec framebuffer] config { @@ -115,6 +126,12 @@ append_if [have_spec framebuffer] config { } +append_if [expr ![have_spec acpi] && [have_spec pci]] config { + + + + } + append_if [have_spec ps2] config { @@ -239,9 +256,9 @@ lappend_if [have_spec linux] boot_modules fb_sdl lappend_if [have_spec pci] boot_modules pci_drv lappend_if [have_spec framebuffer] boot_modules fb_drv lappend_if [have_spec ps2] boot_modules ps2_drv +lappend_if [have_spec acpi] boot_modules acpi_drv +lappend_if [have_spec nova] boot_modules pci_device_pd build_boot_image $boot_modules -append qemu_args " -m 768 " - -run_genode_until forever +# vi: set ft=tcl : diff --git a/ports/run/noux_tool_chain_auto.run b/ports/run/noux_tool_chain_auto.run new file mode 100644 index 000000000..bd536b024 --- /dev/null +++ b/ports/run/noux_tool_chain_auto.run @@ -0,0 +1,29 @@ +# +# \brief Noux environment for building the Genode/NOVA demo scenario on Genode +# \author Christian Prochaska +# \date 2012-11-26 +# + +set platform "nova_x86_32" +set platform_base_dir "base-nova" +set platform_pkgs "" +set platform_cmds { + make core && + exit 234 +} + +source ${genode_dir}/ports/run/noux_tool_chain.inc + +append qemu_args " -m 768 " + +set time_start [ clock seconds ] + +run_genode_until {child /bin/bash exited with exit value 234} 600 + +set time_end [ clock seconds ] +set git_info [ exec git --git-dir=$genode_dir/.git describe ] + +puts "Testing \" [ clock format $time_start -format "%Y-%m-%d %H:%M:%S"], commit: ($git_info)\" in : " +puts "Testing \"all\" in printf.wv:" +puts "! PERF: runtime [expr $time_end - $time_start ] seconds ok" +puts "Test succeeded" diff --git a/ports/run/noux_tool_chain_foc.run b/ports/run/noux_tool_chain_foc.run index f83017aea..b432e0aa8 100644 --- a/ports/run/noux_tool_chain_foc.run +++ b/ports/run/noux_tool_chain_foc.run @@ -36,3 +36,7 @@ set platform_cmds { } source ${genode_dir}/ports/run/noux_tool_chain.inc + +append qemu_args " -m 768 " + +run_genode_until forever diff --git a/ports/run/noux_tool_chain_nova.run b/ports/run/noux_tool_chain_nova.run index 184d2ee00..df0fa18be 100644 --- a/ports/run/noux_tool_chain_nova.run +++ b/ports/run/noux_tool_chain_nova.run @@ -10,3 +10,7 @@ set platform_pkgs "" set platform_cmds "" source ${genode_dir}/ports/run/noux_tool_chain.inc + +append qemu_args " -m 768 " + +run_genode_until forever