Module: xenomai-forge
Branch: next
Commit: c657ab5a5588c483a1215a38c4af7f0e3c80eb83
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=c657ab5a5588c483a1215a38c4af7f0e3c80eb83

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Sep 10 09:43:28 2014 +0200

lib/smokey: fix glob matching for tests

---

 lib/smokey/init.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/lib/smokey/init.c b/lib/smokey/init.c
index 965bef5..a77d420 100644
--- a/lib/smokey/init.c
+++ b/lib/smokey/init.c
@@ -333,6 +333,25 @@ static int resolve_id(const char *s)
        return -1;
 }
 
+static int glob_match(const char *s)
+{
+       struct smokey_test *t, *tmp;
+       int matches = 0;
+
+       if (pvlist_empty(&register_list))
+               return 0;
+
+       pvlist_for_each_entry_safe(t, tmp, &register_list, __reserved.next) {
+               if (!fnmatch(s, t->name, FNM_PATHNAME)) {
+                       pvlist_remove(&t->__reserved.next);
+                       pvlist_append(&t->__reserved.next, &smokey_test_list);
+                       matches++;
+               }
+       }
+
+       return matches;
+}
+
 static int build_test_list(const char *test_enum)
 {
        char *s = strdup(test_enum), *n, *range, *range_p = NULL, *id, *id_r;
@@ -347,6 +366,12 @@ static int build_test_list(const char *test_enum)
                        end = test_count - 1;
                id = strtok_r(range, "-", &id_r);
                if (id) {
+                       if (glob_match(id)) {
+                               if (strtok_r(NULL, "-", &id_r))
+                                       goto fail;
+                               n = NULL;
+                               continue;
+                       }
                        start = resolve_id(id);
                        if (*range == '-') {
                                end = start;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to