build "core init test/glucose timer"

create_boot_directory

set fd [open "bin/Test.cnf" w]
puts $fd {
p cnf 15 22
-1 10 11 8 9 0
-2 10 11 8 9 0
-2 4 0
-2 5 6 0
-3 4 5 0
-6 7 0
-8 -9  0
8 9  0
-10 8 9 0
-11 8 9 0
1 -12 0
8 -12 0
2 -13 0
8 -13 0
1 -14 0
9 -14 0
2 -15 0
9 -15 0
-1 12 14 0
-2 13 15 0
10 11 -12 -13  0
10 11 -14 -15  0
}
close $fd

append config {
<config>
	<parent-provides>
		<service name="ROM"/>
		<service name="RAM"/>
		<service name="IRQ"/>
		<service name="IO_MEM"/>
		<service name="IO_PORT"/>
		<service name="CAP"/>
		<service name="PD"/>
		<service name="RM"/>
		<service name="CPU"/>
		<service name="LOG"/>
		<service name="SIGNAL"/>
	</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>
}

append config "
	<start name=\"test-glucose\">
		<resource name=\"RAM\" quantum=\"32M\"/>
		<config>
			<libc stdin=\"/dev/null\" stdout=\"/dev/log\" stderr=\"/dev/log\" />
			<vfs>
				<dir name=\"dev\"> <log/> <null/> </dir>
				<rom name=\"Test.cnf\" />
			</vfs>
		</config>
	</start>
</config>"

install_config $config

build_boot_image {
	core init test-glucose timer
	ld.lib.so libc.lib.so vfs.lib.so posix.lib.so libm.lib.so stdcxx.lib.so zlib.lib.so
	Test.cnf
}

append qemu_args " -nographic  "

run_genode_until {.*Okay.*} 20

exec rm bin/Test.cnf
