set use_usb_driver [expr [have_spec omap4] || [have_spec exynos5]] set use_nic_driver [expr !$use_usb_driver && ![have_spec platform_imx53] && ![have_spec linux]] set use_platform_drv [expr [have_spec platform_arndale] || [have_spec platform_imx53]] if {[expr !$use_usb_driver && !$use_nic_driver]} { puts "\n Run script is not supported on this platform. \n"; exit 0 } set build_components { core init drivers/timer drivers/pci server/tcp_terminal server/nic_bridge noux/net lib/libc_noux noux-pkg/netcat } lappend_if $use_usb_driver build_components drivers/usb lappend_if $use_nic_driver build_components drivers/nic lappend_if [have_spec acpi] build_components drivers/acpi lappend_if [have_spec pci] build_components drivers/pci/device_pd lappend_if [have_spec gpio] build_components drivers/gpio lappend_if [is_qemu_available] build_components drivers/uart lappend_if $use_platform_drv build_components drivers/platform build $build_components exec tar cfv bin/noux_netcat.tar -h -C bin/netcat . # # The '/bin/etc/' directory is expected to contain the # files 'services', 'protocols', 'hosts', and 'resolv.conf'. # Download these files from the FreeBSD source tree is possible. # exec mkdir -p bin/etc set freebsd_url "http://svn.freebsd.org/base/release/8.2.0/etc" foreach etc_file { services protocols hosts } { if {![file exists bin/etc/$etc_file]} { catch { exec wget -c -P bin/etc $freebsd_url/$etc_file } } } exec touch bin/etc/resolv.conf exec tar rfv bin/noux_netcat.tar -h -C bin/ etc create_boot_directory append config { } append_if [is_qemu_available] config { } if {![is_qemu_available]} { append config { } append_if $use_nic_driver config { } append_if $use_usb_driver config { } append config { } } append_if $use_nic_driver config { } append_if $use_platform_drv config { } append_if [have_spec gpio] config { } append_if $use_usb_driver config { } append_if [have_spec acpi] config { } append_if [expr ![have_spec acpi] && [have_spec pci]] config { } append config { } append_if [expr ![is_qemu_available]] config { } append config { } install_config $config # # Boot modules # # generic modules set boot_modules { core init timer tcp_terminal nic_bridge ld.lib.so noux_net libc.lib.so libm.lib.so libc_lock_pipe.lib.so libc_log.lib.so libc_resolv.lib.so libc_noux.lib.so lwip.lib.so noux_netcat.tar } # platform-specific modules lappend_if $use_nic_driver boot_modules nic_drv lappend_if $use_usb_driver boot_modules usb_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 lappend_if [is_qemu_available] boot_modules uart_drv lappend_if $use_platform_drv boot_modules platform_drv lappend_if [have_spec gpio] boot_modules gpio_drv build_boot_image $boot_modules set noux_output_file "noux_output.log" set serial_ip_addr "localhost" set noux_ip_addr "localhost" 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. 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 qemu_args " -net user -redir tcp:5555::5555 " run_genode_until {.*got IP address.*\n} 60 set serial_id $spawn_id } else { run_genode_until {\[init -> tcp_terminal\] listening on port 8888\.\.\.} 60 set serial_id $spawn_id regexp {\[init -> noux_net\] .{1,5}got IP address [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+} $output noux_ip_addr regexp {[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+} $noux_ip_addr noux_ip_addr regexp {\[init -> tcp_terminal\] .{1,5}got IP address [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+} $output serial_ip_addr regexp {[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+} $serial_ip_addr serial_ip_addr # connect to Genode target and reading log output via network connection spawn socat -u tcp:$serial_ip_addr:8888 OPEN:$noux_output_file,creat,append } sleep 4 puts "--- serial '$serial_ip_addr' noux '$noux_ip_addr'" exec echo -e "Hello Genode" | netcat $noux_ip_addr 5555 & run_genode_until {exited with exit value 1} 20 $serial_id sleep 4 set output [exec cat $noux_output_file] puts "\noutput:\n$output\n" exec rm $noux_output_file exec rm bin/noux_netcat.tar exec rm -r bin/etc if {![regexp {Hello Genode} $output dummy]} { puts stderr "Error: output not as expected" exit 1 } puts "Test succeeded"