From 4e064b3a32e4d699a6494bf9d8dbcd7b8d9cbc64 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Fri, 6 Aug 2010 18:20:49 +0200 Subject: [PATCH] test: Make tests run in natural order When tests are registered, they are prepended to a list. Reverting the list, we get a list whose order is the same as that of registration. --- test/cairo-test-runner.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/cairo-test-runner.c b/test/cairo-test-runner.c index 5aea64322..539817ef5 100644 --- a/test/cairo-test-runner.c +++ b/test/cairo-test-runner.c @@ -125,6 +125,18 @@ _log (cairo_test_context_t *ctx, va_end (ap); } +static void +_tests_reverse () +{ + cairo_test_t *list, *next; + + for (list = tests, tests = NULL; list != NULL; list = next) { + next = list->next; + list->next = tests; + tests = list; + } +} + static cairo_test_list_t * _list_prepend (cairo_test_list_t *head, const cairo_test_t *test) { @@ -705,6 +717,7 @@ main (int argc, char **argv) #endif _cairo_test_runner_register_tests (); + _tests_reverse (); memset (&runner, 0, sizeof (runner)); runner.num_device_offsets = 1;