From 05d807db7554f121b52b54a2f0e57719466b4f70 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Mon, 8 Jul 2013 10:58:40 +0200 Subject: [PATCH] run: split native Genode netperf script Split the netperf run script into 3 ones so that it can be used more easily in an automated run. netperf.run - use native nic driver (x86) or usb2.0 (arndale, panda) netperf_usb30.run - use native nic driver (x86) or usb3.0 netperf_bridge.run - use native nic driver (x86) or usb3.0 (arndale) and bridge Issue #794 --- ports/run/netperf.inc | 260 ++++++++++++++++++++++++++++++++++ ports/run/netperf.run | 261 +---------------------------------- ports/run/netperf_bridge.run | 24 ++++ ports/run/netperf_usb30.run | 24 ++++ 4 files changed, 315 insertions(+), 254 deletions(-) create mode 100644 ports/run/netperf.inc create mode 100644 ports/run/netperf_bridge.run create mode 100644 ports/run/netperf_usb30.run diff --git a/ports/run/netperf.inc b/ports/run/netperf.inc new file mode 100644 index 000000000..4bc9ebd3a --- /dev/null +++ b/ports/run/netperf.inc @@ -0,0 +1,260 @@ +# +# \brief Test for using netperf +# \author Alexander Boettcher +# \date 2013-04-18 +# + + +# +# Build +# + +set version "2.6.0" + +# sanity check that the right version is used +set wrong_version [catch { + spawn netperf-$version -V + expect { + {Netperf version 2.6.0} { } + eof { return } + timeout { return } + } +}] + +if {$wrong_version} { + puts -nonewline "\nPlease compile a netperf client of version $version " + puts "for your host system." + puts "The sources are available in 'ports/contrib/netperf'." + puts "Please name the binary netperf-$version\n" + exit 1; +} + +# netperf configuration +set packet_size 1024 +set netperf_tests "TCP_STREAM TCP_MAERTS" + +# start run script generation +set use_usb_driver [expr [have_spec omap4] || [have_spec exynos5]] +set use_nic_driver [expr !$use_usb_driver] +set use_platform_driver [expr $use_usb_driver && [have_spec platform_arndale]] +if {$use_usb_driver} { set network_driver "usb_drv" } +if {$use_nic_driver} { set network_driver "nic_drv" } + +set build_components { + core init + drivers/pci drivers/timer drivers/nic + app/netperf +} + +lappend_if $use_usb_driver build_components drivers/usb +lappend_if $use_platform_driver build_components drivers/platform +lappend_if $use_nic_bridge build_components server/nic_bridge +lappend_if [have_spec acpi] build_components drivers/acpi +lappend_if [have_spec pci] build_components drivers/pci/device_pd + +build $build_components + +create_boot_directory + +# +# Generate config +# + +set config { + + + + + + + + + + + + + + + + + + + + + + } + +append_if $use_platform_driver config { + + + + } + +append_if $use_nic_bridge config { + + + + + + } +append_if $use_nic_bridge config " + " +append_if $use_nic_bridge config { + + + + } + +append_if $use_usb_driver config { + + + + + } +append_if $use_usb_driver config " + " +append_if $use_usb_driver config { + + + } + +append_if $use_nic_driver config { + + + + } + +append_if [have_spec acpi] config { + + + + + + + + + + + + } + +append_if [expr ![have_spec acpi] && [have_spec pci]] config { + + + + } + +append config { + + + + + + + + } +append_if $use_nic_bridge config { + + + + } +append config { + + +} + +install_config $config + +# +# Boot modules +# + +# generic modules +set boot_modules { + core init timer + ld.lib.so libc.lib.so libm.lib.so + lwip.lib.so libc_log.lib.so + netserver_genode +} + +lappend_if $use_nic_bridge boot_modules nic_bridge + +# platform-specific modules +lappend_if $use_platform_driver boot_modules platform_drv +lappend_if [have_spec acpi] boot_modules acpi_drv +lappend_if [have_spec pci] boot_modules pci_drv +lappend_if $use_usb_driver boot_modules usb_drv +lappend_if $use_nic_driver boot_modules nic_drv +lappend_if [have_spec nova] boot_modules pci_device_pd + +build_boot_image $boot_modules + +# +# Execute test case +# + +# qemu config +append qemu_args " -m 128 " + +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:12865::12865 -redir tcp:49153::49153 " + +run_genode_until {.*and family AF_INET.*} 30 +set serial_id $spawn_id + +set force_ports "" +if [is_qemu_available] { + set ip_addr "localhost" + set force_ports "-P 49153,49153" +} else { + set match_string "got IP address (\[0-9\]+\.\[0-9\]+\.\[0-9\]+\.\[0-9\]+)" + regexp $match_string $output all ip_addr + puts "" +} + +# start netperf client connecting to netperf server running native on Genode +foreach netperf_test $netperf_tests { + puts "\n---------------------------- $netperf_test -----------------------" + + spawn netperf-$version -H $ip_addr -P 1 -v 2 -t $netperf_test -c -C -- -m $packet_size $force_ports + set netperf_id $spawn_id + + run_genode_until "Segment" 60 $netperf_id + + # get throughput from netperf output + set throughput [regexp -all -inline {([0-9]+[ ]+){3}[0-9]+\.[0-9]+[ ]+[0-9]+\.[0-9]+} $output] + set throughput [regexp -all -inline {[0-9]+\.[0-9]+} $throughput] + + # calculate packets per second rate + set all_bytes [regexp -all -inline {([0-9]+[ ]+){5}} $output] + set all_bytes [lindex $all_bytes 0 4] + + set elapsed_time [regexp -all -inline {([0-9]+[ ]+){3}[0-9]+\.[0-9]+[ ]+} $output] + set elapsed_time [lindex $elapsed_time 0 3] + set packets_second [expr $all_bytes / $packet_size / $elapsed_time] + + puts "\ncalculation: overall bytes / size per packet / time = packets per second" + puts -nonewline " $all_bytes Bytes / $packet_size Bytes / $elapsed_time s = " + puts "[format %8.0f $packets_second] packets/s\n" + + # format output parseable for post proccessing scripts + foreach i {0 1} { + puts -nonewline "! PERF: $netperf_test" + if {$use_nic_bridge} { puts -nonewline "_bridge" } + if {$use_usb_driver} { + if {![string compare $use_usb_11 "yes"]} { puts -nonewline "_uhci" } + if {![string compare $use_usb_20 "yes"]} { puts -nonewline "_ohci" } + if {![string compare $use_usb_30 "yes"]} { puts -nonewline "_xhci" } + } + if {$i == 0} { puts -nonewline " [lindex $throughput 1] MBit/s ok" } + if {$i == 1} { puts -nonewline "_packet_$packet_size [format %6.0f $packets_second] packets/s ok" } + if {$i > 1} { puts -nonewline " 0 unknown err" } + puts "" + } +} + + +puts "\nTest succeeded" +# vi: set ft=tcl : diff --git a/ports/run/netperf.run b/ports/run/netperf.run index 09ee4eb7d..c7163c2cf 100644 --- a/ports/run/netperf.run +++ b/ports/run/netperf.run @@ -1,266 +1,19 @@ # -# \brief Test for using netperf +# \brief Test using netperf with a native driver or if not available for +# the platform using usb 2.0 by default # \author Alexander Boettcher -# \date 2013-04-18 +# \date 2013-07-08 # - -# -# Build -# - -set version "2.6.0" - -# sanity check that the right version is used -set wrong_version [catch { - spawn netperf-$version -V - expect { - {Netperf version 2.6.0} { } - eof { return } - timeout { return } - } -}] - -if {$wrong_version} { - puts -nonewline "\nPlease compile a netperf client of version $version " - puts "for your host system." - puts "The sources are available in 'ports/contrib/netperf'." - puts "Please name the binary netperf-$version\n" - exit 1; +if {[is_qemu_available]} { + puts "\nNetperf running on Qemu is not recommented.\n" + exit } -# netperf configuration -set packet_size 1024 -set netperf_tests "TCP_STREAM TCP_MAERTS" - # network configuration set use_nic_bridge 0 set use_usb_11 "no" set use_usb_20 "yes" set use_usb_30 "no" -# start run script generation -set use_usb_driver [expr [have_spec omap4] || [have_spec exynos5]] -set use_nic_driver [expr !$use_usb_driver] -set use_platform_driver [expr $use_usb_driver && [have_spec foc_arndale]] -if {$use_usb_driver} { set network_driver "usb_drv" } -if {$use_nic_driver} { set network_driver "nic_drv" } - -set build_components { - core init - drivers/pci drivers/timer drivers/nic - app/netperf -} - -lappend_if $use_usb_driver build_components drivers/usb -lappend_if $use_platform_driver build_components drivers/platform -lappend_if $use_nic_bridge build_components server/nic_bridge -lappend_if [have_spec acpi] build_components drivers/acpi -lappend_if [have_spec pci] build_components drivers/pci/device_pd - -build $build_components - -create_boot_directory - -# -# Generate config -# - -set config { - - - - - - - - - - - - - - - - - - - - - - } - -append_if $use_platform_driver config { - - - - } - -append_if $use_nic_bridge config { - - - - - - } -append_if $use_nic_bridge config " - " -append_if $use_nic_bridge config { - - - - } - -append_if $use_usb_driver config { - - - - - } -append_if $use_usb_driver config " - " -append_if $use_usb_driver config { - - - } - -append_if $use_nic_driver config { - - - - } - -append_if [have_spec acpi] config { - - - - - - - - - - - - } - -append_if [expr ![have_spec acpi] && [have_spec pci]] config { - - - - } - -append config { - - - - - - - - } -append_if $use_nic_bridge config { - - - - } -append config { - - -} - -install_config $config - -# -# Boot modules -# - -# generic modules -set boot_modules { - core init timer - ld.lib.so libc.lib.so libm.lib.so - lwip.lib.so libc_log.lib.so - netserver_genode -} - -lappend_if $use_nic_bridge boot_modules nic_bridge - -# platform-specific modules -lappend_if $use_platform_driver boot_modules platform_drv -lappend_if [have_spec acpi] boot_modules acpi_drv -lappend_if [have_spec pci] boot_modules pci_drv -lappend_if $use_usb_driver boot_modules usb_drv -lappend_if $use_nic_driver boot_modules nic_drv -lappend_if [have_spec nova] boot_modules pci_device_pd - -build_boot_image $boot_modules - -# -# Execute test case -# - -# qemu config -append qemu_args " -m 128 " - -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:12865::12865 -redir tcp:49153::49153 " - -run_genode_until {.*and family AF_INET.*} 30 -set serial_id $spawn_id - -set force_ports "" -if [is_qemu_available] { - set ip_addr "localhost" - set force_ports "-P 49153,49153" -} else { - set match_string "got IP address (\[0-9\]+\.\[0-9\]+\.\[0-9\]+\.\[0-9\]+)" - regexp $match_string $output all ip_addr - puts "" -} - -# start netperf client connecting to netperf server running native on Genode -foreach netperf_test $netperf_tests { - puts "\n---------------------------- $netperf_test -----------------------" - - spawn netperf-$version -H $ip_addr -P 1 -v 2 -t $netperf_test -c -C -- -m $packet_size $force_ports - set netperf_id $spawn_id - - run_genode_until "Segment" 60 $netperf_id - - # get throughput from netperf output - set throughput [regexp -all -inline {([0-9]+[ ]+){3}[0-9]+\.[0-9]+[ ]+[0-9]+\.[0-9]+} $output] - set throughput [regexp -all -inline {[0-9]+\.[0-9]+} $throughput] - - # calculate packets per second rate - set all_bytes [regexp -all -inline {([0-9]+[ ]+){5}} $output] - set all_bytes [lindex $all_bytes 0 4] - - set elapsed_time [regexp -all -inline {([0-9]+[ ]+){3}[0-9]+\.[0-9]+[ ]+} $output] - set elapsed_time [lindex $elapsed_time 0 3] - set packets_second [expr $all_bytes / $packet_size / $elapsed_time] - - puts "\ncalculation: overall bytes / size per packet / time = packets per second" - puts -nonewline " $all_bytes Bytes / $packet_size Bytes / $elapsed_time s = " - puts "[format %8.0f $packets_second] packets/s\n" - - # format output parseable for post proccessing scripts - foreach i {0 1} { - puts -nonewline "! PERF: $netperf_test" - if {$use_nic_bridge} { puts -nonewline "_bridge" } - if {$use_usb_driver} { - if {![string compare $use_usb_11 "yes"]} { puts -nonewline "_uhci" } - if {![string compare $use_usb_20 "yes"]} { puts -nonewline "_ohci" } - if {![string compare $use_usb_30 "yes"]} { puts -nonewline "_xhci" } - } - if {$i == 0} { puts -nonewline " [lindex $throughput 1] MBit/s ok" } - if {$i == 1} { puts -nonewline "_packet_$packet_size [format %6.0f $packets_second] packets/s ok" } - if {$i > 1} { puts -nonewline " 0 unknown err" } - puts "" - } -} - - -puts "\nTest succeeded" -# vi: set ft=tcl : +source ${genode_dir}/ports/run/netperf.inc diff --git a/ports/run/netperf_bridge.run b/ports/run/netperf_bridge.run new file mode 100644 index 000000000..841cf88c8 --- /dev/null +++ b/ports/run/netperf_bridge.run @@ -0,0 +1,24 @@ +# +# \brief Test using netperf with a network bridge and with a native driver or +# if not available for the platform using usb 3.0 by default +# \author Alexander Boettcher +# \date 2013-07-08 +# + +if {[is_qemu_available]} { + puts "\nNetperf running on Qemu with a bridge is not supported.\n" + exit +} + +if {[have_spec omap4]} { + puts stderr "\nTest requires 1 Gbit network interface - not supported for omap4\n" + exit 0 +} + +# network configuration +set use_nic_bridge 1 +set use_usb_11 "no" +set use_usb_20 "no" +set use_usb_30 "yes" + +source ${genode_dir}/ports/run/netperf.inc diff --git a/ports/run/netperf_usb30.run b/ports/run/netperf_usb30.run new file mode 100644 index 000000000..eda434586 --- /dev/null +++ b/ports/run/netperf_usb30.run @@ -0,0 +1,24 @@ +# +# \brief Test using netperf with a native driver or if not available for +# the platform using usb 3.0 by default +# \author Alexander Boettcher +# \date 2013-07-08 +# + +if {[is_qemu_available]} { + puts "\nNetperf running on Qemu is not recommented.\n" + exit +} + +if {[have_spec omap4]} { + puts stderr "\nTest requires 1 Gbit network interface - not supported for omap4\n" + exit 0 +} + +# network configuration +set use_nic_bridge 0 +set use_usb_11 "no" +set use_usb_20 "no" +set use_usb_30 "yes" + +source ${genode_dir}/ports/run/netperf.inc