From 94a8eb8ae52bcc26175e736bbfe055d136c59a6e Mon Sep 17 00:00:00 2001 From: Jerome Kelleher Date: Wed, 1 Dec 2021 14:18:21 +0000 Subject: [PATCH] Add test for version number and bump to 1.0.2 --- c/VERSION | 2 +- c/kastore.h | 2 +- c/meson.build | 7 ++++--- c/tests.c | 12 ++++++++++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/c/VERSION b/c/VERSION index 10bf840..e9307ca 100644 --- a/c/VERSION +++ b/c/VERSION @@ -1 +1 @@ -2.0.1 \ No newline at end of file +2.0.2 diff --git a/c/kastore.h b/c/kastore.h index a4f79eb..e8aad75 100644 --- a/c/kastore.h +++ b/c/kastore.h @@ -153,7 +153,7 @@ to the API or ABI are introduced, i.e., the addition of a new function. The library patch version. Incremented when any changes not relevant to the to the API or ABI are introduced, i.e., internal refactors of bugfixes. */ -#define KAS_VERSION_PATCH 1 +#define KAS_VERSION_PATCH 2 /** @} */ #define KAS_HEADER_SIZE 64 diff --git a/c/meson.build b/c/meson.build index c129bf4..e1a83bb 100644 --- a/c/meson.build +++ b/c/meson.build @@ -15,9 +15,9 @@ if not meson.is_subproject() endif # Subprojects should compile in the static library for simplicity. -inc = include_directories('.') +kastore_inc = include_directories('.') kastore = static_library('kastore', 'kastore.c') -kastore_dep = declare_dependency(link_with : kastore, include_directories: inc) +kastore_dep = declare_dependency(link_with : kastore, include_directories: kastore_inc) if not meson.is_subproject() @@ -30,7 +30,8 @@ if not meson.is_subproject() # being run from the current working directory because of the paths # to example files. cunit_dep = dependency('cunit') - executable('tests', ['tests.c', 'kastore.c'], dependencies: cunit_dep) + executable('tests', ['tests.c', 'kastore.c'], dependencies: cunit_dep, + c_args: ['-DMESON_VERSION="@0@"'.format(meson.project_version())]) executable('cpp_tests', ['cpp_tests.cpp'], link_with: kastore) diff --git a/c/tests.c b/c/tests.c index 49676ae..d594abb 100644 --- a/c/tests.c +++ b/c/tests.c @@ -1573,6 +1573,17 @@ test_library_version(void) CU_ASSERT_EQUAL_FATAL(version.patch, KAS_VERSION_PATCH); } +static void +test_meson_version(void) +{ + char version[100]; + + sprintf( + version, "%d.%d.%d", KAS_VERSION_MAJOR, KAS_VERSION_MINOR, KAS_VERSION_PATCH); + /* the MESON_VERSION define is passed in by meson when compiling */ + CU_ASSERT_STRING_EQUAL(version, MESON_VERSION); +} + /*================================================= Test suite management ================================================= @@ -1685,6 +1696,7 @@ main(int argc, char **argv) { "test_truncated_file_correct_size", test_truncated_file_correct_size }, { "test_all_types_n_elements", test_all_types_n_elements }, { "test_library_version", test_library_version }, + { "test_meson_version", test_meson_version }, CU_TEST_INFO_NULL, };