Adapt sub_rm test to current Linux 32-bit

As noted above the former enum for the local-attachment address we
discovered address clashes on current Linux installations, esp. 32-bit
runtime on 64-bit Linux. The local_attach_addr is now configurable in
the run script and the memory maps heuristics were removed.
This commit is contained in:
Christian Helmuth 2017-11-02 16:38:00 +01:00
parent b0683a5acf
commit 1b4128d3d9
2 changed files with 12 additions and 40 deletions

View File

@ -2,7 +2,11 @@ build "core init test/sub_rm"
create_boot_directory
set config {
proc local_attach_addr {} { return "0x70000000" }
proc attach_twice_forbidden {} { if { [have_spec linux] } { return true } else { return false } }
proc support_attach_sub_any {} { if { [have_spec linux] } { return false } else { return true } }
append config {
<config>
<parent-provides>
<service name="ROM"/>
@ -15,13 +19,11 @@ set config {
<any-service> <parent/> </any-service>
</default-route>
<default caps="100"/>
<start name="test-sub_rm">}
append_if [have_spec linux] config {
<config attach_twice_forbidden="true" support_attach_sub_any="false"/>}
append config {
<start name="test-sub_rm">
<resource name="RAM" quantum="10M"/>
<config local_attach_addr="} [local_attach_addr] {"
attach_twice_forbidden="} [attach_twice_forbidden] {"
support_attach_sub_any="} [support_attach_sub_any] {"/>
</start>
</config>
}
@ -33,34 +35,3 @@ build_boot_image "core ld.lib.so init test-sub_rm"
append qemu_args "-nographic "
run_genode_until {.*--- end of sub-rm test ---.*} 20
if {([have_spec linux] && [have_spec x86_32])} {
set maps [exec cat /proc/[exec pidof test-sub_rm]/maps]
puts "\nmemory map after test completion follows:\n"
puts "$maps\n"
#
# Validate some properties of the final mmap
#
if {![regexp {60000000-60040000 ---p} $maps]} {
puts "Error: detaching from sub RM session failed"
exit -1
}
if {![regexp {60040000-60044000 rw.s} $maps]} {
puts "Error: populating already attached sub RM session failed"
exit -1
}
if {![regexp {60080000-60083000 rw.s 00001000} $maps]} {
puts "Error: using offset parameter to sub RM attach did not work"
exit -1
}
if {![regexp {600c0000-600c2000 rw.s 00001000} $maps]} {
puts "Error: using offset and size parameters to sub RM attach did not work"
exit -1
}
if {![regexp -- {-60100000 ---p} $maps]} {
puts "Error: attached sub RM session exceeds region boundary"
exit -1
}
}

View File

@ -115,9 +115,10 @@ void Component::construct(Env &env)
* Technically, this could let the test fail (if Linux decides to mmap the
* vdso page to this location. reason ... keeping fingers crossed.
*/
enum { LOCAL_ATTACH_ADDR = 0x60000000 };
addr_t const local_attach_addr =
config.xml().attribute_value("local_attach_addr", (addr_t)0);
char *sub_rm_base = env.rm().attach_at(sub_rm.dataspace(),
LOCAL_ATTACH_ADDR);
local_attach_addr);
log("validate pattern in sub rm");
validate_pattern_at(test_pattern(), sub_rm_base + DS_SUB_OFFSET);