Browse Source

tests: Report hard errors.

Distinguish between test failures and runtime errors when running the
test suite.
master
Damien Goutte-Gattat 3 months ago
parent
commit
968d24f4f2
  1. 10
      tests/t-parseconfig.c

10
tests/t-parseconfig.c

@ -113,23 +113,25 @@ write_test_config(const char *test, int fd)
int
main(int argc, char **argv)
{
int rc, fd;
int rc, fd, hard_error;
gfsec_secret_t *secret;
struct test *test = tests;
char filename[] = "testXXXXXX";
testnr = 1;
sum = 0;
hard_error = 0;
if ( (fd = mkstemp(filename)) == -1 ) {
fprintf(stderr, "Cannot create temporary file: %s\n", strerror(errno));
return 1;
return 99; /* Hard error. */
}
while ( test->content ) {
if ( write_test_config(test->content, fd) == -1 ) {
fprintf(stderr, "Cannot write to temporary file: %s\n", strerror(errno));
continue;
hard_error = 1;
break;
}
secret = gfsec_secret_new();
@ -166,5 +168,5 @@ main(int argc, char **argv)
close(fd);
unlink(filename);
return sum == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
return hard_error ? 99 : sum == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}

Loading…
Cancel
Save