]> git.ipfire.org Git - pakfire.git/commitdiff
testsuite: Show error code when test exited with failure
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 29 Nov 2017 18:07:12 +0000 (19:07 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 29 Nov 2017 18:07:12 +0000 (19:07 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
tests/testsuite.c
tests/testsuite.h

index e77388178405ddc141034b87053fef0d534b847d..04924fb616ff007d5fc5dbbd209784d6e3f72626 100644 (file)
@@ -33,10 +33,12 @@ int testsuite_init() {
        pakfire_log_set_function(pakfire_log_stderr);
 }
 
-int test_run(const test_t* t) {
+static int test_run(const test_t* t) {
        LOG("running %s\n", t->name);
 
        int r = t->func(t);
+       if (r)
+               LOG("Test failed with error code: %d\n", r);
 
        return r;
 }
index fb0f1f5cf1b55adf16e6a07a7e845cda5e0e423a..60c5bbb98abd2648cebf3222a17f4236c2a7ee0b 100644 (file)
@@ -41,8 +41,6 @@ testsuite_t* testsuite_create(size_t n);
 int testsuite_add_test(testsuite_t* ts, const char* name, test_function_t func);
 int testsuite_run(testsuite_t* ts);
 
-int test_run(const test_t* t);
-
 #define _LOG(prefix, fmt, ...) printf("TESTS: " prefix fmt, ## __VA_ARGS__);
 #define LOG(fmt, ...) _LOG("", fmt, ## __VA_ARGS__);
 #define LOG_WARN(fmt, ...) _LOG("WARN: ", fmt, ## __VA_ARGS__);