diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d731c9f8493e2c43fccc93ac931512beda2d5ed9..c6c5eccc480ef8dae3b5ccd97984f43e00c3cd09 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,7 +38,7 @@ variables: TRIGGERED_BY_HASH: $CI_COMMIT_SHORT_SHA - # This is the caosdb-deploy branch which build the images for caosdb-server and caosdb-mysql + # This is the caosdb-deploy branch which builds the images for caosdb-server and caosdb-mysql DEPLOY_REF: dev DEFAULT_CAOSDB_TAG: dev diff --git a/Makefile b/Makefile index b9f64190d098669d2f2f1f20a645ac682510c442..c1475b8981e87126f9da9bb0357f8e5df296ae06 100644 --- a/Makefile +++ b/Makefile @@ -57,15 +57,24 @@ format: build-debug: conan-install-debug # cmake --preset conan-debug && cmake --build build/Debug # for CMake >= 3.23 + @command -v iwyu || command include-what-you-use || \ + (echo "Could not find 'iwyu', exiting."; exit 1) + @command -v clang-tidy || command -v clang-tidy-16 || \ + (echo "Could not find 'clang-tidy'(-16), exiting."; exit 1) cd build/Debug &&\ cmake -S ../.. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Debug &&\ cmake --build . build-release: conan-install-release # cmake --preset conan-release # for CMake >= 3.23 + @command -v iwyu || command include-what-you-use || \ + (echo "Could not find 'iwyu', exiting."; exit 1) + @command -v clang-tidy || command -v clang-tidy-16 || \ + (echo "Could not find 'clang-tidy'(-16), exiting."; exit 1) cd build/Release &&\ - cmake -S ../.. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release &&\ - cmake --build . + cmake -S ../.. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release &&\ + cmake --build . + # cmake --build . --verbose test-debug: build-debug @@ -77,4 +86,4 @@ test-release: build-release clean: rm -rf build -.PHONY: conan-install-debug conan-install-release build-debug build-release test-debug test-release \ No newline at end of file +.PHONY: conan-install-debug conan-install-release build-debug build-release test-debug test-release diff --git a/README.md b/README.md index e1680f34fb9064245ffe386a692a14a6d54a7f8f..510518c88a4dcb99280f6fea260229ba6ba8e3b6 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ Integration tests for linkahead-cpplib and the linkahead-server # Dependencies -* clang-tidy +* clang-tidy-16 * clang-format -* include-what-you-use +* iwyu / include-what-you-use * cmake * conan diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4c10d0de2c46c7738048404f04242eefa118afd7..9fcfff044d98b4b5129aa2db057e6caa4f8f809a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -80,7 +80,7 @@ if(LINTING) "-Xiwyu" "--cxx17ns") endif() - find_program(clang_tidy NAMES clang-tidy clang-tidy-11) + find_program(clang_tidy NAMES clang-tidy clang-tidy-16) if(NOT clang_tidy) message(WARNING "clang-tidy: Not found") else() diff --git a/test/test_async.cpp b/test/test_async.cpp index 2b5d3587d7eb404f7ccb40035bb5e34d80f17477..d42814463c9ea1758fed360eb8f4674539bd2619 100644 --- a/test/test_async.cpp +++ b/test/test_async.cpp @@ -24,11 +24,11 @@ #include "linkahead/status_code.h" // for StatusCode, SUCCESS #include "linkahead/transaction.h" // for Entity, Transaction #include "linkahead/transaction_status.h" // for TransactionStatus -#include <chrono> // for operator""ms, chrono_literals -#include <gtest/gtest-message.h> // for Message -#include <gtest/gtest-test-part.h> // for TestPartResult -#include <gtest/gtest_pred_impl.h> // for AssertionResult -#include <memory> // for allocator, unique_ptr, __shar... +#include <chrono> // for operator""ms, chrono_literals +#include <gtest/gtest-message.h> // for Message +#include <gtest/gtest-test-part.h> // for TestPartResult +#include <gtest/gtest_pred_impl.h> // for AssertionResult +#include <memory> // for allocator, unique_ptr, __shar... #include <thread> namespace linkahead::transaction { diff --git a/test/test_clinkahead.cpp b/test/test_clinkahead.cpp index 84cddd6ca76afda0352ecf09f4b651ba3497767e..9466d03686cf13fab6ed3e78d83bc0f75d1ca770 100644 --- a/test/test_clinkahead.cpp +++ b/test/test_clinkahead.cpp @@ -22,14 +22,14 @@ #include "linkahead/message_code.h" // for ENTITY_DOES_NOT_EXIST #include "linkahead/status_code.h" // for GO_ON, StatusCode #include "clinkahead.h" // for linkahead_connection_... -#include <chrono> // for filesystem -#include <cstring> // for strcmp -#include <filesystem> // for remove -#include <gtest/gtest-message.h> // for Message -#include <gtest/gtest-test-part.h> // for TestPartResult -#include <gtest/gtest_pred_impl.h> // for EXPECT_EQ, TestInfo -#include <iostream> // for operator<<, endl -#include <string> // for allocator, string +#include <chrono> // for filesystem +#include <cstring> // for strcmp +#include <filesystem> // for remove +#include <gtest/gtest-message.h> // for Message +#include <gtest/gtest-test-part.h> // for TestPartResult +#include <gtest/gtest_pred_impl.h> // for EXPECT_EQ, TestInfo +#include <iostream> // for operator<<, endl +#include <string> // for allocator, string namespace fs = std::filesystem; class test_clinkahead : public ::testing::Test { @@ -625,6 +625,7 @@ TEST_F(test_clinkahead, test_up_n_download_file) { EXPECT_EQ(return_code, 0); linkahead_transaction_result_set result_set; - return_code = linkahead_transaction_transaction_get_result_set(&retrieve_transaction_1, &result_set); + return_code = + linkahead_transaction_transaction_get_result_set(&retrieve_transaction_1, &result_set); EXPECT_EQ(return_code, 0); } diff --git a/test/test_connection.cpp b/test/test_connection.cpp index a0f2636b3e5751da99f9dedf16e847dcc146968c..687f08bc42fb6cb85d6bc000b4962b99770f8b6e 100644 --- a/test/test_connection.cpp +++ b/test/test_connection.cpp @@ -27,7 +27,7 @@ #include "linkahead/info.h" // for VersionInfo #include "linkahead/utility.h" // for get_env_fallback #include "linkahead_test_utility.h" // for EXPECT_THROW_MESSAGE -#include <filesystem> // for path +#include <filesystem> // for path #include <gtest/gtest_pred_impl.h> // NOLINT TODO how to fix this? for Test, TestInfo, TEST, EXPEC... #include <gtest/gtest-message.h> // for Message #include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestPartR... @@ -61,7 +61,8 @@ TEST(test_connection, connect_somehost_42347_fails) { } TEST(test_connection, connection_insecure_authentication_error_anonymous) { - const auto *port_str = linkahead::utility::get_env_fallback("CAOSDB_SERVER_GRPC_PORT_HTTP", "8080"); + const auto *port_str = + linkahead::utility::get_env_fallback("CAOSDB_SERVER_GRPC_PORT_HTTP", "8080"); auto port = std::stoi(port_str); const auto *const host = linkahead::utility::get_env_fallback("CAOSDB_SERVER_HOST", "localhost"); @@ -72,7 +73,8 @@ TEST(test_connection, connection_insecure_authentication_error_anonymous) { } TEST(test_connection, connection_ssl_authentication_error_anonymous) { - const auto *port_str = linkahead::utility::get_env_fallback("CAOSDB_SERVER_GRPC_PORT_HTTPS", "8443"); + const auto *port_str = + linkahead::utility::get_env_fallback("CAOSDB_SERVER_GRPC_PORT_HTTPS", "8443"); auto port = std::stoi(port_str); const auto *const host = linkahead::utility::get_env_fallback("CAOSDB_SERVER_HOST", "localhost"); const auto path = linkahead::utility::get_env_fallback("CAOSDB_SERVER_CERT", std::string()); @@ -88,7 +90,8 @@ TEST(test_connection, connection_ssl_authentication_error_anonymous) { } TEST(test_connection, connection_ssl_authentication_error_wrong_credentials) { - const auto *port_str = linkahead::utility::get_env_fallback("CAOSDB_SERVER_GRPC_PORT_HTTPS", "8443"); + const auto *port_str = + linkahead::utility::get_env_fallback("CAOSDB_SERVER_GRPC_PORT_HTTPS", "8443"); auto port = std::stoi(port_str); const auto *const host = linkahead::utility::get_env_fallback("CAOSDB_SERVER_HOST", "localhost"); const auto path = linkahead::utility::get_env_fallback("CAOSDB_SERVER_CERT", std::string()); diff --git a/test/test_issues.cpp b/test/test_issues.cpp index fd2eeb9efd695a5fa951d36999f039c4ce34541c..d1631b45b9836e9a337a6dd73bc12d8adc0cb6e8 100644 --- a/test/test_issues.cpp +++ b/test/test_issues.cpp @@ -22,15 +22,15 @@ #include "linkahead/entity.h" // for Entity, Parent, Role #include "linkahead/transaction.h" // for Transaction, Entity #include "linkahead/transaction_status.h" // for TransactionStatus -#include <cstdint> // for int32_t -#include <gtest/gtest-message.h> // for Message -#include <gtest/gtest-spi.h> // for EXPECT_NONFATAL_FA... -#include <gtest/gtest-test-part.h> // for TestPartResult -#include <gtest/gtest_pred_impl.h> // for AssertionResult -#include <iostream> // for operator<<, endl -#include <memory> // for unique_ptr, allocator -#include <string> // for operator+, operator<< -#include <vector> // for vector +#include <cstdint> // for int32_t +#include <gtest/gtest-message.h> // for Message +#include <gtest/gtest-spi.h> // for EXPECT_NONFATAL_FA... +#include <gtest/gtest-test-part.h> // for TestPartResult +#include <gtest/gtest_pred_impl.h> // for AssertionResult +#include <iostream> // for operator<<, endl +#include <memory> // for unique_ptr, allocator +#include <string> // for operator+, operator<< +#include <vector> // for vector namespace linkahead::transaction { using linkahead::entity::AtomicDataType; diff --git a/test/test_list_properties.cpp b/test/test_list_properties.cpp index 9708e3523a054caa4267a98fcf8f5e9076f8cfc1..d16e9aef05912c5950420fdbeebf3eb4154f8721 100644 --- a/test/test_list_properties.cpp +++ b/test/test_list_properties.cpp @@ -24,14 +24,14 @@ #include "linkahead/transaction.h" // for Entity, Transaction,... #include "linkahead/transaction_status.h" // for TransactionStatus, StatusCode #include "linkahead/value.h" // for value -#include <cstdint> // for int64_t -#include <gtest/gtest-message.h> // for Message -#include <gtest/gtest-test-part.h> // for TestPartResult, SuiteApiResolver -#include <gtest/gtest_pred_impl.h> // for Test, EXPECT_EQ, AssertionResult -#include <iostream> // for cout -#include <memory> // for unique_ptr, allocator, __shar... -#include <string> // for string -#include <vector> // for vector +#include <cstdint> // for int64_t +#include <gtest/gtest-message.h> // for Message +#include <gtest/gtest-test-part.h> // for TestPartResult, SuiteApiResolver +#include <gtest/gtest_pred_impl.h> // for Test, EXPECT_EQ, AssertionResult +#include <iostream> // for cout +#include <memory> // for unique_ptr, allocator, __shar... +#include <string> // for string +#include <vector> // for vector namespace linkahead::entity { diff --git a/test/test_properties.cpp b/test/test_properties.cpp index cc3f63d48fd14c0e757d01ffb200d951e4164fd4..040cc024933bf5739b95ba8b54d3d94dbf96d89a 100644 --- a/test/test_properties.cpp +++ b/test/test_properties.cpp @@ -23,10 +23,10 @@ #include "linkahead/entity.h" // for Entity, Properties, Property #include "linkahead/transaction.h" // for Transaction, ResultSet, Resul... #include "linkahead/transaction_status.h" // for TransactionStatus -#include <gtest/gtest-message.h> // for Message -#include <gtest/gtest-test-part.h> // for TestPartResult, SuiteApiResolver -#include <gtest/gtest_pred_impl.h> // for AssertionResult, EXPECT_EQ -#include <memory> // for unique_ptr, allocator, __shar... +#include <gtest/gtest-message.h> // for Message +#include <gtest/gtest-test-part.h> // for TestPartResult, SuiteApiResolver +#include <gtest/gtest_pred_impl.h> // for AssertionResult, EXPECT_EQ +#include <memory> // for unique_ptr, allocator, __shar... namespace linkahead::entity { diff --git a/test/test_select.cpp b/test/test_select.cpp index d8f630279f401905cea921e5156ef674be1c161b..ecbd5992a921e7c7e765995d09cce4199144a415 100644 --- a/test/test_select.cpp +++ b/test/test_select.cpp @@ -17,20 +17,20 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ -#include "linkahead/connection.h" // for Connection, ConnectionManager -#include "linkahead/data_type.h" // for AtomicDataType -#include "linkahead/entity.h" // for Entity, Property, Role, Parent -#include "linkahead/result_set.h" // for Entity, ResultSet, ResultSet::ite... -#include "linkahead/result_table.h" // for ResultTable::HeaderIterator, Resu... -#include "linkahead/transaction.h" // for Transaction, ResultTable -#include "linkahead/value.h" // for Value -#include <gtest/gtest-message.h> // for Message -#include <gtest/gtest-spi.h> // for EXPECT_NONFATAL_FA... -#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl -#include <gtest/gtest_pred_impl.h> // for Test, TestInfo, EXPECT_EQ, TEST -#include <iostream> // for operator<<, basic_ostream::operat... -#include <memory> // for allocator, unique_ptr, __shared_p... -#include <string> // for string +#include "linkahead/connection.h" // for Connection, ConnectionManager +#include "linkahead/data_type.h" // for AtomicDataType +#include "linkahead/entity.h" // for Entity, Property, Role, Parent +#include "linkahead/result_set.h" // for Entity, ResultSet, ResultSet::ite... +#include "linkahead/result_table.h" // for ResultTable::HeaderIterator, Resu... +#include "linkahead/transaction.h" // for Transaction, ResultTable +#include "linkahead/value.h" // for Value +#include <gtest/gtest-message.h> // for Message +#include <gtest/gtest-spi.h> // for EXPECT_NONFATAL_FA... +#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl +#include <gtest/gtest_pred_impl.h> // for Test, TestInfo, EXPECT_EQ, TEST +#include <iostream> // for operator<<, basic_ostream::operat... +#include <memory> // for allocator, unique_ptr, __shared_p... +#include <string> // for string namespace linkahead::transaction { using linkahead::entity::AtomicDataType; diff --git a/test/test_transaction.cpp b/test/test_transaction.cpp index 34a43486068c1248b7fd2b69d19731ea6fa7c2fd..4e0a996ae6116979069d83ba30e0f0a333d236f0 100644 --- a/test/test_transaction.cpp +++ b/test/test_transaction.cpp @@ -30,20 +30,20 @@ #include "linkahead/transaction.h" // for Entity, Transaction #include "linkahead/transaction_status.h" // for TransactionStatus #include "linkahead/value.h" // for Value -#include <chrono> // for filesystem -#include <cstddef> // for size_t -#include <cstdint> // for int64_t, int32_t -#include <filesystem> // for path -#include <gtest/gtest-message.h> // for Message -#include <gtest/gtest-test-part.h> // for TestPartResult -#include <gtest/gtest_pred_impl.h> // for AssertionResult -#include <initializer_list> // for initializer_list -#include <iostream> // for operator<<, endl -#include <limits> // for numeric_limits -#include <memory> // for unique_ptr, allocator -#include <stdexcept> // for logic_error -#include <string> // for string, operator+ -#include <vector> // for vector, operator!= +#include <chrono> // for filesystem +#include <cstddef> // for size_t +#include <cstdint> // for int64_t, int32_t +#include <filesystem> // for path +#include <gtest/gtest-message.h> // for Message +#include <gtest/gtest-test-part.h> // for TestPartResult +#include <gtest/gtest_pred_impl.h> // for AssertionResult +#include <initializer_list> // for initializer_list +#include <iostream> // for operator<<, endl +#include <limits> // for numeric_limits +#include <memory> // for unique_ptr, allocator +#include <stdexcept> // for logic_error +#include <string> // for string, operator+ +#include <vector> // for vector, operator!= namespace fs = std::filesystem; namespace linkahead::transaction { diff --git a/test/test_user.cpp b/test/test_user.cpp index 7817aff09b180ef38d83bc52a18cd9a516e23b45..ccfc9d1ab2c3d153d65697ef9cbb06ada32fba79 100644 --- a/test/test_user.cpp +++ b/test/test_user.cpp @@ -18,15 +18,15 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ -#include "linkahead/acm/user.h" // for User -#include "linkahead/connection.h" // for Connection, VersionInfo, path -#include "linkahead/exceptions.h" // for TransactionError -#include "linkahead_test_utility.h" // for EXPECT_THROW_MESSAGE -#include <gtest/gtest-message.h> // for Message -#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestPartR... -#include <gtest/gtest_pred_impl.h> // for Test, TestInfo, TEST, EXPEC... -#include <memory> // for allocator, unique_ptr, __sh... -#include <string> // for stoi, string +#include "linkahead/acm/user.h" // for User +#include "linkahead/connection.h" // for Connection, VersionInfo, path +#include "linkahead/exceptions.h" // for TransactionError +#include "linkahead_test_utility.h" // for EXPECT_THROW_MESSAGE +#include <gtest/gtest-message.h> // for Message +#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestPartR... +#include <gtest/gtest_pred_impl.h> // for Test, TestInfo, TEST, EXPEC... +#include <memory> // for allocator, unique_ptr, __sh... +#include <string> // for stoi, string namespace linkahead::connection { using linkahead::acm::User;