]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Tue Feb 10 07:36:35 CST 2009 Pekka Pessi <first.last@nokia.com>
authorMichael Jerris <mike@jerris.com>
Thu, 12 Feb 2009 21:01:58 +0000 (21:01 +0000)
committerMichael Jerris <mike@jerris.com>
Thu, 12 Feb 2009 21:01:58 +0000 (21:01 +0000)
  * check_nua: use tcase_add_test() and s2_select_tests() from <s2check.h>

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11935 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c
libs/sofia-sip/libsofia-sip-ua/nua/check_nua.h

index 4ffe3a65bdbe97d8aacad8832360d9666974ffcb..006259167be457d83dec7dc2e059ee617e7234d2 100644 (file)
 
 #include "test_s2.h"
 
-static char const * const default_patterns[] = { "*", NULL };
-static char const * const *test_patterns = default_patterns;
-
-void check_nua_tcase_add_test(TCase *tc, TFun tf, char const *name)
-{
-  char const * const *patterns;
-
-#if HAVE_FNMATCH_H
-  for (patterns = test_patterns; *patterns; patterns++) {
-    if (!fnmatch(*patterns, name, 0)) {
-      if (strcmp(*patterns, "*")) {
-       printf("%s: running\n", name);
-      }
-      _tcase_add_test(tc, tf, name, 0, 0, 1);
-      return;
-    }
-  }
-#else
-  for (patterns = test_patterns; *patterns; patterns++) {
-    if (!strcmp(*patterns, name) || !strcmp(*patterns, "*")) {
-      if (strcmp(*patterns, "*")) {
-       printf("%s: running\n", name);
-      }
-      _tcase_add_test(tc, tf, name, 0, 0, 1);
-      return;
-    }
-  }
-#endif
-}
-
 int main(int argc, char *argv[])
 {
   int failed = 0;
@@ -86,28 +56,7 @@ int main(int argc, char *argv[])
   if (getenv("CHECK_NUA_VERBOSE"))
     s2_start_stop = strtoul(getenv("CHECK_NUA_VERBOSE"), NULL, 10);
 
-  if (getenv("CHECK_NUA_CASES")) {
-    size_t i;
-    char *s, **patterns;
-    char *cases = strdup(getenv("CHECK_NUA_CASES"));
-
-    /* Count commas */
-    for (i = 2, s = cases; (s = strchr(s, ',')); s++, i++);
-
-    patterns = calloc(i, sizeof *patterns);
-
-    /* Split by commas */
-    for (i = 0, s = cases;; i++) {
-      patterns[i] = s;
-      if (s == NULL)
-       break;
-      s = strchr(s, ',');
-      if (s)
-       *s++ = '\0';
-    }
-
-    test_patterns = (char const * const *)patterns;
-  }
+  s2_select_tests(getenv("CHECK_NUA_CASES"));
 
   check_register_cases(suite);
   check_session_cases(suite);
index 2eb11d1177d203951f671ae207af9a15f9fd8728..810a03d157b3410524ad07e8875f670de973af6f 100644 (file)
@@ -1,12 +1,6 @@
 #ifndef CHECK_NUA_H
 
-#include <check.h>
-
-#undef tcase_add_test
-#define tcase_add_test(tc, tf) \
-  check_nua_tcase_add_test(tc, tf, "" #tf "")
-
-void check_nua_tcase_add_test(TCase *, TFun, char const *name);
+#include <s2check.h>
 
 void check_session_cases(Suite *suite);
 void check_register_cases(Suite *suite);