3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

t-runner: Propagate --tests param into qemu

This commit is contained in:
Tim Kourt 2016-05-06 15:37:14 -07:00 committed by Denis Kenzior
parent 8b390fc142
commit a0cd11e89a

View File

@ -67,7 +67,7 @@ static bool verbose_out;
static const char *qemu_binary; static const char *qemu_binary;
static const char *kernel_image; static const char *kernel_image;
static const char *exec_home; static const char *exec_home;
static const char *test_list; static const char *test_dir_list = "";
static const char * const qemu_table[] = { static const char * const qemu_table[] = {
"qemu-system-x86_64", "qemu-system-x86_64",
@ -273,8 +273,8 @@ static void start_qemu(void)
"acpi=off pci=noacpi noapic quiet ro " "acpi=off pci=noacpi noapic quiet ro "
"mac80211_hwsim.radios=0 " "mac80211_hwsim.radios=0 "
"init=%s TESTHOME=%s TESTAUTO=%u TESTVERBOUT=%u " "init=%s TESTHOME=%s TESTAUTO=%u TESTVERBOUT=%u "
"TESTARGS=\'%s\'", initcmd, cwd, run_auto, verbose_out, "TESTDIRLIST=\'%s\' TESTARGS=\'%s\'", initcmd, cwd,
testargs); run_auto, verbose_out, test_dir_list, testargs);
argv = alloca(sizeof(qemu_argv)); argv = alloca(sizeof(qemu_argv));
memcpy(argv, qemu_argv, sizeof(qemu_argv)); memcpy(argv, qemu_argv, sizeof(qemu_argv));
@ -1377,19 +1377,20 @@ static void run_command(char *cmdname)
char test_home_path[PATH_MAX]; char test_home_path[PATH_MAX];
char *ptr; char *ptr;
pid_t dbus_pid; pid_t dbus_pid;
int index, level; int i;
struct l_hashmap *test_config_map; struct l_hashmap *test_config_map;
struct stat st; struct stat st;
struct l_queue *test_stat_queue; struct l_queue *test_stat_queue;
char **test_config_dirs;
ptr = strrchr(exec_home, '/'); ptr = strrchr(exec_home, '/');
if (!ptr) if (!ptr)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
index = ptr - exec_home; i = ptr - exec_home;
strncpy(tmp_path, exec_home + 5, index - 5); strncpy(tmp_path, exec_home + 5, i - 5);
tmp_path[index - 5] = '\0'; tmp_path[i - 5] = '\0';
sprintf(test_home_path, "%s/%s", tmp_path, TEST_TOP_DIR_DEFAULT_NAME); sprintf(test_home_path, "%s/%s", tmp_path, TEST_TOP_DIR_DEFAULT_NAME);
@ -1404,19 +1405,46 @@ static void run_command(char *cmdname)
if (!test_config_map) if (!test_config_map)
return; return;
if (run_auto) test_config_dirs = l_strsplit(test_dir_list, ',');
level = 0;
else
level = 1;
l_info("Searching for the test configurations..."); if (test_config_dirs[0]) {
i = 0;
if (!find_test_configuration(test_home_path, level, test_config_map)) while (test_config_dirs[i]) {
goto exit; if (strchr(test_config_dirs[i], '/')) {
if (!find_test_configuration(
test_config_dirs[i], 1,
test_config_map))
goto exit;
} else {
char *config_dir_path;
config_dir_path =
l_strdup_printf("%s/%s", test_home_path,
test_config_dirs[i]);
if (!find_test_configuration(config_dir_path, 1,
test_config_map)) {
l_free(config_dir_path);
goto exit;
}
l_free(config_dir_path);
}
i++;
}
} else {
l_info("Searching for the test configurations...");
if (!find_test_configuration(test_home_path, 0,
test_config_map))
goto exit;
}
if (l_hashmap_isempty(test_config_map)) { if (l_hashmap_isempty(test_config_map)) {
l_error("No test configuration is found in %s.", l_error("No test configuration discovered");
test_home_path);
goto exit; goto exit;
} }
@ -1436,6 +1464,7 @@ static void run_command(char *cmdname)
l_queue_destroy(test_stat_queue, test_stat_queue_entry_destroy); l_queue_destroy(test_stat_queue, test_stat_queue_entry_destroy);
exit: exit:
l_strfreev(test_config_dirs);
l_hashmap_destroy(test_config_map, NULL); l_hashmap_destroy(test_config_map, NULL);
} }
@ -1487,6 +1516,21 @@ static void run_tests(void)
verbose_out = true; verbose_out = true;
} }
ptr = strstr(cmdline, "TESTDIRLIST=");
if (!ptr) {
l_error("No test configuration directory list section found");
return;
}
test_dir_list = ptr + 13;
ptr = strchr(test_dir_list, '\'');
if (!ptr) {
l_error("Malformed test configuration directory list section");
return;
}
*ptr = '\0';
ptr = strstr(cmdline, "TESTHOME="); ptr = strstr(cmdline, "TESTHOME=");
if (ptr) { if (ptr) {
exec_home = ptr + 4; exec_home = ptr + 4;
@ -1551,7 +1595,7 @@ int main(int argc, char *argv[])
kernel_image = optarg; kernel_image = optarg;
break; break;
case 't': case 't':
test_list = optarg; test_dir_list = optarg;
break; break;
case 'v': case 'v':
verbose_out = true; verbose_out = true;