Add missing route to chroot_loader test

Additionally, we do the cleanup of the remains of a previously failed
run prior creating the run directory. Otherwise, the directly creation
may fail because of a pending bindmount.
This commit is contained in:
Norman Feske 2013-05-07 11:09:10 +02:00
parent c54fef9274
commit 1589820d05
2 changed files with 23 additions and 15 deletions

View File

@ -10,7 +10,7 @@ if {![have_spec linux]} { puts "Run script requires Linux"; exit 0 }
# Build
#
build { core init drivers/timer/linux test/timer
build { core init drivers/timer test/timer
server/loader test/chroot_loader }
if {[catch { exec which setcap }]} {
@ -18,6 +18,23 @@ if {[catch { exec which setcap }]} {
return 0
}
#
# Clean up remains of a potentially failed previous run
#
proc chroot_path { id } { return "/tmp/chroot-test-$id" }
proc chroot_cwd_path { id } { return "[chroot_path $id][pwd]/[run_dir]" }
proc cleanup_chroot { } {
foreach id { 1 2 } {
umount_and_rmdir [chroot_cwd_path $id]
umount_and_rmdir [chroot_path $id]/lib
umount_and_rmdir [chroot_path $id]/lib64
}
}
cleanup_chroot
create_boot_directory
@ -58,18 +75,6 @@ set config {
</config>
}
proc chroot_path { id } { return "/tmp/chroot-test-$id" }
proc chroot_cwd_path { id } { return "[chroot_path $id][pwd]/[run_dir]" }
proc cleanup_chroot { } {
foreach id { 1 2 } {
umount_and_rmdir [chroot_cwd_path $id]
umount_and_rmdir [chroot_path $id]/lib
umount_and_rmdir [chroot_path $id]/lib64
}
}
# replace 'chroot_path' markers in config with actual paths
foreach id { 1 2 } {
regsub "chroot_path_$id" $config [chroot_path $id] config }
@ -100,7 +105,6 @@ exec sudo setcap cap_sys_admin,cap_sys_chroot=ep [run_dir]/core
#
# start with fresh directory
cleanup_chroot
foreach id { 1 2 } {
exec mkdir -p [chroot_path $id]
exec mkdir -p [chroot_path $id]/lib
@ -125,7 +129,7 @@ if {[regexp -all -- {--- timer test ---} $output] != 6} {
exit 2
}
if {![regexp -- {init-1 -> test-timer] wait 2/10} $output]} {
if {![regexp -- {init-1 -> test-timer] Done 500 ms period 4 times} $output]} {
puts stderr "Long-running timer test has made too little progress"
exit 3
}
@ -135,4 +139,7 @@ if {![regexp -- {init-1 -> test-timer] wait 2/10} $output]} {
#
cleanup_chroot
puts "Test succeeded"
# vi: set ft=tcl :

View File

@ -61,6 +61,7 @@ static char const *subsystem_config()
" <service name=\"CPU\"/>\n"
" <service name=\"RM\"/>\n"
" <service name=\"PD\"/>\n"
" <service name=\"SIGNAL\"/>\n"
" <service name=\"Timer\"/>\n"
" </parent-provides>\n"
" <default-route>\n"