tests: rename struct weston_test to weston_test_entry

This avoids confusing it with the opaque struct weston_test from
protocol/weston-test.xml.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 5 years ago
parent 54c03dfe51
commit 48d2c15ad6
  1. 17
      tests/weston-test-runner.c
  2. 4
      tests/weston-test-runner.h

@ -40,7 +40,7 @@
char __attribute__((weak)) *server_parameters=""; char __attribute__((weak)) *server_parameters="";
extern const struct weston_test __start_test_section, __stop_test_section; extern const struct weston_test_entry __start_test_section, __stop_test_section;
static const char *test_name_; static const char *test_name_;
@ -60,10 +60,10 @@ testlog(const char *fmt, ...)
va_end(argp); va_end(argp);
} }
static const struct weston_test * static const struct weston_test_entry *
find_test(const char *name) find_test(const char *name)
{ {
const struct weston_test *t; const struct weston_test_entry *t;
for (t = &__start_test_section; t < &__stop_test_section; t++) for (t = &__start_test_section; t < &__stop_test_section; t++)
if (strcmp(t->name, name) == 0) if (strcmp(t->name, name) == 0)
@ -73,7 +73,7 @@ find_test(const char *name)
} }
static void static void
run_test(const struct weston_test *t, void *data, int iteration) run_test(const struct weston_test_entry *t, void *data, int iteration)
{ {
char str[512]; char str[512];
@ -91,7 +91,7 @@ run_test(const struct weston_test *t, void *data, int iteration)
static void static void
list_tests(void) list_tests(void)
{ {
const struct weston_test *t; const struct weston_test_entry *t;
fprintf(stderr, "Available test names:\n"); fprintf(stderr, "Available test names:\n");
for (t = &__start_test_section; t < &__stop_test_section; t++) for (t = &__start_test_section; t < &__stop_test_section; t++)
@ -100,7 +100,8 @@ list_tests(void)
/* iteration is valid only if test_data is not NULL */ /* iteration is valid only if test_data is not NULL */
static int static int
exec_and_report_test(const struct weston_test *t, void *test_data, int iteration) exec_and_report_test(const struct weston_test_entry *t,
void *test_data, int iteration)
{ {
int success = 0; int success = 0;
int skip = 0; int skip = 0;
@ -159,7 +160,7 @@ exec_and_report_test(const struct weston_test *t, void *test_data, int iteration
* table_data = NULL. * table_data = NULL.
*/ */
static int static int
iterate_test(const struct weston_test *t, int *passed, int *skipped) iterate_test(const struct weston_test_entry *t, int *passed, int *skipped)
{ {
int ret, i; int ret, i;
void *current_test_data = (void *) t->table_data; void *current_test_data = (void *) t->table_data;
@ -177,7 +178,7 @@ iterate_test(const struct weston_test *t, int *passed, int *skipped)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
const struct weston_test *t; const struct weston_test_entry *t;
int total = 0; int total = 0;
int pass = 0; int pass = 0;
int skip = 0; int skip = 0;

@ -38,7 +38,7 @@
#error "Tests must not be built with NDEBUG defined, they rely on assert()." #error "Tests must not be built with NDEBUG defined, they rely on assert()."
#endif #endif
struct weston_test { struct weston_test_entry {
const char *name; const char *name;
void (*run)(void *); void (*run)(void *);
const void *table_data; const void *table_data;
@ -53,7 +53,7 @@ struct weston_test {
#define TEST_COMMON(func, name, ret, data, size, n_elem) \ #define TEST_COMMON(func, name, ret, data, size, n_elem) \
static void func(void *); \ static void func(void *); \
\ \
const struct weston_test 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, ret \

Loading…
Cancel
Save