Skip to content

Commit

Permalink
Renamed utest UTEST_FAIL to UTEST_FAILED
Browse files Browse the repository at this point in the history
To better match UTEST_SUCCESS, UTEST_FAIL is renamed UTEST_FAILED.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
  • Loading branch information
m-ronnblom committed Feb 3, 2023
1 parent 92e683c commit bd42176
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 93 deletions.
4 changes: 2 additions & 2 deletions test/utest/utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static bool valid_ret_code(int code)
case UTEST_SUCCESS:
case UTEST_NOT_RUN:
case UTEST_TIMED_OUT:
case UTEST_FAIL:
case UTEST_FAILED:
case UTEST_CRASHED:
return true;
default:
Expand Down Expand Up @@ -181,7 +181,7 @@ static void forked_start_exec(struct testcase *tc, struct testexec *te)
if (!valid_ret_code(rc)) {
fprintf(stderr, "Warning: testcase %s provided invalid "
"return code.\n", tc->name);
rc = UTEST_FAIL;
rc = UTEST_FAILED;
}
exit(ret_code_to_exit_code(rc));
} else {
Expand Down
22 changes: 11 additions & 11 deletions test/utest/utest.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#define UTEST_SUCCESS (0)
#define UTEST_NOT_RUN (-1)
#define UTEST_TIMED_OUT (-2)
#define UTEST_FAIL (-3)
#define UTEST_FAILED (-3)
#define UTEST_CRASHED (-4)

#include <errno.h>
Expand All @@ -25,7 +25,7 @@
fprintf(stderr, "\n%s:%d: Unexpected error code: %d " \
"(errno %d [%s])\n", __FILE__, __LINE__, err, errno, \
strerror(errno)); \
return UTEST_FAIL; \
return UTEST_FAILED; \
} \
} while(0)

Expand All @@ -34,7 +34,7 @@
if ((x) >= 0) { \
fprintf(stderr, "\n%s:%d: Unexpected success.\n", \
__FILE__, __LINE__); \
return UTEST_FAIL; \
return UTEST_FAILED; \
} \
} while(0)

Expand All @@ -44,7 +44,7 @@
fprintf(stderr, "\n%s:%d: Expected errno %s (%d), was %s (%d).\n", \
__FILE__, __LINE__, strerror(x), x, strerror(errno), \
errno); \
return UTEST_FAIL; \
return UTEST_FAILED; \
} \
} while(0)

Expand All @@ -55,7 +55,7 @@
if ((x) >= 0) { \
fprintf(stderr, "\n%s:%d: Unexpected success.\n", __FILE__, \
__LINE__); \
return UTEST_FAIL; \
return UTEST_FAILED; \
} \
CHKERRNOEQ(e2); \
} while(0)
Expand All @@ -66,7 +66,7 @@
if ((x) != NULL) { \
fprintf(stderr, "\n%s:%d: Unexpected success.\n", __FILE__, \
__LINE__); \
return UTEST_FAIL; \
return UTEST_FAILED; \
} \
CHKERRNOEQ(e); \
} while(0)
Expand All @@ -76,7 +76,7 @@
if (!(x)) { \
fprintf(stderr, "\n%s:%d: %s \"%s\" not true.\n", __FILE__, \
__LINE__, __func__, __STRING(x)); \
return UTEST_FAIL; \
return UTEST_FAILED; \
} \
} while(0)

Expand All @@ -86,7 +86,7 @@
fprintf(stderr, "\n%s:%d: %s \"%s\" not true.\n" msgfmt "\n", \
__FILE__, __LINE__, __func__, __STRING(x), \
## __VA_ARGS__); \
return UTEST_FAIL; \
return UTEST_FAILED; \
} \
} while(0)

Expand All @@ -95,7 +95,7 @@
if (strcmp(x,y)) { \
fprintf(stderr, "\n%s:%d: %s \"%s\" != \"%s\".\n", __FILE__, \
__LINE__, __func__, x, y); \
return UTEST_FAIL; \
return UTEST_FAILED; \
} \
} while(0)

Expand All @@ -105,7 +105,7 @@
fprintf(stderr, "\n%s:%d: %s \"%s\" != \"%s\" (<= %zd " \
"bytes considered).\n", __FILE__, \
__LINE__, __func__, x, y, (size_t)n); \
return UTEST_FAIL; \
return UTEST_FAILED; \
} \
} while(0)

Expand All @@ -116,7 +116,7 @@
if (ix != iy) { \
fprintf(stderr, "\n%s:%d: %s: %d != %d.\n", __FILE__, __LINE__, \
__func__, ix, iy); \
return UTEST_FAIL; \
return UTEST_FAILED; \
} \
} while(0)

Expand Down
2 changes: 1 addition & 1 deletion test/utest/utesthumanreport.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static void human_report_tc_end(struct utest_report *report,
cfprintf(report->output, color ? RED : NULL, "TIMED OUT");
report->timed_out++;
break;
case UTEST_FAIL:
case UTEST_FAILED:
cfprintf(report->output, color ? RED : NULL, "FAILED");
report->failed++;
break;
Expand Down
Loading

0 comments on commit bd42176

Please sign in to comment.