From 7b3831515a729698d2d423394527002c41023dba Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 21 Feb 2019 14:08:57 -0800 Subject: [PATCH] test-runner: allow test to set the regulatory domain HT/VHT require setting the regulatory domain to something other than 00. This adds an option to the hardware config which allows the regulatory domain to be set to any country. --- tools/test-runner.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/test-runner.c b/tools/test-runner.c index 6d3e4574..e2eda2f2 100644 --- a/tools/test-runner.c +++ b/tools/test-runner.c @@ -970,6 +970,7 @@ static bool find_test_configuration(const char *path, int level, #define HW_CONFIG_SETUP_TMPFS_EXTRAS "tmpfs_extra_stuff" #define HW_CONFIG_SETUP_START_IWD "start_iwd" #define HW_CONFIG_SETUP_IWD_CONF_DIR "iwd_config_dir" +#define HW_CONFIG_SETUP_REG_DOMAIN "reg_domain" static struct l_settings *read_hw_config(const char *test_dir_path) { @@ -1698,6 +1699,19 @@ static void set_wiphy_list(struct l_queue *wiphy_list) setenv("TEST_WIPHY_LIST", var, true); } +static void set_reg_domain(const char *domain) +{ + char *argv[5]; + + argv[0] = "iw"; + argv[1] = "reg"; + argv[2] = "set"; + argv[3] = (char *) domain; + argv[4] = NULL; + + execute_program(argv, false, false); +} + static void create_network_and_run_tests(const void *key, void *value, void *data) { @@ -1717,6 +1731,7 @@ static void create_network_and_run_tests(const void *key, void *value, bool ofono_req = false; const char *sim_keys; const char *iwd_ext_options = NULL; + const char *reg_domain; memset(hostapd_pids, -1, sizeof(hostapd_pids)); @@ -1786,6 +1801,11 @@ static void create_network_and_run_tests(const void *key, void *value, if (!create_tmpfs_extra_stuff(tmpfs_extra_stuff)) goto remove_abs_paths; + reg_domain = l_settings_get_value(hw_settings, HW_CONFIG_GROUP_SETUP, + HW_CONFIG_SETUP_REG_DOMAIN); + if (reg_domain) + set_reg_domain(reg_domain); + if (!configure_hw_radios(hw_settings, wiphy_list)) goto remove_abs_paths;