mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-29 15:44:02 +00:00
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
This commit is contained in:
parent
e65b7f3b82
commit
a4727c90a8
124
repos/os/run/lx_fs_import.run
Normal file
124
repos/os/run/lx_fs_import.run
Normal file
@ -0,0 +1,124 @@
|
||||
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
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ lwip
|
||||
lx_hybrid_ctors
|
||||
lx_hybrid_exception
|
||||
lx_hybrid_pthread_ipc
|
||||
lx_fs_import
|
||||
microcode
|
||||
migrate
|
||||
moon
|
||||
|
Loading…
x
Reference in New Issue
Block a user