Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 |

Expand Down
5 changes: 3 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
2 changes: 0 additions & 2 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)')
Expand Down
51 changes: 28 additions & 23 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,60 +7,67 @@ 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'
subdir('certs')
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(
'run_'+test_name,
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

Expand All @@ -81,6 +88,4 @@ if cppcheck.found()
cppcheck_args
]
)
else
warning('Can\'t find Cppcheck')
endif
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.3.20220418
0.0.3.20220419