build { core init timer lib/ld test/block_request_stream app/block_tester }

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>

	<default caps="100"/>
	<start name="timer">
		<resource name="RAM" quantum="1M"/>
		<provides><service name="Timer"/></provides>
	</start>

	<start name="test-block_request_stream">
		<resource name="RAM" quantum="1M"/>
		<provides><service name="Block"/></provides>
		<config/>
		<route> <any-service> <parent/> </any-service> </route>
	</start>

	<start name="block_tester">
		<resource name="RAM" quantum="32M"/>
		<config verbose="yes" report="no" log="yes" stop_on_error="no">
			<tests>
				<sequential copy="no" length="16M" size="4K"/>
				<sequential copy="no" length="16M" size="8K"/>

				<sequential copy="no" length="3G"  size="16K"  batch="32"/>
				<sequential copy="no" length="15G" size="64K"  batch="32"/>
				<sequential copy="no" length="30G" size="128K" batch="32"/>

				<sequential copy="no" length="16M" size="4K"  write="yes"/>
				<sequential copy="no" length="16M" size="64K" write="yes"/>

				<!-- test client-side request splitting -->
				<sequential copy="no" length="16M" size="512K" io_buffer="64K"/>
			</tests>
		</config>
		<route>
			<service name="Block"> <child name="test-block_request_stream"/> </service>
			<any-service> <parent/> <any-child/> </any-service>
		</route>
	</start>
</config>}

build_boot_image [build_artifacts]

append qemu_args " -nographic "

run_genode_until {.*child "block_tester" exited with exit value 0.*\n} 360