[Pkg-voip-commits] [bctoolbox] 06/57: Added a Skip tag to never run a test unless --all is given as argument to tester
daniel at gnoutcheff.name
daniel at gnoutcheff.name
Thu Mar 30 04:31:30 UTC 2017
This is an automated email from the git hooks/post-receive script.
gnoutchd-guest pushed a commit to branch debian/sid
in repository bctoolbox.
commit 6c9c968e550b8f1106e97a99b391c5eda6bf6a6b
Author: Sylvain Berfini <sylvain.berfini at belledonne-communications.com>
Date: Wed Nov 16 15:46:40 2016 +0100
Added a Skip tag to never run a test unless --all is given as argument to tester
---
src/tester.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/tester.c b/src/tester.c
index ac8df2a..149e3bb 100644
--- a/src/tester.c
+++ b/src/tester.c
@@ -94,6 +94,7 @@ char * test_name = NULL;
char * tag_name = NULL;
char * expected_res = NULL;
static long max_vm_kb = 0;
+int run_skipped_tests = 0;
static void (*tester_printf_va)(int level, const char *format, va_list args)=NULL;
@@ -139,8 +140,17 @@ int bc_tester_run_suite(test_suite_t *suite, const char *tag_name) {
pSuite = CU_add_suite_with_setup_and_teardown(suite->name, suite->before_all, suite->after_all,
suite->before_each, suite->after_each);
for (i = 0; i < suite->nb_tests; i++) {
- if (NULL == CU_add_test(pSuite, suite->tests[i].name, suite->tests[i].func)) {
- return CU_get_error();
+ size_t j;
+ bool_t skip = FALSE;
+ for (j = 0; j < (sizeof(suite->tests[i].tags) / sizeof(suite->tests[i].tags[0])); j++) {
+ if ((suite->tests[i].tags[j] != NULL) && (strcasecmp("Skip", suite->tests[i].tags[j]) == 0) && (run_skipped_tests == 0)) {
+ skip = TRUE;
+ }
+ }
+ if (!skip) {
+ if (NULL == CU_add_test(pSuite, suite->tests[i].name, suite->tests[i].func)) {
+ return CU_get_error();
+ }
}
}
}
@@ -545,6 +555,8 @@ int bc_tester_parse_args(int argc, char **argv, int argid)
} else if (strcmp(argv[i], "--tag") == 0) {
CHECK_ARG("--tag", ++i, argc);
tag_name = argv[i];
+ } else if (strcmp(argv[i], "--all") == 0) {
+ run_skipped_tests = 1;
} else if (strcmp(argv[i],"--list-suites")==0){
bc_tester_list_suites();
return 0;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/bctoolbox.git
More information about the Pkg-voip-commits
mailing list