tests: print error locations verbosely

So we don't have to figure out which line generated this error by
searching for the subtest/error code combination.

Change-Id: Icca0a776fd19f0f3d250ddb76916f5f932dd9b5e
This commit is contained in:
Ben Gras 2013-01-25 01:00:10 +00:00
parent 8ebdbed79c
commit 042ecb4231
4 changed files with 6 additions and 8 deletions

View file

@ -12,9 +12,11 @@
int common_test_nr = -1, errct = 0, subtest;
#define e(errn) e_f(__FILE__, __LINE__, (errn))
void cleanup(void);
int does_fs_truncate(void);
void e(int n);
void e_f(char *file, int lineno, int n);
int name_max(char *path);
void quit(void);
void rm_rf_dir(int test_nr);
@ -98,14 +100,13 @@ int test_nr;
if (system(buf) != 0) printf("Warning: system(\"%s\") failed\n", buf);
}
void e(n)
int n;
void e_f(char *file, int line, int n)
{
int err_number;
err_number = errno; /* Store before printf can clobber it */
if (errct == 0) printf("\n"); /* finish header */
printf("Subtest %d, error %d, errno %d: %s\n",
subtest, n, errno, strerror(errno));
printf("%s:%d: Subtest %d, error %d, errno %d: %s\n",
file, line, subtest, n, errno, strerror(errno));
if (++errct > MAX_ERROR) {
printf("Too many errors; test aborted\n");
cleanup();

View file

@ -16,7 +16,6 @@ int subtest = 1;
#include "common.c"
int main(void);
void e(int n);
void quit(void);
int main()

View file

@ -21,7 +21,6 @@
void test22a(void);
int mode(char *filename);
int umode(char *filename);
void e(int number);
void quit(void);
int main(int argc, char *argv[])

View file

@ -25,7 +25,6 @@ void test3a(void);
void test3c(void);
void test3d(void);
void test3e(void);
void e(int n);
int main(argc, argv)
int argc;