diff --git a/README.md b/README.md index f093490f1..7492a92f2 100644 --- a/README.md +++ b/README.md @@ -207,7 +207,7 @@ $ meson compile -C build $ meson install -C build ``` -Optionally, you can also run the tests: +Optionally, you can also run the tests. You can skip tests requiring network access with `--no-suite=network`: ```sh $ meson test -C build @@ -221,8 +221,6 @@ Some other Meson options: | ----------------------------- | ------- | ---------------------------------------------- | | PISTACHE_USE_SSL | False | Build server with SSL support | | PISTACHE_BUILD_TESTS | False | Build all of the unit tests | -| PISTACHE_ENABLE_FLAKY_TESTS | True | Run unit tests that are known to be flaky | -| PISTACHE_ENABLE_NETWORK_TESTS | True | Run unit tests requiring remote network access | | PISTACHE_BUILD_EXAMPLES | False | Build all of the example apps | | PISTACHE_BUILD_DOCS | False | Build Doxygen docs | diff --git a/meson.build b/meson.build index 2bf297674..a911342f0 100644 --- a/meson.build +++ b/meson.build @@ -92,7 +92,8 @@ if meson.version().version_compare('>=0.57.0') else # Ugly workaround for reading a file version_array = run_command( - import('python').find_installation(), '-c', 'print(open("version.txt").read())' + find_program('python3'), '-c', 'print(open("version.txt").read())', + check: true ).stdout().strip().split('.') endif @@ -125,6 +126,6 @@ endif if not meson.is_subproject() git = find_program('git', required: false) if git.found() - run_command(git, 'config', '--local', 'core.hooksPath', meson.source_root()/'.hooks') + run_command(git, 'config', '--local', 'core.hooksPath', meson.source_root()/'.hooks', check: false) endif endif diff --git a/meson_options.txt b/meson_options.txt index c0ed5a538..37f60089d 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -3,8 +3,6 @@ # SPDX-License-Identifier: Apache-2.0 option('PISTACHE_BUILD_TESTS', type: 'boolean', value: false, description: 'build tests alongside the project') -option('PISTACHE_ENABLE_FLAKY_TESTS', type: 'boolean', value: true, description: 'if tests are built, run ones that are known to be flaky') -option('PISTACHE_ENABLE_NETWORK_TESTS', type: 'boolean', value: true, description: 'if tests are built, run ones needing network access') option('PISTACHE_BUILD_EXAMPLES', type: 'boolean', value: false, description: 'build examples alongside the project') option('PISTACHE_BUILD_DOCS', type: 'boolean', value: false, description: 'build docs alongside the project') option('PISTACHE_INSTALL', type: 'boolean', value: true, description: 'add pistache as install target (recommended)') diff --git a/tests/meson.build b/tests/meson.build index 8dad46078..832cdb80e 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -7,37 +7,36 @@ gtest_main_dep = dependency('gtest', main: true, fallback: ['gtest', 'gtest_main cpp_httplib_dep = dependency('cpp-httplib', fallback: ['cpp-httplib', 'cpp_httplib_dep']) pistache_test_files = [ - 'mime_test', - 'headers_test', 'async_test', - 'typeid_test', - 'router_test', 'cookie_test', 'cookie_test_2', 'cookie_test_3', - 'view_test', + 'headers_test', + 'http_client_test', 'http_parsing_test', - 'http_uri_test', 'http_server_test', - 'http_client_test', + 'http_uri_test', 'listener_test', + 'log_api_test', + 'mailbox_test', + 'mime_test', + 'net_test', + 'reactor_test', 'request_size_test', 'rest_server_test', - 'mailbox_test', + 'rest_swagger_server_test', + 'router_test', 'stream_test', - 'reactor_test', + 'streaming_test', + 'string_logger_test', 'threadname_test', - 'log_api_test', - 'string_logger_test' + 'typeid_test', + 'view_test', ] -if get_option('PISTACHE_ENABLE_NETWORK_TESTS') - pistache_test_files += 'net_test' -endif -if get_option('PISTACHE_ENABLE_FLAKY_TESTS') - pistache_test_files += 'streaming_test' - pistache_test_files += 'rest_swagger_server_test' -endif +network_tests = ['net_test'] + +flaky_tests = ['streaming_test', 'rest_swagger_server_test'] if get_option('PISTACHE_USE_SSL') pistache_test_files += 'https_server_test' @@ -45,6 +44,13 @@ if get_option('PISTACHE_USE_SSL') endif foreach test_name : pistache_test_files + suite = {} + if test_name in network_tests + suite = {'suite': 'network'} + elif test_name in flaky_tests + suite = {'suite': 'flaky'} + endif + test( test_name, executable( @@ -52,15 +58,16 @@ foreach test_name : pistache_test_files test_name+'.cc', dependencies: [ pistache_dep, + deps_libpistache, gtest_main_dep, curl_dep, - cpp_httplib_dep, - date_dep + cpp_httplib_dep ] ), timeout: 600, workdir: meson.current_build_dir(), - is_parallel: false + is_parallel: false, + kwargs: suite ) endforeach @@ -81,6 +88,4 @@ if cppcheck.found() cppcheck_args ] ) -else - warning('Can\'t find Cppcheck') endif diff --git a/version.txt b/version.txt index 335e40cd1..6326329a1 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.0.3.20220418 +0.0.3.20220419