genode/repos/os/run/lx_fs_import.run
Jean-Adrien DOMAGE a4727c90a8 lx_fs: add os/run/lx_fs_import.run run script
This new runscript demonstrates how a file can be overwritten by vfs
import with the flag overwrite set to false. This is due to a bug
in lx_fs that is not propagating an ernno EEXIST syscall error.

Issue genodelabs#4104
2021-05-10 11:16:24 +02:00

125 lines
2.9 KiB
Plaintext

assert_spec linux
set depot_archives { }
set build_components { }
set boot_modules { }
lappend depot_archives [depot_user]/src/[base_src]
lappend depot_archives [depot_user]/src/init
lappend depot_archives [depot_user]/src/vfs
lappend depot_archives [depot_user]/src/vfs_import
if { [get_cmd_switch --autopilot] } {
lappend depot_archives [depot_user]/src/lx_fs
} else {
lappend build_components server/lx_fs
lappend boot_modules lx_fs
}
set config {
<config>
<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>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<resource name="RAM" preserve="200M"/>
<resource name="CAP" preserve="1000"/>
<default caps="50"/>
<start name="timer" caps="100">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>
</start>
<start name="import_lx_fs" caps="220" ld="no">
<binary name="lx_fs"/>
<resource name="RAM" quantum="8M"/>
<provides>
<service name="File_system"/>
</provides>
<config>
<policy label="import_showcase -> " root="/" writeable="yes"/>
</config>
<route>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="import_showcase" caps="100">
<binary name="vfs"/>
<resource name="RAM" quantum="4M"/>
<provides>
<service name="File_system"/>
</provides>
<config>
<vfs> <fs/>
<import overwrite="false">
<dir name="test-existing-file">
<inline name="a_file">Hello Friend!</inline>
</dir>
<dir name="test-file">
<inline name="foo">bar</inline>
</dir>
<dir name="test-existing-directory">
<inline name="foo">bar</inline>
</dir>
</import>
</vfs>
</config>
<route>
<service name="File_system"> <child name="import_lx_fs"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
</config>
}
create_boot_directory
install_config $config
import_from_depot $depot_archives
if { [llength $build_components] > 0 } {
build $build_components
}
build_boot_image $boot_modules
## Create files before genode is run
exec mkdir -p [run_dir]/genode/test-existing-file
exec echo "This file already exist." > [run_dir]/genode/test-existing-file/a_file
exec mkdir -p [run_dir]/genode/test-existing-directory
append qemu_args " -nographic "
run_genode_until "Warning: skipping copy of file /test-existing-file/a_file, OPEN_ERR_EXISTS" 20
set created_file { [run_dir]/genode/test-file/foo }
if { [file exists $created_file] == 1 } {
puts { "Imported file not found." }
exit 1
}
set created_file_in_dir { [run_dir]/genode/test-existing-directory/foo }
if { [file exists $created_file] == 1 } {
puts { "Imported file not found." }
exit 1
}