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.
This commit is contained in:
James Prestwood 2019-02-21 14:08:57 -08:00 committed by Denis Kenzior
parent c275581389
commit 7b3831515a
1 changed files with 20 additions and 0 deletions

View File

@ -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;