if {[have_spec linux]} { puts "\nLinux not supported because of missing UART driver\n" exit 0 } 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 . # # 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 [have_spec acpi] config { } append_if [expr ![have_spec acpi] && [have_spec pci]] config { } append config { } install_config $config # # Boot modules # # generic modules set boot_modules { core init timer uart_drv nic_drv ld.lib.so noux_net libc.lib.so libm.lib.so libc_resolv.lib.so libc_noux.lib.so lwip.lib.so noux_netcat.tar } # platform-specific modules 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 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_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 sleep 2 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 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 if {![regexp {Hello Genode} $output dummy]} { puts stderr "Error: output not as expected" exit 1 } puts "Test succeeded"