Commit 87d82994 by Vicent Marti

Make the test return an error code on failure

Signed-off-by: Vicent Marti <tanoku@gmail.com>
parent b02c371e
......@@ -157,7 +157,7 @@ static void print_details(git_testsuite *ts)
}
}
void git_testsuite_run(git_testsuite *ts)
int git_testsuite_run(git_testsuite *ts)
{
int i;
......@@ -175,5 +175,7 @@ void git_testsuite_run(git_testsuite *ts)
}
printf("\n ");
print_details(ts);
return ts->fail_count;
}
......@@ -10,7 +10,7 @@
#include <git2.h>
#define ADD_TEST(SUITE, MODULE, TEST) \
git_testsuite_add(SUITE, git_test_new(#TEST " (" MODULE ")", &_gittest__##TEST))
git_testsuite_add(SUITE, git_test_new(MODULE "::" #TEST, &_gittest__##TEST))
#define BEGIN_TEST(MODULE, TEST) \
void _gittest__##TEST(git_test *_gittest) \
......@@ -38,7 +38,7 @@ void git_testsuite_free(git_testsuite *ts);
void git_testsuite_add(git_testsuite *ts, git_test *tc);
void git_testsuite_addsuite(git_testsuite* ts, git_testsuite *ts2);
void git_testsuite_run(git_testsuite *ts);
int git_testsuite_run(git_testsuite *ts);
#endif
......@@ -87,18 +87,20 @@ void libgit2_free_suites(git_testsuite **suites)
int main(int GIT_UNUSED(argc), char *GIT_UNUSED(argv[]))
{
unsigned int i;
unsigned int i, failures;
git_testsuite **suites;
GIT_UNUSED_ARG(argc);
GIT_UNUSED_ARG(argv);
suites = libgit2_get_suites();
failures = 0;
for (i = 0; i < GIT_SUITE_COUNT; ++i)
git_testsuite_run(suites[i]);
failures += git_testsuite_run(suites[i]);
libgit2_free_suites(suites);
return 0;
return failures ? -1 : 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment