2011-12-22 15:19:25 +00:00
|
|
|
#
|
|
|
|
# \brief Environment for executing Genode on Linux
|
|
|
|
# \author Norman Feske
|
|
|
|
# \date 2010-08-16
|
|
|
|
#
|
|
|
|
# For the documentation of the implemented API functions,
|
|
|
|
# please refer to the comments in 'tool/run'.
|
|
|
|
#
|
|
|
|
|
|
|
|
proc create_boot_directory { } {
|
|
|
|
exec rm -rf [run_dir]
|
|
|
|
exec mkdir -p [run_dir]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
proc install_config {config} {
|
|
|
|
set fh [open "[run_dir]/config" "WRONLY CREAT TRUNC"]
|
|
|
|
puts $fh $config
|
|
|
|
close $fh
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
proc build_boot_image {binaries} {
|
|
|
|
foreach binary $binaries {
|
|
|
|
exec ln -sf ../../../bin/$binary [run_dir] }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-08 08:43:05 +00:00
|
|
|
proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id -1}} {
|
|
|
|
#
|
|
|
|
# If a running_spawn_id is specified, wait for the expected output
|
|
|
|
#
|
|
|
|
if {$running_spawn_id != -1} {
|
|
|
|
wait_for_output $wait_for_re $timeout_value $running_spawn_id
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2013-08-30 10:54:07 +00:00
|
|
|
global spawn_id
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
set orig_pwd [pwd]
|
|
|
|
cd [run_dir]
|
2013-08-30 10:54:07 +00:00
|
|
|
spawn ./core
|
|
|
|
wait_for_output $wait_for_re $timeout_value $spawn_id
|
2011-12-22 15:19:25 +00:00
|
|
|
cd $orig_pwd
|
|
|
|
}
|
|
|
|
|
2012-11-21 19:02:22 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
# Umount a directory that was bind-mounted beforehand
|
|
|
|
#
|
|
|
|
# This function is used by chroot-related tests, e.g., 'os/run/chroot.run',
|
|
|
|
# 'os/run/chroot_loader.run'.
|
|
|
|
#
|
|
|
|
proc umount_and_rmdir { path } {
|
|
|
|
|
|
|
|
puts "umounting $path"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Invoke umount until it returns an error. Apparently, the unmounting
|
|
|
|
# of bind-mounted mount points does not always take immediate effect
|
|
|
|
# (regardless of the -l option).
|
|
|
|
#
|
|
|
|
while {1} {
|
|
|
|
if {[catch { exec sudo umount -l $path }]} { break; }
|
|
|
|
sleep 0.25
|
|
|
|
}
|
|
|
|
|
|
|
|
catch { exec rmdir -p $path }
|
|
|
|
}
|
|
|
|
|