commit edd4f2b2a2463d7b2e964e31e0a75049c4751fb7
parent 1561392614bf85f83a275f27d906a34b69edd131
Author: James Prestwood <james.prestwood@linux.intel.com>
Date: Wed, 5 Jun 2019 14:44:24 -0700
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
Diffstat:
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/tools/test-runner.c b/tools/test-runner.c
@@ -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"