aboutsummaryrefslogtreecommitdiff
path: root/src/tests/ktests/cmdline/test.c
blob: a6d0a4c714a7936da2720759d70678a1a5ef8d18 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
void test_cmdline(multiboot_info_t *mbd, fs_t *devfs) {
	BEGIN_TEST("test-cmdline");

	fs_handle_t *f = fs_open(devfs, "/cmdline", FM_READ);
	ASSERT(f != 0);

	char buf[256];
	size_t l = file_read(f, 0, 255, buf);
	ASSERT(l > 0);
	buf[l] = 0;

	unref_file(f);
	dbg_printf("Command line as in /cmdline file: '%s'.\n", buf);

	ASSERT(strcmp(buf, (char*)mbd->cmdline) == 0);

	TEST_OK;
}

#undef TEST_PLACEHOLDER_AFTER_DEVFS
#define TEST_PLACEHOLDER_AFTER_DEVFS { test_cmdline(mbd, devfs); }

/* vim: set ts=4 sw=4 tw=0 noet :*/