Skip to content
Snippets Groups Projects
Verified Commit 343c4fbc authored by Timm Fitschen's avatar Timm Fitschen
Browse files

Merge branch 'f-pedantic' into f-error-handling

parents 685649c3 b1eaa443
No related branches found
No related tags found
1 merge request!2Error handling
This commit is part of merge request !2. Comments created here will be created in the context of that merge request.
......@@ -42,9 +42,6 @@ string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_LIBS
string(REGEX REPLACE "grpc\\+?\\+?_unsecure" "" CONAN_PKG_LIBS
"${CONAN_PKG_LIBS}")
# ignore some warnings here
add_compile_options(-Wno-unused-parameter -Wno-unused-result -g)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
enable_testing()
......
......@@ -27,11 +27,39 @@ set(test_cases
test_ccaosdb
)
include(CheckCXXCompilerFlag)
include(CheckCCompilerFlag)
function(add_compiler_flag flag)
string(FIND "${CMAKE_CXX_FLAGS}" "${flag}" cxx_present)
if(cxx_present EQUAL -1)
check_cxx_compiler_flag("${flag}" flag_supported)
if(flag_supported)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}" PARENT_SCOPE)
endif()
unset(flag_supported CACHE)
endif()
unset(cxx_present CACHE)
endfunction()
### but ignore these
add_compiler_flag("-Wno-unused-parameter")
add_compiler_flag("-Wno-unused-result")
add_compiler_flag("-g")
#######################################################
### Linting with clang-tidy and include-what-you-use
#######################################################
option(LINTING "clang-tidy and iwye" ON)
if(LINTING)
### set paranoid compiler flags
#add_compiler_flag("-Wall")
#add_compiler_flag("-Wextra")
#add_compiler_flag("-pedantic")
#add_compiler_flag("-Werror")
find_program(iwyu
NAMES include-what-you-use iwyu
PATHS ${CMAKE_SOURCE_DIR}/tools/include-what-you-use/${iwyu_os}/bin)
......@@ -54,7 +82,7 @@ if(LINTING)
"--warnings-as-errors=*"
"--fix")
set(_CMAKE_CXX_CLANG_TIDY_CHECKS
"--checks=*,-fuchsia-*,-llvm-include-order,-llvmlibc-*,-cert-err58-cpp,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-owning-memory,-modernize-use-trailing-return-type,-google-readability-avoid-underscore-in-googletest-name,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-cppcoreguidelines-avoid-goto,-hicpp-avoid-goto")
"--checks=*,-fuchsia-*,-llvmlibc-*,-cert-err58-cpp,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-owning-memory,-modernize-use-trailing-return-type,-google-readability-avoid-underscore-in-googletest-name,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-cppcoreguidelines-avoid-goto,-hicpp-avoid-goto")
endif()
else()
message(STATUS "LINTING is OFF")
......
......@@ -17,11 +17,11 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <memory> // for allocator, unique_ptr
#include "ccaosdb.h" // for caosdb_info_version_info, caosdb_...
#include "gtest/gtest-message.h" // for Message
#include "gtest/gtest-test-part.h" // for TestPartResult
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, SuiteApiResolver
#include <memory> // for allocator, unique_ptr
TEST(test_ccaosdb, connection_ssl_authentication_success) {
......
......@@ -18,21 +18,27 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include <gtest/gtest-message.h> // for Message
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestPartResult
#include <memory> // for make_shared, allocator, shared_ptr
#include <string> // for string
#include "caosdb/authentication.h" // for PlainPasswordAuthenticator
#include "caosdb/connection.h" // for InsecureConnectionConfiguration
#include "caosdb/exceptions.h" // for AuthenticationError, ConnectionError
#include "caosdb/info.h" // for VersionInfo
#include "caosdb/utility.h" // for get_env_var
#include "gtest/gtest_pred_impl.h" // for Test, TEST, EXPECT_EQ, EXPECT_THROW
#include "caosdb_test_utility.h"
#include "caosdb/constants.h"
#include <gtest/gtest-message.h> // for Message
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestPartR...
#include <memory> // for allocator, unique_ptr, __sh...
#include <string> // for stoi, string
#include "boost/filesystem/path.hpp" // for path
#include "caosdb/authentication.h" // for PlainPasswordAuthenticator
#include "caosdb/certificate_provider.h" // for PemFileCertificateProvider
#include "caosdb/configuration.h" // for InsecureConnectionConfigura...
#include "caosdb/connection.h" // for Connection, VersionInfo, path
#include "caosdb/constants.h" // for COMPATIBLE_SERVER_VERSION_M...
#include "caosdb/exceptions.h" // for AuthenticationError, Connec...
#include "caosdb/info.h" // for VersionInfo
#include "caosdb/utility.h" // for get_env_var
#include "caosdb_test_utility.h" // for EXPECT_THROW_MESSAGE
#include "gtest/gtest_pred_impl.h" // for Test, TestInfo, TEST, EXPEC...
namespace caosdb::connection {
using caosdb::authentication::PlainPasswordAuthenticator;
using caosdb::configuration::InsecureConnectionConfiguration;
using caosdb::configuration::PemFileCertificateProvider;
using caosdb::configuration::TlsConnectionConfiguration;
using caosdb::exceptions::AuthenticationError;
using caosdb::exceptions::ConnectionError;
......
......@@ -18,13 +18,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include <gtest/gtest-message.h> // for Message
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl
#include <memory> // for allocator, static_pointer_cast
#include "caosdb/connection.h" // for CaosDBConnection
#include "caosdb/entity.h" // for Entity, EntityID
#include "caosdb/transaction.h" // for Transaction, UniqueResult, Entity
#include <gtest/gtest-message.h> // for Message
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl
#include "gtest/gtest_pred_impl.h" // for Test, TestInfo, EXPECT_EQ, TEST
#include <memory> // for allocator, static_pointer_cast
namespace caosdb::transaction {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment