3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 04:32:37 +01:00

test-runner: allow glob matching of tests

This allows a glob match of tests, e.g.

./test-runner -A testEAP-TTLS*

would run all TTLS based tests
This commit is contained in:
James Prestwood 2019-06-05 14:44:24 -07:00 committed by Denis Kenzior
parent 1561392614
commit edd4f2b2a2

View File

@ -1008,16 +1008,15 @@ static int is_test_dir(const char *dir)
}
static bool find_test_configuration(const char *path, int level,
struct l_hashmap *config_map)
struct l_hashmap *config_map);
static bool add_path(const char *path, int level, struct l_hashmap *config_map)
{
DIR *dir = NULL;
struct l_queue *py_test_queue = NULL;
struct dirent *entry;
char *npath;
if (!config_map)
return false;
dir = opendir(path);
if (!dir) {
l_error("Test directory does not exist: %s", path);
@ -1054,6 +1053,32 @@ static bool find_test_configuration(const char *path, int level,
return true;
}
static bool find_test_configuration(const char *path, int level,
struct l_hashmap *config_map)
{
glob_t glist;
int i = 0;
int ret;
if (!config_map)
return false;
ret = glob(path, 0, NULL, &glist);
if (ret != 0) {
l_error("Could not match glob %s", path);
return false;
}
while (glist.gl_pathv[i]) {
if (!add_path(glist.gl_pathv[i], level, config_map))
return false;
i++;
}
return true;
}
#define HW_CONFIG_FILE_NAME "hw.conf"
#define HW_CONFIG_GROUP_HOSTAPD "HOSTAPD"
#define HW_CONFIG_GROUP_SETUP "SETUP"