genode/repos/os/run/lx_fs_import.run
2023-05-30 12:03:26 +02:00

120 lines
2.8 KiB
Plaintext

assert_spec linux
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
set build_components { }
if { [get_cmd_switch --autopilot] } {
lappend depot_archives [depot_user]/src/lx_fs
} else {
lappend build_components server/lx_fs
}
create_boot_directory
install_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>
}
import_from_depot $depot_archives
if { [llength $build_components] > 0 } {
build $build_components
}
build_boot_image [build_artifacts]
## 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
}