#
# \brief  Test double-list implementation of core
# \author Martin Stein
# \date   2014-09-30
#

# build program images
build "core init test/double_list"

# create directory where the boot files are written to
create_boot_directory

# the init config is not used but the build system needs it
install_config {
	<config>
		<parent-provides>
			<service name="LOG"/>
			<service name="RM"/>
			<service name="PD"/>
			<service name="CPU"/>
			<service name="ROM"/>
		</parent-provides>
		<default-route>
			<any-service> <parent/> </any-service>
		</default-route>
		<start name="test-double_list" caps="100">
			<resource name="RAM" quantum="10M"/>
		</start>
	</config>
}

# create single boot image from the compiled program images
build_boot_image "core ld.lib.so init test-double_list"

# configure qemu to use 64 MB RAM and avoid GUI mode
append qemu_args "  -nographic"

# execute the test in qemu if the targeted platform is supported
run_genode_until "done.*\n" 10

# check the output
grep_output {\[init -> test-double_list\]}
compare_output_to {
	[init -> test-double_list] print each
	[init -> test-double_list] print each
	[init -> test-double_list] 1
	[init -> test-double_list] print each
	[init -> test-double_list] 3
	[init -> test-double_list] 2
	[init -> test-double_list] 5
	[init -> test-double_list] 7
	[init -> test-double_list] 6
	[init -> test-double_list] 4
	[init -> test-double_list] 1
	[init -> test-double_list] print each
	[init -> test-double_list] 8
	[init -> test-double_list] 9
	[init -> test-double_list] 2
	[init -> test-double_list] 5
	[init -> test-double_list] 1
	[init -> test-double_list] 7
	[init -> test-double_list] 6
	[init -> test-double_list] 4
	[init -> test-double_list] 3
	[init -> test-double_list] print each
	[init -> test-double_list] 7
	[init -> test-double_list] 8
	[init -> test-double_list] done
}