From: Peter Hutterer Date: Wed, 6 Mar 2019 03:56:01 +0000 (+1000) Subject: test: split the library version test out X-Git-Tag: 1.12.901~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0f4ede0c218f7a0290fb89b5101e5cbdf7f9cea;p=platform%2Fupstream%2Flibinput.git test: split the library version test out Signed-off-by: Peter Hutterer --- diff --git a/meson.build b/meson.build index 1063dfc8..cf41058e 100644 --- a/meson.build +++ b/meson.build @@ -800,6 +800,13 @@ if get_option('tests') install : false) test('test-litest-selftest', test_litest_selftest) + def_LT_VERSION = '-DLIBINPUT_LT_VERSION="@0@:@1@:@2@"'.format(libinput_lt_c, libinput_lt_r, libinput_lt_a) + test_library_version = executable('test-library-version', + ['test/test-library-version.c'], + c_args : [ def_LT_VERSION ], + install : false) + test('test-library-version', test_library_version) + libinput_test_runner_sources = litest_sources + [ 'src/libinput-util.h', 'src/libinput-util.c', @@ -822,12 +829,10 @@ if get_option('tests') 'test/test-switch.c', 'test/test-quirks.c', ] - def_LT_VERSION = '-DLIBINPUT_LT_VERSION="@0@:@1@:@2@"'.format(libinput_lt_c, libinput_lt_r, libinput_lt_a) libinput_test_runner = executable('libinput-test-suite-runner', libinput_test_runner_sources, include_directories : [includes_src, includes_include], dependencies : deps_litest, - c_args : [ def_LT_VERSION ], install : false) test('libinput-test-suite-runner', libinput_test_runner, diff --git a/test/test-library-version.c b/test/test-library-version.c new file mode 100644 index 00000000..b9f700fb --- /dev/null +++ b/test/test-library-version.c @@ -0,0 +1,23 @@ +#include +#include + +int main(void) { + const char *version = LIBINPUT_LT_VERSION; + int C, R, A; + int rc; + + rc = sscanf(version, "%d:%d:%d", &C, &R, &A); + assert(rc == 3); + + assert(C >= 17); + assert(R >= 0); + assert(A >= 7); + + /* Binary compatibility broken? */ + assert(R != 0 || A != 0); + + /* The first stable API in 0.12 had 10:0:0 */ + assert(C - A == 10); + + return 0; +} diff --git a/test/test-misc.c b/test/test-misc.c index 748c07bd..ce9e8190 100644 --- a/test/test-misc.c +++ b/test/test-misc.c @@ -1569,27 +1569,6 @@ START_TEST(fd_no_event_leak) } END_TEST -START_TEST(library_version) -{ - const char *version = LIBINPUT_LT_VERSION; - int C, R, A; - int rc; - - rc = sscanf(version, "%d:%d:%d", &C, &R, &A); - ck_assert_int_eq(rc, 3); - - ck_assert_int_ge(C, 17); - ck_assert_int_ge(R, 0); - ck_assert_int_ge(A, 7); - - /* Binary compatibility broken? */ - ck_assert(R != 0 || A != 0); - - /* The first stable API in 0.12 had 10:0:0 */ - ck_assert_int_eq(C - A, 10); -} -END_TEST - static void timer_offset_warning(struct libinput *libinput, enum libinput_log_priority priority, const char *format, @@ -1818,8 +1797,6 @@ TEST_COLLECTION(misc) litest_add_no_device("misc:fd", fd_no_event_leak); - litest_add_deviceless("misc:library_version", library_version); - litest_add_deviceless("misc:list", list_test_insert); litest_add_deviceless("misc:list", list_test_append); litest_add_deviceless("misc:versionsort", strverscmp_test);