mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
test-runner: allow booting directly into a shell
It is sometimes valuable to just boot into a shell in order to manually test functionality. Since test-runner already is setup to run a minimal kernel with all the necessary requirements for hostapd/iwd it made sense to allow the user to do this. If -s,--shell is passed into test runner, no python tests will be run. The hw.conf file is still used to setup IWD and hostapd so once booted into the shell you can still (manually) run the test (e.g. via iwctl). This also works when using USB/PCI passthrough. This makes testing out different kernel version with real hardware much quicker than using the host kernel.
This commit is contained in:
parent
2d65a0030e
commit
da65acbd07
@ -80,6 +80,7 @@ static bool enable_debug;
|
|||||||
const char *debug_filter;
|
const char *debug_filter;
|
||||||
static struct l_settings *hw_config;
|
static struct l_settings *hw_config;
|
||||||
static bool native_hw;
|
static bool native_hw;
|
||||||
|
static bool shell;
|
||||||
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;
|
||||||
@ -386,7 +387,7 @@ static bool start_qemu(void)
|
|||||||
"TESTVERBOUT=\'%s\' DEBUG_FILTER=\'%s\'"
|
"TESTVERBOUT=\'%s\' DEBUG_FILTER=\'%s\'"
|
||||||
"TEST_ACTION=%u TEST_ACTION_PARAMS=\'%s\' "
|
"TEST_ACTION=%u TEST_ACTION_PARAMS=\'%s\' "
|
||||||
"TESTARGS=\'%s\' PATH=\'%s\' VALGRIND=%u"
|
"TESTARGS=\'%s\' PATH=\'%s\' VALGRIND=%u"
|
||||||
"GDB=\'%s\' HW=\'%s\'",
|
"GDB=\'%s\' HW=\'%s\' SHELL=%u",
|
||||||
check_verbosity("kernel") ? "ignore_loglevel" : "quiet",
|
check_verbosity("kernel") ? "ignore_loglevel" : "quiet",
|
||||||
initcmd, cwd, verbose_opt ? verbose_opt : "none",
|
initcmd, cwd, verbose_opt ? verbose_opt : "none",
|
||||||
enable_debug ? debug_filter : "",
|
enable_debug ? debug_filter : "",
|
||||||
@ -396,7 +397,8 @@ static bool start_qemu(void)
|
|||||||
getenv("PATH"),
|
getenv("PATH"),
|
||||||
valgrind,
|
valgrind,
|
||||||
gdb_opt ? gdb_opt : "none",
|
gdb_opt ? gdb_opt : "none",
|
||||||
hw_config ? "real" : "virtual");
|
hw_config ? "real" : "virtual",
|
||||||
|
shell);
|
||||||
|
|
||||||
if (hw_config) {
|
if (hw_config) {
|
||||||
if (l_settings_has_group(hw_config, "PCIAdapters")) {
|
if (l_settings_has_group(hw_config, "PCIAdapters")) {
|
||||||
@ -2045,7 +2047,12 @@ static void create_network_and_run_tests(const void *key, void *value,
|
|||||||
|
|
||||||
set_wiphy_list(wiphy_list);
|
set_wiphy_list(wiphy_list);
|
||||||
|
|
||||||
run_py_tests(hw_settings, test_queue, test_stats_queue);
|
if (!shell)
|
||||||
|
run_py_tests(hw_settings, test_queue, test_stats_queue);
|
||||||
|
else {
|
||||||
|
if (system("/bin/sh"))
|
||||||
|
l_info("executing /bin/sh failed");
|
||||||
|
}
|
||||||
|
|
||||||
l_info("Destructing network...");
|
l_info("Destructing network...");
|
||||||
|
|
||||||
@ -2551,6 +2558,14 @@ static void run_tests(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ptr = strstr(cmdline, "SHELL=");
|
||||||
|
if (ptr) {
|
||||||
|
*ptr = '\0';
|
||||||
|
test_action_str = ptr + 6;
|
||||||
|
|
||||||
|
shell = atoi(test_action_str);
|
||||||
|
}
|
||||||
|
|
||||||
ptr = strstr(cmdline, "HW=");
|
ptr = strstr(cmdline, "HW=");
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
@ -2742,7 +2757,8 @@ static void usage(void)
|
|||||||
"\t-g, --gdb <iwd|hostapd> Run gdb on the specified"
|
"\t-g, --gdb <iwd|hostapd> Run gdb on the specified"
|
||||||
" executable\n"
|
" executable\n"
|
||||||
"\t-w, --hw <config> Run using a physical hardware "
|
"\t-w, --hw <config> Run using a physical hardware "
|
||||||
"configuration");
|
"configuration\n"
|
||||||
|
"\t-s, --shell Boot into shell, not autotests\n");
|
||||||
l_info("Commands:\n"
|
l_info("Commands:\n"
|
||||||
"\t-A, --auto-tests <dirs> Comma separated list of the "
|
"\t-A, --auto-tests <dirs> Comma separated list of the "
|
||||||
"test configuration\n\t\t\t\t"
|
"test configuration\n\t\t\t\t"
|
||||||
@ -2761,6 +2777,7 @@ static const struct option main_options[] = {
|
|||||||
{ "gdb", required_argument, NULL, 'g' },
|
{ "gdb", required_argument, NULL, 'g' },
|
||||||
{ "valgrind", no_argument, NULL, 'V' },
|
{ "valgrind", no_argument, NULL, 'V' },
|
||||||
{ "hw", required_argument, NULL, 'w' },
|
{ "hw", required_argument, NULL, 'w' },
|
||||||
|
{ "shell", optional_argument, NULL, 's' },
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
@ -2847,6 +2864,9 @@ int main(int argc, char *argv[])
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 's':
|
||||||
|
shell = true;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage();
|
usage();
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
Loading…
Reference in New Issue
Block a user