Skip to content

Commit 8680999

Browse files
acmelnamhyung
authored andcommitted
perf test: Use TEST_FAIL in the TEST_ASSERT macros instead of -1
Just to make things clearer, return TEST_FAIL (-1) instead of an open coded -1. Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Reviewed-by: Ian Rogers <[email protected]> Signed-off-by: Namhyung Kim <[email protected]> Link: https://lore.kernel.org/r/ZdepeMsjagbf1ufD@x1
1 parent bae4d1f commit 8680999

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tools/perf/tests/tests.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44

55
#include <stdbool.h>
66

7+
enum {
8+
TEST_OK = 0,
9+
TEST_FAIL = -1,
10+
TEST_SKIP = -2,
11+
};
12+
713
#define TEST_ASSERT_VAL(text, cond) \
814
do { \
915
if (!(cond)) { \
1016
pr_debug("FAILED %s:%d %s\n", __FILE__, __LINE__, text); \
11-
return -1; \
17+
return TEST_FAIL; \
1218
} \
1319
} while (0)
1420

@@ -17,16 +23,10 @@ do { \
1723
if (val != expected) { \
1824
pr_debug("FAILED %s:%d %s (%d != %d)\n", \
1925
__FILE__, __LINE__, text, val, expected); \
20-
return -1; \
26+
return TEST_FAIL; \
2127
} \
2228
} while (0)
2329

24-
enum {
25-
TEST_OK = 0,
26-
TEST_FAIL = -1,
27-
TEST_SKIP = -2,
28-
};
29-
3030
struct test_suite;
3131

3232
typedef int (*test_fnptr)(struct test_suite *, int);

0 commit comments

Comments
 (0)