Skip to content

Commit

Permalink
clar: provide a way to run some shell before exiting
Browse files Browse the repository at this point in the history
  • Loading branch information
tiennou committed Oct 30, 2018
1 parent fa274f7 commit 0e69485
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ USER=${USER:-$(whoami)}
SUCCESS=1

VALGRIND="valgrind --leak-check=full --show-reachable=yes --error-exitcode=125 --num-callers=50 --suppressions=\"$SOURCE_DIR/libgit2_clar.supp\""
LEAKS="MallocStackLogging=1 MallocScribble=1 MallocLogFile=/dev/null leaks -quiet -atExit -- nohup"
LEAKS="MallocStackLogging=1 MallocScribble=1 MallocLogFile=/dev/null"

cleanup() {
echo "Cleaning up..."
Expand Down
7 changes: 7 additions & 0 deletions tests/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ int main(int argc, char *argv[])
#endif
{
int res;
char *at_exit_cmd;

clar_test_init(argc, argv);

Expand All @@ -28,5 +29,11 @@ int main(int argc, char *argv[])
cl_global_trace_disable();
git_libgit2_shutdown();

at_exit_cmd = getenv("CLAR_AT_EXIT");
if (at_exit_cmd != NULL) {
int at_exit = system(at_exit_cmd);
return res || at_exit;
}

return res;
}

0 comments on commit 0e69485

Please sign in to comment.