From: Bartosz Golaszewski Date: Tue, 30 Jul 2019 11:53:13 +0000 (+0200) Subject: tests: setup libgpiomockup before checking the kernel version X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=cb5991fe4b3b6582b3399ed1e410c52f2c2e985b;p=qemu-gpiodev%2Flibgpiod.git tests: setup libgpiomockup before checking the kernel version The gpio-mockup helper library checks the kernel version itself when creating the context object. We then check the version again (as the minimum versions for libgpiomockup and the test-suite may differ) in the test-suite's main function. Make sure the library runs the check first as we don't want to tell the user the version is OK and then fail because it isn't... Signed-off-by: Bartosz Golaszewski --- diff --git a/tests/gpiod-test.c b/tests/gpiod-test.c index f75173c..d003c1c 100644 --- a/tests/gpiod-test.c +++ b/tests/gpiod-test.c @@ -857,13 +857,13 @@ int main(int argc TEST_UNUSED, char **argv TEST_UNUSED) msg("libgpiod test suite"); msg("%u tests registered", globals.num_tests); - check_kernel(); - check_tool_path(); - globals.mockup = gpio_mockup_new(); if (!globals.mockup) die_perr("error checking the availability of gpio-mockup"); + check_kernel(); + check_tool_path(); + msg("running tests"); for (test = globals.test_list_head; test; test = test->_next) {