2016-08-25 15:48:53 +00:00
|
|
|
#
|
2017-02-11 02:51:44 +00:00
|
|
|
# Build components
|
2016-08-25 15:48:53 +00:00
|
|
|
#
|
|
|
|
|
2017-02-11 02:51:44 +00:00
|
|
|
proc enable_test_1 { } { return 1 }
|
|
|
|
proc enable_test_2 { } { return 1 }
|
|
|
|
proc enable_test_3 { } { return 1 }
|
|
|
|
proc enable_test_4 { } { return 1 }
|
|
|
|
proc enable_test_5 { } { return 1 }
|
|
|
|
proc enable_test_6 { } { return 1 }
|
2016-08-25 15:48:53 +00:00
|
|
|
|
2017-02-11 02:51:44 +00:00
|
|
|
source ${genode_dir}/repos/base/run/platform_drv.inc
|
2016-12-19 14:05:41 +00:00
|
|
|
|
2017-02-11 02:51:44 +00:00
|
|
|
proc nic_drv { } {
|
2017-03-09 13:03:46 +00:00
|
|
|
if {[nic_drv_binary] == "usb_drv"} { return usb_drv }
|
|
|
|
if {[nic_drv_binary] == ""} { return "" }
|
|
|
|
return nic_drv
|
2017-02-11 02:51:44 +00:00
|
|
|
}
|
2016-12-19 14:05:41 +00:00
|
|
|
|
2017-02-11 02:51:44 +00:00
|
|
|
proc gpio_drv { } {
|
|
|
|
if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
|
|
|
|
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
|
|
|
|
if {[have_spec gpio]} { return gpio_drv }
|
2016-08-25 15:48:53 +00:00
|
|
|
}
|
|
|
|
|
2017-02-11 02:51:44 +00:00
|
|
|
if {[nic_drv] == ""} {
|
|
|
|
puts "\n Run script is not supported on this platform. \n"; exit 0 }
|
2017-02-08 12:28:11 +00:00
|
|
|
|
2017-02-11 02:51:44 +00:00
|
|
|
proc nic_drv_build { } {
|
|
|
|
if {[nic_drv] == "nic_drv"} { return drivers/nic }
|
|
|
|
if {[nic_drv] == "usb_drv"} { return drivers/usb }
|
|
|
|
}
|
2016-08-25 15:48:53 +00:00
|
|
|
|
2017-02-23 11:12:28 +00:00
|
|
|
proc gpio_drv_build { } { if {[gpio_drv] != ""} { return drivers/gpio } }
|
2016-08-25 15:48:53 +00:00
|
|
|
|
2017-02-23 11:12:28 +00:00
|
|
|
build "core init drivers/timer server/nic_router server/nic_bridge
|
|
|
|
test/lwip/http_srv_static test/lwip/http_clnt test/lxip/udp_echo
|
|
|
|
test/lxip/udp_client [nic_drv_build] [gpio_drv_build]
|
|
|
|
[platform_drv_build_components]"
|
2016-08-25 15:48:53 +00:00
|
|
|
|
|
|
|
create_boot_directory
|
|
|
|
|
|
|
|
#
|
|
|
|
# Generate config
|
|
|
|
#
|
|
|
|
|
2017-02-11 02:51:44 +00:00
|
|
|
proc gpio_drv_config { } {
|
2017-02-23 11:12:28 +00:00
|
|
|
if {[have_spec gpio]} {
|
|
|
|
append result {
|
2017-08-30 09:49:56 +00:00
|
|
|
<start name="} [gpio_drv] {" caps="140" priority="-1">
|
2017-02-23 11:12:28 +00:00
|
|
|
<resource name="RAM" quantum="4M"/>
|
|
|
|
<provides><service name="Gpio"/></provides>
|
|
|
|
</start>}
|
|
|
|
return $result
|
|
|
|
}
|
2017-02-11 02:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
proc nic_drv_config { } {
|
2017-02-23 11:12:28 +00:00
|
|
|
if {[nic_drv] == "nic_drv"} {
|
|
|
|
append result {
|
2017-08-30 09:49:56 +00:00
|
|
|
<start name="nic_drv" priority="-1">
|
2017-03-09 13:03:46 +00:00
|
|
|
<binary name="} [nic_drv_binary] {"/>
|
2017-02-23 11:12:28 +00:00
|
|
|
<resource name="RAM" quantum="6M"/>
|
|
|
|
<provides><service name="Nic"/></provides>
|
|
|
|
</start>}
|
|
|
|
return $result
|
|
|
|
}
|
|
|
|
if {[nic_drv] == "usb_drv"} {
|
|
|
|
append result {
|
2017-08-30 09:49:56 +00:00
|
|
|
<start name="usb_drv" caps="120" priority="-1">
|
2017-03-20 10:17:49 +00:00
|
|
|
<resource name="RAM" quantum="14M"/>
|
2017-02-23 11:12:28 +00:00
|
|
|
<provides>
|
|
|
|
<service name="Nic"/>
|
|
|
|
</provides>
|
|
|
|
<config ehci="yes">
|
|
|
|
<nic mac="02:00:00:00:01:01" />
|
|
|
|
</config>
|
|
|
|
</start>}
|
|
|
|
return $result
|
|
|
|
}
|
2017-02-11 02:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
proc client_bin { prot } {
|
|
|
|
if {$prot == "udp"} { return "test-lxip_udp_client" }
|
|
|
|
if {$prot == "http"} { return "test-http_clnt" } }
|
|
|
|
|
|
|
|
proc server_bin { prot } {
|
|
|
|
if {$prot == "udp"} { return "test-lxip_udp_echo" }
|
|
|
|
if {$prot == "http"} { return "test-lwip_httpsrv_static" } }
|
|
|
|
|
2017-03-20 10:17:49 +00:00
|
|
|
proc ram_quota { prot } {
|
2017-06-22 16:47:02 +00:00
|
|
|
if {$prot == "udp"} { return 29M }
|
2017-03-20 10:17:49 +00:00
|
|
|
if {$prot == "http"} { return 12M }
|
|
|
|
}
|
|
|
|
|
2017-02-11 02:51:44 +00:00
|
|
|
proc client_config { prot index ip_addr gateway netmask nic srv_port srv_ip } {
|
2017-02-23 11:12:28 +00:00
|
|
|
append result {
|
2017-08-30 09:49:56 +00:00
|
|
|
<start name="} $prot {_client_} $index {" caps="200" priority="-1">
|
2017-02-11 02:51:44 +00:00
|
|
|
<binary name="} [client_bin $prot] {" />
|
2017-03-20 10:17:49 +00:00
|
|
|
<resource name="RAM" quantum="} [ram_quota $prot] {"/>
|
2017-02-11 02:51:44 +00:00
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="} $nic {"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
<config server_ip="} $srv_ip {" server_port="} $srv_port {">
|
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="} $ip_addr {"
|
|
|
|
gateway="} $gateway {" netmask="} $netmask {"/>
|
|
|
|
</config>
|
2017-02-23 11:12:28 +00:00
|
|
|
</start>}
|
|
|
|
return $result
|
2017-02-11 02:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
proc server_config { prot index ip_addr gateway netmask nic port } {
|
2017-02-23 11:12:28 +00:00
|
|
|
append result {
|
2017-08-30 09:49:56 +00:00
|
|
|
<start name="} $prot {_server_} $index {" caps="200" priority="-1">
|
2017-02-11 02:51:44 +00:00
|
|
|
<binary name="} [server_bin $prot] {" />
|
2017-03-20 10:17:49 +00:00
|
|
|
<resource name="RAM" quantum="} [ram_quota $prot] {"/>
|
2017-02-11 02:51:44 +00:00
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="} $nic {"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
<config port="} $port {">
|
|
|
|
<vfs> <dir name="dev"> <log/> </dir> </vfs>
|
|
|
|
<libc stdout="/dev/log" stderr="/dev/log" ip_addr="} $ip_addr {"
|
|
|
|
gateway="} $gateway {" netmask="} $netmask {"/>
|
|
|
|
</config>
|
2017-02-23 11:12:28 +00:00
|
|
|
</start>}
|
|
|
|
return $result
|
2017-02-11 02:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
proc test_1_config { } {
|
2017-02-23 11:12:28 +00:00
|
|
|
if {[enable_test_1]} { return "
|
|
|
|
[client_config udp 1 10.0.98.55 10.0.98.33 255.255.255.0 nic_router 1337 10.0.98.33]
|
|
|
|
[server_config udp 1 10.0.99.55 10.0.99.33 255.255.255.0 nic_router 1337 ]" }
|
2017-02-11 02:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
proc test_2_config { } {
|
2017-02-23 11:12:28 +00:00
|
|
|
if {[enable_test_2]} { return "
|
|
|
|
[client_config udp 2 10.0.2.212 10.0.2.1 255.255.255.0 nic_bridge 1 10.0.2.55]
|
|
|
|
[server_config udp 2 18.17.16.15 18.17.16.14 255.255.0.0 nic_router 1 ]" }
|
2017-02-11 02:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
proc test_3_config { } {
|
2017-02-23 11:12:28 +00:00
|
|
|
if {[enable_test_3]} { return "
|
|
|
|
[client_config udp 3 217.13.192.2 217.13.192.1 255.255.192.0 nic_router 65535 10.0.2.213]
|
|
|
|
[server_config udp 3 10.0.2.213 10.0.2.55 255.255.255.0 nic_bridge 65535 ]" }
|
2017-02-11 02:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
proc test_4_config { } {
|
2017-02-23 11:12:28 +00:00
|
|
|
if {[enable_test_4]} { return "
|
|
|
|
[client_config http 1 10.0.2.201 10.0.2.1 255.255.255.0 nic_bridge 80 10.0.2.55]
|
|
|
|
[server_config http 1 192.168.1.18 192.168.1.1 255.255.255.0 nic_router 80 ]" }
|
2017-02-11 02:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
proc test_5_config { } {
|
2017-02-23 11:12:28 +00:00
|
|
|
if {[enable_test_5]} { return "
|
|
|
|
[client_config http 2 10.0.2.202 10.0.2.1 255.255.255.0 nic_bridge 8080 10.0.2.55]
|
|
|
|
[server_config http 2 192.168.2.72 192.168.2.1 255.255.255.0 nic_router 8080 ]" }
|
2017-02-11 02:51:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
proc test_6_config { } {
|
2017-02-23 11:12:28 +00:00
|
|
|
if {[enable_test_6]} { return "
|
|
|
|
[client_config http 3 100.200.0.128 100.200.0.1 255.255.0.0 nic_router 2345 10.0.2.203]
|
|
|
|
[server_config http 3 10.0.2.203 10.0.2.1 255.255.255.0 nic_bridge 2345 ]" }
|
2017-02-11 02:51:44 +00:00
|
|
|
}
|
|
|
|
|
2017-02-23 11:12:28 +00:00
|
|
|
append config {
|
2017-08-30 09:49:56 +00:00
|
|
|
<config prio_levels="2">
|
2016-08-25 15:48:53 +00:00
|
|
|
<parent-provides>
|
|
|
|
<service name="ROM"/>
|
|
|
|
<service name="IRQ"/>
|
|
|
|
<service name="IO_MEM"/>
|
|
|
|
<service name="IO_PORT"/>
|
|
|
|
<service name="PD"/>
|
|
|
|
<service name="RM"/>
|
|
|
|
<service name="CPU"/>
|
|
|
|
<service name="LOG"/>
|
|
|
|
</parent-provides>
|
2017-02-11 02:51:44 +00:00
|
|
|
|
2016-08-25 15:48:53 +00:00
|
|
|
<default-route>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
2017-02-11 02:51:44 +00:00
|
|
|
</default-route>
|
2016-12-19 14:05:41 +00:00
|
|
|
|
2017-05-07 20:36:11 +00:00
|
|
|
<default caps="100"/>
|
|
|
|
|
2017-02-11 02:51:44 +00:00
|
|
|
} [gpio_drv_config] {
|
|
|
|
} [nic_drv_config] {
|
|
|
|
} [platform_drv_config] {
|
2016-08-25 15:48:53 +00:00
|
|
|
|
2017-08-30 09:49:56 +00:00
|
|
|
<start name="timer" priority="0">
|
2016-08-25 15:48:53 +00:00
|
|
|
<resource name="RAM" quantum="1M"/>
|
2017-08-30 09:49:56 +00:00
|
|
|
<resource name="CPU" quantum="5"/>
|
2016-08-25 15:48:53 +00:00
|
|
|
<provides><service name="Timer"/></provides>
|
|
|
|
</start>
|
|
|
|
|
2017-08-30 09:49:56 +00:00
|
|
|
<start name="nic_router" caps="200" priority="-1">
|
2016-08-25 15:48:53 +00:00
|
|
|
<resource name="RAM" quantum="10M"/>
|
|
|
|
<provides><service name="Nic"/></provides>
|
|
|
|
<config rtt_sec="3" verbose="no">
|
|
|
|
|
2016-09-12 10:55:12 +00:00
|
|
|
<policy label_prefix="udp_client_1" domain="udp_client_1" />
|
|
|
|
<policy label_prefix="http_client_3" domain="http_client_3" />
|
|
|
|
<policy label_prefix="udp_client_3" domain="udp_client_3" />
|
|
|
|
<policy label_prefix="http_server_1" domain="http_server_1" />
|
|
|
|
<policy label_prefix="http_server_2" domain="http_server_2" />
|
|
|
|
<policy label_prefix="udp_server_1" domain="udp_server_1" />
|
|
|
|
<policy label_prefix="udp_server_2" domain="udp_server_2" />
|
|
|
|
|
|
|
|
<domain name="uplink" interface="10.0.2.55/24" gateway="10.0.2.1">
|
|
|
|
<tcp-forward port="80" domain="http_server_1" to="192.168.1.18" />
|
|
|
|
<tcp-forward port="8080" domain="http_server_2" to="192.168.2.72" />
|
|
|
|
<udp-forward port="1" domain="udp_server_2" to="18.17.16.15" />
|
|
|
|
<nat domain="http_client_3" tcp-ports="6" />
|
|
|
|
<ip dst="217.13.192.0/24" domain="udp_client_3" />
|
|
|
|
</domain>
|
|
|
|
|
|
|
|
<domain name="udp_client_1" interface="10.0.98.33/24">
|
|
|
|
<udp-forward port="1337" domain="udp_server_1" to="10.0.99.55" />
|
|
|
|
</domain>
|
|
|
|
|
|
|
|
<domain name="http_client_3" interface="100.200.0.1/24">
|
|
|
|
<tcp dst="10.0.0.0/16">
|
|
|
|
<permit port="2345" domain="uplink" />
|
|
|
|
</tcp>
|
|
|
|
</domain>
|
|
|
|
|
|
|
|
<domain name="udp_client_3" interface="217.13.192.1/24">
|
|
|
|
<ip dst="10.0.2.0/24" domain="uplink" />
|
|
|
|
</domain>
|
|
|
|
|
|
|
|
<domain name="http_server_1" interface="192.168.1.1/24" />
|
|
|
|
<domain name="http_server_2" interface="192.168.2.1/24" />
|
|
|
|
<domain name="udp_server_1" interface="10.0.99.33/24" />
|
|
|
|
<domain name="udp_server_2" interface="18.17.16.14/24" />
|
2016-08-25 15:48:53 +00:00
|
|
|
|
|
|
|
</config>
|
|
|
|
<route>
|
|
|
|
<service name="Nic"> <child name="nic_bridge"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>
|
|
|
|
|
2017-08-30 09:49:56 +00:00
|
|
|
<start name="nic_bridge" caps="200" priority="-1">
|
2016-08-25 15:48:53 +00:00
|
|
|
<resource name="RAM" quantum="10M"/>
|
|
|
|
<provides><service name="Nic"/></provides>
|
|
|
|
<config>
|
2016-09-12 10:55:12 +00:00
|
|
|
<policy label_prefix="nic_router" ip_addr="10.0.2.55" />
|
2017-02-11 02:51:44 +00:00
|
|
|
<policy label_prefix="http_client_1" ip_addr="10.0.2.201" />
|
|
|
|
<policy label_prefix="http_client_2" ip_addr="10.0.2.202" />
|
|
|
|
<policy label_prefix="http_server_3" ip_addr="10.0.2.203" />
|
2017-02-10 20:50:40 +00:00
|
|
|
<policy label_prefix="udp_client_2" ip_addr="10.0.2.212" />
|
2017-02-11 02:51:44 +00:00
|
|
|
<policy label_prefix="udp_server_3" ip_addr="10.0.2.213" />
|
2016-08-25 15:48:53 +00:00
|
|
|
</config>
|
|
|
|
<route>
|
2017-02-11 02:51:44 +00:00
|
|
|
<service name="Nic"> <child name="} [nic_drv] {"/> </service>
|
2016-08-25 15:48:53 +00:00
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>
|
|
|
|
|
2017-02-11 02:51:44 +00:00
|
|
|
} [test_1_config] {
|
|
|
|
} [test_2_config] {
|
|
|
|
} [test_3_config] {
|
|
|
|
} [test_4_config] {
|
|
|
|
} [test_5_config] {
|
|
|
|
} [test_6_config] {
|
2016-08-25 15:48:53 +00:00
|
|
|
|
2017-02-23 11:12:28 +00:00
|
|
|
</config> }
|
|
|
|
|
|
|
|
install_config $config
|
2016-08-25 15:48:53 +00:00
|
|
|
|
|
|
|
#
|
2017-02-11 02:51:44 +00:00
|
|
|
# Create single image and execute
|
2016-08-25 15:48:53 +00:00
|
|
|
#
|
|
|
|
|
2017-02-23 11:12:28 +00:00
|
|
|
|
|
|
|
build_boot_image "
|
2016-12-22 14:01:19 +00:00
|
|
|
core init timer nic_router nic_bridge ld.lib.so libc.lib.so libm.lib.so
|
2017-09-14 19:00:36 +00:00
|
|
|
lwip.lib.so lxip.lib.so posix.lib.so test-http_clnt
|
2016-08-25 15:48:53 +00:00
|
|
|
test-lwip_httpsrv_static test-lxip_udp_echo test-lxip_udp_client
|
2017-03-09 13:03:46 +00:00
|
|
|
[nic_drv_binary] [gpio_drv] [platform_drv_boot_modules]"
|
2016-08-25 15:48:53 +00:00
|
|
|
|
2017-02-11 02:51:44 +00:00
|
|
|
proc nic_qemu_args { } {
|
|
|
|
if {[have_spec x86]} { return "-net nic,model=e1000" }
|
|
|
|
if {[have_spec lan9118]} { return "-net nic,model=lan9118" } }
|
2016-08-25 15:48:53 +00:00
|
|
|
|
2017-08-24 09:23:02 +00:00
|
|
|
append qemu_args "-nographic -net user [nic_qemu_args]"
|
2016-08-25 15:48:53 +00:00
|
|
|
|
2017-08-30 09:49:56 +00:00
|
|
|
run_genode_until {.*Test done.*\n.*Test done.*\n.*Test done.*\n.*Test done.*\n.*Test done.*\n.*Test done.*\n} 80
|