genode/libports/run/python.run

108 lines
2.5 KiB
Plaintext
Raw Normal View History

2011-12-22 16:19:25 +01:00
#
# \brief Test for running python
# \author Norman Feske
# \date 2011-11-22
#
if {![have_spec x86]} {
puts "Run script is only supported on x86"; exit 0 }
#
# Build
#
build {
core init
test/python
}
create_boot_directory
#
# Generate config
#
set config {
<config verbose="yes">
<parent-provides>
<service name="ROM"/>
<service name="RAM"/>
<service name="CAP"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
<service name="SIGNAL"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<start name="test-python">
<resource name="RAM" quantum="3M"/>
2011-12-22 16:19:25 +01:00
<config>
<script name="hello.py"/>
</config>
</start>
</config>
}
install_config $config
#
# Boot modules
#
# Fill up hello.py with zeros, otherwise on OKL4 it fails on native machines.
# OKL4 bootstrap procedure loads the script to the designated address but does
# not clear the remainder of the page. Hence, the script is followed by some
# garbage, which the interpreter tries to execute.
set test_file "[genode_dir]/libports/src/test/python/hello.py"
set file_size [exec du -b $test_file]
set file_size [regexp -inline {[0-9]+} $file_size]
set file_size [expr 4096 - $file_size]
catch { exec dd if=/dev/zero of=bin/hello.py.tmp bs=1 count=$file_size}
exec cp $test_file bin/hello.py
exec cat bin/hello.py.tmp >>bin/hello.py
exec rm bin/hello.py.tmp
set file_size [exec du -b bin/hello.py]
set file_size [regexp -inline {[0-9]+} $file_size]
if {$file_size != 4096 } { puts "hello.py could not be prepared properly"; exit 1 }
2011-12-22 16:19:25 +01:00
# generic modules
set boot_modules {
core init
ld.lib.so libc.lib.so libc_log.lib.so libc_rom.lib.so libm.lib.so python.lib.so
2011-12-22 16:19:25 +01:00
test-python
hello.py
}
build_boot_image $boot_modules
#
# Execute test case
#
append qemu_args " -m 128 -nographic "
run_genode_until {.*child exited with exit value 0.*} 60
grep_output {test-python\] }
compare_output_to {
[init -> test-python]
[init -> test-python] -============================-
[init -> test-python] || ||
[init -> test-python] || Python Core 2.6.4 ||
[init -> test-python] || ||
[init -> test-python] || Genode 11.11 ||
[init -> test-python] || ||
[init -> test-python] -============================-
[init -> test-python]
[init -> test-python] 2011 by Genode Labs <www.genode-labs.com>
[init -> test-python]
}
exec rm bin/hello.py
# vi: set ft=tcl :