2018-08-20 14:47:43 +00:00
|
|
|
create_boot_directory
|
|
|
|
|
2022-08-09 11:32:38 +00:00
|
|
|
if {[get_cmd_switch --autopilot] && [have_board virt_qemu_riscv]} {
|
2021-02-18 08:04:39 +00:00
|
|
|
puts "Autopilot mode is not supported on this platform."
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2018-08-20 14:47:43 +00:00
|
|
|
import_from_depot \
|
2019-02-19 13:24:52 +00:00
|
|
|
[depot_user]/src/[base_src] \
|
|
|
|
[depot_user]/src/coreutils \
|
|
|
|
[depot_user]/src/bash \
|
|
|
|
[depot_user]/src/init \
|
|
|
|
[depot_user]/src/libc \
|
2020-03-06 10:10:23 +00:00
|
|
|
[depot_user]/src/fs_rom \
|
2019-02-19 13:24:52 +00:00
|
|
|
[depot_user]/src/posix \
|
|
|
|
[depot_user]/src/report_rom \
|
|
|
|
[depot_user]/src/vfs \
|
|
|
|
[depot_user]/src/vfs_import
|
2018-08-20 14:47:43 +00:00
|
|
|
|
|
|
|
install_config {
|
|
|
|
<config>
|
|
|
|
<parent-provides>
|
|
|
|
<service name="ROM"/>
|
|
|
|
<service name="LOG"/>
|
|
|
|
<service name="RM"/>
|
|
|
|
<service name="CPU"/>
|
|
|
|
<service name="PD"/>
|
|
|
|
<service name="IRQ"/>
|
|
|
|
<service name="IO_MEM"/>
|
|
|
|
<service name="IO_PORT"/>
|
|
|
|
</parent-provides>
|
|
|
|
<default-route>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</default-route>
|
|
|
|
<default caps="100"/>
|
|
|
|
|
|
|
|
<start name="timer">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<provides> <service name="Timer"/> </provides>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="report_rom">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<provides> <service name="Report"/> <service name="ROM"/> </provides>
|
|
|
|
<config verbose="yes"/>
|
|
|
|
</start>
|
|
|
|
|
2021-06-15 12:32:27 +00:00
|
|
|
<start name="report_rom_empty_vfs">
|
|
|
|
<binary name="report_rom"/>
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<provides> <service name="Report"/> <service name="ROM"/> </provides>
|
|
|
|
<config verbose="yes"/>
|
|
|
|
</start>
|
|
|
|
|
2018-08-20 14:47:43 +00:00
|
|
|
<start name="vfs">
|
2020-03-06 10:10:23 +00:00
|
|
|
<resource name="RAM" quantum="10M"/>
|
2018-08-20 14:47:43 +00:00
|
|
|
<provides><service name="File_system"/></provides>
|
|
|
|
<config>
|
|
|
|
<vfs>
|
2020-03-06 10:10:23 +00:00
|
|
|
<tar name="bash.tar"/>
|
|
|
|
<tar name="coreutils.tar"/>
|
2018-08-20 14:47:43 +00:00
|
|
|
<ram/>
|
|
|
|
<import>
|
|
|
|
<dir name="items">
|
|
|
|
<inline name="1">first</inline>
|
|
|
|
<inline name="2">second</inline>
|
|
|
|
<inline name="3"><third/></inline>
|
|
|
|
</dir>
|
|
|
|
<inline name="4">fourth</inline>
|
|
|
|
</import>
|
|
|
|
</vfs>
|
|
|
|
<default-policy root="/" writeable="yes"/>
|
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
2020-03-06 10:10:23 +00:00
|
|
|
<start name="vfs_rom">
|
|
|
|
<resource name="RAM" quantum="10M"/>
|
|
|
|
<binary name="fs_rom"/>
|
|
|
|
<provides> <service name="ROM"/> </provides>
|
|
|
|
<config/>
|
|
|
|
<route>
|
|
|
|
<service name="File_system"> <child name="vfs"/> </service>
|
|
|
|
<any-service> <parent/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>
|
|
|
|
|
2021-06-15 12:32:27 +00:00
|
|
|
<start name="fs_query_empty_vfs" caps="120">
|
|
|
|
<binary name="fs_query"/>
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<config>
|
|
|
|
<vfs/>
|
|
|
|
<query path="/non_existent_1"/>
|
|
|
|
<query path="/non_existent_1/non_existent_2"/>
|
|
|
|
<query path="/"/>
|
|
|
|
</config>
|
|
|
|
<route>
|
|
|
|
<service name="Report">
|
|
|
|
<child name="report_rom_empty_vfs"/>
|
|
|
|
</service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
|
|
|
</start>
|
|
|
|
|
2020-05-05 12:27:29 +00:00
|
|
|
<start name="fs_query" caps="120">
|
2020-05-18 08:08:05 +00:00
|
|
|
<resource name="RAM" quantum="2M"/>
|
2018-08-20 14:47:43 +00:00
|
|
|
<config>
|
2021-06-15 12:32:27 +00:00
|
|
|
<vfs>
|
|
|
|
<dir name="empty"/>
|
|
|
|
<dir name="fs"> <fs writeable="yes"/> </dir>
|
|
|
|
</vfs>
|
2021-03-25 14:15:45 +00:00
|
|
|
<query path="/fs/items/non_existent_1"/>
|
2018-08-20 14:47:43 +00:00
|
|
|
<query path="/fs/items" content="yes"/>
|
2021-03-25 14:15:45 +00:00
|
|
|
<query path="/fs/non_existent_2" content="yes"/>
|
2021-06-15 12:32:27 +00:00
|
|
|
<query path="/empty" content="yes"/>
|
2018-08-20 14:47:43 +00:00
|
|
|
</config>
|
2021-06-15 12:32:27 +00:00
|
|
|
<route>
|
|
|
|
<service name="Report">
|
|
|
|
<child name="report_rom"/>
|
|
|
|
</service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
2018-08-20 14:47:43 +00:00
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="test" caps="700">
|
|
|
|
<binary name="sequence"/>
|
2020-03-06 10:10:23 +00:00
|
|
|
<resource name="RAM" quantum="20M"/>
|
2018-08-20 14:47:43 +00:00
|
|
|
<config>
|
2020-03-06 10:10:23 +00:00
|
|
|
<start name="/bin/sleep" caps="500">
|
|
|
|
<config>
|
|
|
|
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log"/>
|
|
|
|
<vfs> <dir name="dev"> <log/> <null/> </dir> </vfs>
|
|
|
|
<arg value="/bin/sleep"/>
|
|
|
|
<arg value="0.5"/>
|
2018-08-20 14:47:43 +00:00
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
2020-03-06 10:10:23 +00:00
|
|
|
<start name="/bin/rm" caps="500">
|
|
|
|
<config>
|
|
|
|
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log"/>
|
|
|
|
<vfs>
|
2018-08-20 14:47:43 +00:00
|
|
|
<dir name="fs"> <fs writeable="yes"/> </dir>
|
|
|
|
<dir name="dev"> <log/> <null/> </dir>
|
2020-03-06 10:10:23 +00:00
|
|
|
</vfs>
|
|
|
|
<arg value="/bin/rm"/>
|
|
|
|
<arg value="/fs/items/2"/>
|
2018-08-20 14:47:43 +00:00
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
2020-03-06 10:10:23 +00:00
|
|
|
<start name="/bin/sleep" caps="500">
|
|
|
|
<config>
|
|
|
|
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log"/>
|
|
|
|
<vfs> <dir name="dev"> <log/> <null/> </dir> </vfs>
|
|
|
|
<arg value="/bin/sleep"/>
|
|
|
|
<arg value="0.5"/>
|
2018-08-20 14:47:43 +00:00
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
2020-03-06 10:10:23 +00:00
|
|
|
<start name="/bin/cp" caps="500">
|
|
|
|
<config>
|
|
|
|
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log" rtc="/dev/null"/>
|
|
|
|
<vfs>
|
2018-08-20 14:47:43 +00:00
|
|
|
<dir name="fs"> <fs writeable="yes"/> </dir>
|
|
|
|
<dir name="dev"> <log/> <null/> </dir>
|
2020-03-06 10:10:23 +00:00
|
|
|
</vfs>
|
|
|
|
<arg value="/bin/cp"/>
|
|
|
|
<arg value="/fs/4"/>
|
|
|
|
<arg value="/fs/items/"/>
|
2018-08-20 14:47:43 +00:00
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
2020-03-06 10:10:23 +00:00
|
|
|
<start name="/bin/sleep" caps="500">
|
|
|
|
<config>
|
|
|
|
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log"/>
|
|
|
|
<vfs> <dir name="dev"> <log/> <null/> </dir> </vfs>
|
|
|
|
<arg value="/bin/sleep"/>
|
|
|
|
<arg value="0.5"/>
|
2018-08-20 14:47:43 +00:00
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
2020-03-06 10:10:23 +00:00
|
|
|
<start name="/bin/bash" caps="500">
|
|
|
|
<config>
|
|
|
|
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log" rtc="/dev/null"/>
|
2021-03-25 14:15:45 +00:00
|
|
|
<vfs>
|
|
|
|
<dir name="fs"> <fs writeable="yes"/> </dir>
|
|
|
|
<dir name="dev"> <log/> <null/> </dir>
|
|
|
|
</vfs>
|
|
|
|
<arg value="/bin/bash"/>
|
|
|
|
<arg value="-c"/>
|
|
|
|
<arg value="echo updated > /fs/items/3"/>
|
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="/bin/bash" caps="500">
|
|
|
|
<config>
|
|
|
|
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log" rtc="/dev/null"/>
|
2020-03-06 10:10:23 +00:00
|
|
|
<vfs>
|
2018-08-20 14:47:43 +00:00
|
|
|
<dir name="fs"> <fs writeable="yes"/> </dir>
|
|
|
|
<dir name="dev"> <log/> <null/> </dir>
|
2020-03-06 10:10:23 +00:00
|
|
|
</vfs>
|
|
|
|
<arg value="/bin/bash"/>
|
|
|
|
<arg value="-c"/>
|
|
|
|
<arg value="echo updated > /fs/items/3"/>
|
2018-08-20 14:47:43 +00:00
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
2020-03-06 10:10:23 +00:00
|
|
|
<start name="/bin/sleep" caps="500">
|
|
|
|
<config>
|
|
|
|
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log"/>
|
|
|
|
<vfs> <dir name="dev"> <log/> <null/> </dir> </vfs>
|
|
|
|
<arg value="/bin/sleep"/>
|
|
|
|
<arg value="0.5"/>
|
2018-08-20 14:47:43 +00:00
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
</config>
|
2020-03-06 10:10:23 +00:00
|
|
|
<route>
|
|
|
|
<service name="File_system"> <child name="vfs"/> </service>
|
|
|
|
<service name="ROM" label_suffix=".lib.so"> <parent/> </service>
|
|
|
|
<service name="ROM" label_prefix="/bin"> <child name="vfs_rom"/> </service>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</route>
|
2018-08-20 14:47:43 +00:00
|
|
|
</start>
|
|
|
|
</config>
|
|
|
|
}
|
|
|
|
|
|
|
|
build { app/sequence app/fs_query }
|
|
|
|
|
|
|
|
build_boot_image { sequence fs_query }
|
|
|
|
|
2020-04-06 14:05:54 +00:00
|
|
|
append qemu_args " -nographic "
|
2018-08-20 14:47:43 +00:00
|
|
|
|
2020-02-25 10:56:34 +00:00
|
|
|
run_genode_until {.*child "test" exited with exit value 0.*\n} 50
|
2018-08-20 14:47:43 +00:00
|
|
|
|
2021-06-15 12:32:27 +00:00
|
|
|
set original_output $output
|
|
|
|
|
2018-08-20 14:47:43 +00:00
|
|
|
grep_output {\[init -> report_rom\].*}
|
|
|
|
|
|
|
|
set num_listings [regexp -all {report 'fs_query -> listing'} $output dummy]
|
|
|
|
|
|
|
|
# we expect at least four intermediate reports
|
|
|
|
if {$num_listings < 4} {
|
2020-04-06 14:05:54 +00:00
|
|
|
puts "Error: Test failed with too few reports generated"
|
2018-08-20 14:47:43 +00:00
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# We cannot reliably compare the full output because some file operations
|
|
|
|
# may trigger one or two reports depending on the timing of signal delivery.
|
|
|
|
# However, we can at least check the last report for validity.
|
|
|
|
#
|
|
|
|
regsub {.*report 'fs_query -> listing'} $output {} output
|
|
|
|
|
|
|
|
compare_output_to {
|
|
|
|
[init -> report_rom] <listing>
|
|
|
|
[init -> report_rom] <dir path="/fs/items">
|
2020-02-19 09:32:14 +00:00
|
|
|
[init -> report_rom] <file name="1" writeable="yes">first</file>
|
|
|
|
[init -> report_rom] <file name="3" writeable="yes">updated
|
2018-08-20 14:47:43 +00:00
|
|
|
[init -> report_rom] </file>
|
2021-03-19 12:56:51 +00:00
|
|
|
[init -> report_rom] <file name="4" writeable="yes">fourth</file>
|
2018-08-20 14:47:43 +00:00
|
|
|
[init -> report_rom] </dir>
|
2021-06-15 12:32:27 +00:00
|
|
|
[init -> report_rom] <dir path="/empty"/>
|
2018-08-20 14:47:43 +00:00
|
|
|
[init -> report_rom] </listing>
|
|
|
|
}
|
2021-06-15 12:32:27 +00:00
|
|
|
|
|
|
|
set output $original_output
|
|
|
|
|
|
|
|
grep_output {\[init -> report_rom_empty_vfs\].*}
|
|
|
|
|
|
|
|
compare_output_to {
|
|
|
|
[init -> report_rom_empty_vfs] report 'fs_query_empty_vfs -> listing'
|
|
|
|
[init -> report_rom_empty_vfs] <listing>
|
|
|
|
[init -> report_rom_empty_vfs] <dir path="/"/>
|
|
|
|
[init -> report_rom_empty_vfs] </listing>
|
|
|
|
}
|