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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ add_compile_options(-Wall -Wextra -Wpedantic -Wconversion -Wno-sign-conversion -

option(BUILD_SHARED_LIBS "build shared library" ON)
option(PISTACHE_BUILD_TESTS "build tests alongside the project" OFF)
option(PISTACHE_ENABLE_FLAKY_TESTS "if tests are built, also run ones that are known to be flaky" ON)
option(PISTACHE_ENABLE_NETWORK_TESTS "if tests are built, run ones needing network access" ON)
option(PISTACHE_USE_SSL "add support for SSL server" OFF)
option(PISTACHE_PIC "Enable pistache PIC" ON)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ 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
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# 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')
Expand Down
8 changes: 6 additions & 2 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ pistache_test_files = [
'http_client_test',
'listener_test',
'request_size_test',
'streaming_test',
'rest_server_test',
'rest_swagger_server_test',
'mailbox_test',
'stream_test',
'reactor_test',
Expand All @@ -35,6 +33,12 @@ pistache_test_files = [
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

Comment on lines +36 to +41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have instead suggested defining these as test(..., suite: ['flaky']), so that people can select the tests at will with meson test --no-suite flaky. It is also possible to make meson test without arguments default to not running a suite:

add_test_setup(
    'noflaky',
    exclude_suites: ['flaky'],
    is_default: true,     # run this one without `meson test --setup noflaky`
)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's cool, and certainly better than having to reconfigure your build to skip flaky tests.

@kiplingw for this to work in the Ubuntu PPA we would need to bump debhelper-compat to version 13, as version 12 and below run ninja test instead of meson test

Copy link
Contributor

@eli-schwartz eli-schwartz Apr 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add_test_setup() works well with ninja test too. :)

(No idea how debian packaging works, so no clue whether bumping debhelper can cause compat issues.)

EDIT: though unfortunately it has the opposite problem -- it raises the minimum meson to 0.57 for exclude_suite.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it would force us to skip flaky tests by default, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eli-schwartz, I think your solution is much more elegant. If you'd like to submit a PR, I'm totally fine with that.

@Tachi107, yes, I recall we'd have to bump the debhelper-compat version. I'm fine with that, but will that break all unit tests?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tachi107, yes, I recall we'd have to bump the debhelper-compat version. I'm fine with that, but will that break all unit tests?

No, but it might break compatibility with old Ubuntu releases. I don't know if the build tools of older Ubuntu versions get upgraded to support newer debhelper-compat versions. But we could at least try

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to give it a try?

I also think the approach of flagging flaky tests as flaky in the build environment is much better than what I proposed. That way they still run, but the entire build environment doesn't break in the interim while we wait for fixes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think the approach of flagging flaky tests as flaky in the build environment is much better than what I proposed. That way they still run, but the entire build environment doesn't break in the interim while we wait for fixes.

No, they wouldn't run, but you would be able to easily skip them with --no-suite flaky. An alternative that would run still run them but wouldn't mark their failure as such would be to mark them with should_fail: true.

I've submitted a PR that implements what Eli suggested as #1052

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok perfect. If you could add to your PR to override override_dh_auto_test in d/rules so that --no-suite flaky is added, then it should work.

if get_option('PISTACHE_USE_SSL')
pistache_test_files += 'https_server_test'
subdir('certs')
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.3.20220225
0.0.3.20220418