tests: drop FAIL_TEST

Nothing is using FAIL_TEST or FAIL_TEST_P and that is good. Remove them to not
encourage using them.

If we need a test that should fail, it always needs to fail in a very specific
way which needs to be checked. For this we have e.g. expect_protocol_error().
We never want a fail-test to pass because it failed in a way we did not expect.
Therefore these macros are useless.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 5 years ago
parent e4f6f8c6de
commit b544ac3ab4
  1. 3
      tests/weston-test-runner.c
  2. 19
      tests/weston-test-runner.h

@ -140,9 +140,6 @@ exec_and_report_test(const struct weston_test_entry *t,
break; break;
} }
if (t->must_fail)
success = !success;
if (success && !hardfail) { if (success && !hardfail) {
fprintf(stderr, ", pass.\n"); fprintf(stderr, ", pass.\n");
return 1; return 1;

@ -44,23 +44,22 @@ struct weston_test_entry {
const void *table_data; const void *table_data;
size_t element_size; size_t element_size;
int n_elements; int n_elements;
int must_fail;
} __attribute__ ((aligned (32))); } __attribute__ ((aligned (32)));
#define TEST_BEGIN(name, arg) \ #define TEST_BEGIN(name, arg) \
static void name(arg) static void name(arg)
#define TEST_COMMON(func, name, ret, data, size, n_elem) \ #define TEST_COMMON(func, name, data, size, n_elem) \
static void func(void *); \ static void func(void *); \
\ \
const struct weston_test_entry test##name \ const struct weston_test_entry test##name \
__attribute__ ((used, section ("test_section"))) = \ __attribute__ ((used, section ("test_section"))) = \
{ \ { \
#name, func, data, size, n_elem, ret \ #name, func, data, size, n_elem \
}; };
#define NO_ARG_TEST(name, ret) \ #define NO_ARG_TEST(name) \
TEST_COMMON(wrap##name, name, ret, NULL, 0, 1) \ TEST_COMMON(wrap##name, name, NULL, 0, 1) \
static void name(void); \ static void name(void); \
static void wrap##name(void *data) \ static void wrap##name(void *data) \
{ \ { \
@ -70,16 +69,14 @@ struct weston_test_entry {
\ \
TEST_BEGIN(name, void) TEST_BEGIN(name, void)
#define ARG_TEST(name, ret, test_data) \ #define ARG_TEST(name, test_data) \
TEST_COMMON(name, name, ret, test_data, \ TEST_COMMON(name, name, test_data, \
sizeof(test_data[0]), \ sizeof(test_data[0]), \
ARRAY_LENGTH(test_data)) \ ARRAY_LENGTH(test_data)) \
TEST_BEGIN(name, void *data) \ TEST_BEGIN(name, void *data) \
#define TEST(name) NO_ARG_TEST(name, 0) #define TEST(name) NO_ARG_TEST(name)
#define FAIL_TEST(name) NO_ARG_TEST(name, 1) #define TEST_P(name, data) ARG_TEST(name, data)
#define TEST_P(name, data) ARG_TEST(name, 0, data)
#define FAIL_TEST_P(name, data) ARG_TEST(name, 1, data)
void void
testlog(const char *fmt, ...) WL_PRINTF(1, 2); testlog(const char *fmt, ...) WL_PRINTF(1, 2);

Loading…
Cancel
Save