From 77ede52c9237e526217bc28a9674b1d7a44d8b18 Mon Sep 17 00:00:00 2001 From: Falk Werner Date: Fri, 13 Nov 2020 04:03:05 +0100 Subject: [PATCH] fix: set C/C++ versions to make unit tests compile on systems where gnu++11 (or higher) is not default --- meson.build | 5 +++-- test/webfuse/test_util/ws_client.cc | 16 ++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/meson.build b/meson.build index 7672adb..b2d8545 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,5 @@ -project('webfuse', 'c', 'cpp', version: '0.7.0', license: 'LGPL-3.0+') +project('webfuse', 'c', 'cpp', version: '0.7.0', license: 'LGPL-3.0+', + default_options: ['c_std=gnu99', 'cpp_std=gnu++14']) without_tests = get_option('without_tests') @@ -96,7 +97,7 @@ pkg_config.generate( if not without_tests -gtest_dep = dependency('gtest', version: '>=1.10.0', fallback: ['gtest', 'gtest_dep']) +gtest_dep = dependency('gtest', version: '>=1.10.0', fallback: ['gtest', 'gtest_dep']) gmock_main_dep = dependency('gmock_main', version: '>=1.10.0', fallback: ['gtest', 'gmock_main_dep']) fscheck = executable('fs_check', diff --git a/test/webfuse/test_util/ws_client.cc b/test/webfuse/test_util/ws_client.cc index af9cda2..9f5c7c3 100644 --- a/test/webfuse/test_util/ws_client.cc +++ b/test/webfuse/test_util/ws_client.cc @@ -145,7 +145,7 @@ public: lws_cancel_service(context); lock.lock(); - convar.wait_for(lock, TIMEOUT, [&]() { + convar.wait_for(lock, TIMEOUT, [&]() { return (conn_state != connection_state::connecting); }); @@ -162,7 +162,7 @@ public: lws_cancel_service(context); lock.lock(); - convar.wait_for(lock, TIMEOUT, [&]() { + convar.wait_for(lock, TIMEOUT, [&]() { return (conn_state != connection_state::disconnecting); }); @@ -239,7 +239,7 @@ public: { std::string result_text = handler_.Invoke(wf_impl_json_string_get(method), params); if (result_text.empty()) { throw std::runtime_error("empty"); } - response << "\"result\": " << result_text; + response << "\"result\": " << result_text; } catch (...) { @@ -351,7 +351,7 @@ private: if (nullptr != wsi) { lws_callback_on_writable(wsi); - } + } } break; default: @@ -364,14 +364,14 @@ private: { std::unique_lock lock(mutex); - command command = command::run; + command actual_command = command::run; if (!commands.empty()) { - command = commands.front(); + actual_command = commands.front(); commands.pop(); } - return command; + return actual_command; } lws * wsi_; @@ -424,4 +424,4 @@ std::string WsClient::Invoke(std::string const & message) } -} \ No newline at end of file +}