示例#1
0
void node_testimgtool(xml_data_node *node)
{
	xml_data_node *child_node;
	xml_attribute_node *attr_node;
	struct imgtooltest_state state;

	imgtool_init(FALSE, messtest_warn);

	attr_node = xml_get_attribute(node, "name");
	report_testcase_begin(attr_node ? attr_node->value : NULL);

	memset(&state, 0, sizeof(state));

	for (child_node = node->child; child_node; child_node = child_node->next)
	{
		if (!strcmp(child_node->name, "createimage"))
			node_createimage(&state, child_node);
		else if (!strcmp(child_node->name, "checkfile"))
			node_checkfile(&state, child_node);
		else if (!strcmp(child_node->name, "checkdirectory"))
			node_checkdirectory(&state, child_node);
		else if (!strcmp(child_node->name, "putfile"))
			node_putfile(&state, child_node);
		else if (!strcmp(child_node->name, "deletefile"))
			node_deletefile(&state, child_node);
		else if (!strcmp(child_node->name, "createdirectory"))
			node_createdirectory(&state, child_node);
		else if (!strcmp(child_node->name, "deletedirectory"))
			node_deletedirectory(&state, child_node);
		else if (!strcmp(child_node->name, "recordfreespace"))
			node_recordfreespace(&state, child_node);
		else if (!strcmp(child_node->name, "checkfreespace"))
			node_checkfreespace(&state, child_node);
		else if (!strcmp(child_node->name, "setattr"))
			node_setattr(&state, child_node);
		else if (!strcmp(child_node->name, "checkattr"))
			node_checkattr(&state, child_node);
	}

	report_testcase_ran(state.failed);

	/* close out any existing partition */
	if (state.partition)
	{
		imgtool_partition_close(state.partition);
		state.partition = NULL;
	}

	/* close out any existing image */
	if (state.image)
	{
		imgtool_image_close(state.image);
		state.image = NULL;
	}

	imgtool_exit();
}
示例#2
0
void node_testmess(xml_data_node *node)
{
	xml_data_node *child_node;
	xml_attribute_node *attr_node;
	int result;

	pile_init(&command_pile);
	pool_init(&command_pool);

	memset(&new_command, 0, sizeof(new_command));
	command_count = 0;

	/* 'driver' attribute */
	attr_node = xml_get_attribute(node, "driver");
	if (!attr_node)
	{
		error_missingattribute("driver");
		return;
	}
	current_testcase.driver = attr_node->value;

	/* 'name' attribute */
	attr_node = xml_get_attribute(node, "name");
	current_testcase.name = attr_node ? attr_node->value : current_testcase.driver;

	/* 'ramsize' attribute */
	attr_node = xml_get_attribute(node, "ramsize");
	current_testcase.ram = attr_node ? ram_parse_string(attr_node->value) : 0;

	/* 'wavwrite' attribute */
	attr_node = xml_get_attribute(node, "wavwrite");
	current_testcase.wavwrite = attr_node && (atoi(attr_node->value) != 0);

	/* report the beginning of the test case */
	report_testcase_begin(current_testcase.name);
	current_testcase.commands = NULL;

	for (child_node = node->child; child_node; child_node = child_node->next)
	{
		if (!strcmp(child_node->name, "wait"))
			node_wait(child_node);
		else if (!strcmp(child_node->name, "input"))
			node_input(child_node);
		else if (!strcmp(child_node->name, "rawinput"))
			node_rawinput(child_node);
		else if (!strcmp(child_node->name, "switch"))
			node_switch(child_node);
		else if (!strcmp(child_node->name, "screenshot"))
			node_screenshot(child_node);
		else if (!strcmp(child_node->name, "checkblank"))
			node_checkblank(child_node);
		else if (!strcmp(child_node->name, "imagecreate"))
			node_imagecreate(child_node);
		else if (!strcmp(child_node->name, "imageload"))
			node_imageload(child_node);
		else if (!strcmp(child_node->name, "memverify"))
			node_memverify(child_node);
		else if (!strcmp(child_node->name, "imageverify"))
			node_imageverify(child_node);
		else if (!strcmp(child_node->name, "trace"))
			node_trace(child_node);
	}

	memset(&new_command, 0, sizeof(new_command));
	new_command.command_type = MESSTEST_COMMAND_END;
	if (!append_command())
	{
		error_outofmemory();
		return;
	}

	result = run_test(0, NULL);
	report_testcase_ran(result);

	pile_delete(&command_pile);
	pool_exit(&command_pool);
}