From fced835214416d60f5c0b7351af8f14e927f813b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 19:18:31 +0200 Subject: [PATCH 01/19] Update CI to run on Ubuntu 22.04 --- .github/workflows/ci.yml | 17 ++++++++--------- tool/format.sh | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d87b12b..c0c2d3b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,13 +4,13 @@ on: [push] jobs: clang_check: - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 steps: - name: Set-up repository uses: actions/checkout@v2 - name: Install environment run: | - sudo apt install -y clang-format-8 + sudo apt install -y clang-format-14 - name: Run clang formatter run: | ./tool/format.sh @@ -39,10 +39,9 @@ jobs: build_and_test_linux: strategy: matrix: - platform: [ubuntu-18.04] + platform: [ubuntu-18.04, ubuntu-22.04] + mgversion: ["2.0.0", "2.3.0"] runs-on: ${{ matrix.platform }} - env: - MG_VERSION: "1.4.0" steps: - name: Set-up repository uses: actions/checkout@v1 @@ -60,7 +59,7 @@ jobs: if: steps.cache-memgraph-docker.outputs.cache-hit != 'true' run: | mkdir ~/memgraph - curl -L https://memgraph.com/download/memgraph/v${MG_VERSION}/docker/memgraph-${MG_VERSION}-community-docker.tar.gz > ~/memgraph/memgraph-docker.tar.gz + curl -L https://memgraph.com/download/memgraph/v${MG_VERSION}/docker/memgraph-${{ matrix.mgversion }}-community-docker.tar.gz > ~/memgraph/memgraph-docker.tar.gz - name: Load and run Memgraph Docker image run: | docker load -i ~/memgraph/memgraph-docker.tar.gz @@ -69,14 +68,14 @@ jobs: - name: Build with gcc, test and install mgclient run: | mkdir build-gcc && cd build-gcc - cmake -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DBUILD_TESTING_INTEGRATION=ON -DC_WARNINGS_AS_ERRORS=ON -DCPP_WARNINGS_AS_ERRORS=ON .. + cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DBUILD_TESTING_INTEGRATION=ON -DC_WARNINGS_AS_ERRORS=ON -DCPP_WARNINGS_AS_ERRORS=ON .. make ctest --output-on-failure sudo make install - name: Build with clang, test and install mgclient run: | mkdir build-clang && cd build-clang - cmake -DCMAKE_C_COMPILER=clang-8 -DCMAKE_CXX_COMPILER=clang++-8 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DBUILD_TESTING_INTEGRATION=ON -DC_WARNINGS_AS_ERRORS=ON -DCPP_WARNINGS_AS_ERRORS=ON .. + cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DBUILD_TESTING_INTEGRATION=ON -DC_WARNINGS_AS_ERRORS=ON -DCPP_WARNINGS_AS_ERRORS=ON .. make ctest --output-on-failure sudo make install @@ -140,7 +139,7 @@ jobs: - name: Build with clang run: | - mkdir build + mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release -DC_WARNINGS_AS_ERRORS=ON -DWASM=ON make diff --git a/tool/format.sh b/tool/format.sh index 296ef9b..f6915ab 100755 --- a/tool/format.sh +++ b/tool/format.sh @@ -7,7 +7,7 @@ cd "$DIR/.." ALL_FILES_TO_CHECK=$(find . -type f -regex ".*\.\(cpp\|hpp\|c\|h\)$" -print | paste -sd " ") for file in ${ALL_FILES_TO_CHECK}; do - clang-format-8 -i -verbose "${file}" + clang-format-14 -i -verbose "${file}" done changes="$(git diff)" if [[ ! -z "${changes}" ]]; then From e0bcd1156292fdb7d82d8de87c301f9a7ddb6351 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 19:27:17 +0200 Subject: [PATCH 02/19] Fix include order and its formatting --- .clang-format | 1 + src/apple/mgsocket.c | 3 ++- src/mgsession.c | 3 ++- src/mgtransport.h | 5 +++-- src/windows/mgsocket.c | 4 ++-- tests/decoder.cpp | 3 ++- tests/encoder.cpp | 3 ++- tests/transport.cpp | 6 +++--- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.clang-format b/.clang-format index 45ccffe..ec2cf0e 100644 --- a/.clang-format +++ b/.clang-format @@ -6,4 +6,5 @@ UseTab: Never DerivePointerAlignment: false PointerAlignment: Right ColumnLimit: 80 +IncludeBlocks: Preserve ... diff --git a/src/apple/mgsocket.c b/src/apple/mgsocket.c index 529ef46..0805879 100644 --- a/src/apple/mgsocket.c +++ b/src/apple/mgsocket.c @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "mgsocket.h" + #include #include "mgcommon.h" -#include "mgsocket.h" #define MG_RETRY_ON_EINTR(expression) \ __extension__({ \ diff --git a/src/mgsession.c b/src/mgsession.c index f2043e7..69b0d88 100644 --- a/src/mgsession.c +++ b/src/mgsession.c @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "mgsession.h" + #include #include #include @@ -26,7 +28,6 @@ #include "mgcommon.h" #include "mgconstants.h" -#include "mgsession.h" #include "mgtransport.h" int mg_session_status(const mg_session *session) { diff --git a/src/mgtransport.h b/src/mgtransport.h index 615b0f5..39163dc 100644 --- a/src/mgtransport.h +++ b/src/mgtransport.h @@ -19,14 +19,15 @@ extern "C" { #endif +#include +#include + #ifndef __EMSCRIPTEN__ #include #include #include #endif -#include -#include #include "mgallocator.h" #include "mgcommon.h" diff --git a/src/windows/mgsocket.c b/src/windows/mgsocket.c index 353eda0..95da20b 100644 --- a/src/windows/mgsocket.c +++ b/src/windows/mgsocket.c @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include "mgsocket.h" +#include + // Please refer to https://docs.microsoft.com/en-us/windows/win32/api/winsock2/ // for more details about Windows system calls. diff --git a/tests/decoder.cpp b/tests/decoder.cpp index 4317036..721b080 100644 --- a/tests/decoder.cpp +++ b/tests/decoder.cpp @@ -12,12 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include #include +#include + #include "mgclient.h" #include "mgcommon.h" #include "mgsession.h" diff --git a/tests/encoder.cpp b/tests/encoder.cpp index 816ed5b..e2b517c 100644 --- a/tests/encoder.cpp +++ b/tests/encoder.cpp @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include +#include + #include "mgclient.h" #include "mgcommon.h" #include "mgconstants.h" diff --git a/tests/transport.cpp b/tests/transport.cpp index 42c54eb..511c193 100644 --- a/tests/transport.cpp +++ b/tests/transport.cpp @@ -14,15 +14,15 @@ // TODO(mtomic): Maybe add test for raw transport. -#include -#include - #include #include #include #include #include +#include +#include + #if MGCLIENT_ON_WINDOWS // NOTE: // https://stackoverflow.com/questions/49504648/x509-name-macro-in-c-wont-compile From 5219dfd3d6e9d4dd4dc9e0aafcb13cc0208005f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 19:34:10 +0200 Subject: [PATCH 03/19] Make CI compiler version independent --- .github/workflows/ci.yml | 4 ++-- tool/format.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0c2d3b..38e14c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: uses: actions/checkout@v2 - name: Install environment run: | - sudo apt install -y clang-format-14 + sudo apt install -y clang-format - name: Run clang formatter run: | ./tool/format.sh @@ -47,7 +47,7 @@ jobs: uses: actions/checkout@v1 - name: Install environment run: | - sudo apt install -y gcc-8 g++-8 clang-8 clang++-8 + sudo apt install -y gcc g++ clang - name: Cache Memgraph Docker image id: cache-memgraph-docker diff --git a/tool/format.sh b/tool/format.sh index f6915ab..0037ddf 100755 --- a/tool/format.sh +++ b/tool/format.sh @@ -7,7 +7,7 @@ cd "$DIR/.." ALL_FILES_TO_CHECK=$(find . -type f -regex ".*\.\(cpp\|hpp\|c\|h\)$" -print | paste -sd " ") for file in ${ALL_FILES_TO_CHECK}; do - clang-format-14 -i -verbose "${file}" + clang-format -i -verbose "${file}" done changes="$(git diff)" if [[ ! -z "${changes}" ]]; then From ff3b619011fd53ecf16294f354284412d9cac558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 19:36:25 +0200 Subject: [PATCH 04/19] Fix usage of mgversion --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38e14c3..aa58c78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,12 +54,12 @@ jobs: uses: actions/cache@v1 with: path: ~/memgraph - key: cache-memgraph-v${{ env.MG_VERSION }}-docker-image + key: cache-memgraph-v${{ matrix.mgversion }}-docker-image - name: Download Memgraph Docker image if: steps.cache-memgraph-docker.outputs.cache-hit != 'true' run: | mkdir ~/memgraph - curl -L https://memgraph.com/download/memgraph/v${MG_VERSION}/docker/memgraph-${{ matrix.mgversion }}-community-docker.tar.gz > ~/memgraph/memgraph-docker.tar.gz + curl -L https://memgraph.com/download/memgraph/v${{ matrix.mgversion }}/docker/memgraph-${{ matrix.mgversion }}-community-docker.tar.gz > ~/memgraph/memgraph-docker.tar.gz - name: Load and run Memgraph Docker image run: | docker load -i ~/memgraph/memgraph-docker.tar.gz From dc5fb95c9baf295628e1cea092cca2a978858268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 19:38:23 +0200 Subject: [PATCH 05/19] Remove community postfix of docker image --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa58c78..1f7bf2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,7 @@ jobs: if: steps.cache-memgraph-docker.outputs.cache-hit != 'true' run: | mkdir ~/memgraph - curl -L https://memgraph.com/download/memgraph/v${{ matrix.mgversion }}/docker/memgraph-${{ matrix.mgversion }}-community-docker.tar.gz > ~/memgraph/memgraph-docker.tar.gz + curl -L https://memgraph.com/download/memgraph/v${{ matrix.mgversion }}/docker/memgraph-${{ matrix.mgversion }}-docker.tar.gz > ~/memgraph/memgraph-docker.tar.gz - name: Load and run Memgraph Docker image run: | docker load -i ~/memgraph/memgraph-docker.tar.gz From 881d9100900db26706532cce0306469af3641b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 19:48:17 +0200 Subject: [PATCH 06/19] Use Ubuntu 20.04 instead of 18.04 in order to keep ci.yml clean --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f7bf2f..a38a0b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: build_and_test_linux: strategy: matrix: - platform: [ubuntu-18.04, ubuntu-22.04] + platform: [ubuntu-20.04, ubuntu-22.04] mgversion: ["2.0.0", "2.3.0"] runs-on: ${{ matrix.platform }} steps: From 610cb2141fcdc6ca9d727cce4a5dc8bbe59a4032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 19:49:51 +0200 Subject: [PATCH 07/19] Fix clang-format issues --- src/mgtransport.h | 1 - tests/decoder.cpp | 1 - tests/encoder.cpp | 1 - 3 files changed, 3 deletions(-) diff --git a/src/mgtransport.h b/src/mgtransport.h index 39163dc..34a9778 100644 --- a/src/mgtransport.h +++ b/src/mgtransport.h @@ -28,7 +28,6 @@ extern "C" { #include #endif - #include "mgallocator.h" #include "mgcommon.h" diff --git a/tests/decoder.cpp b/tests/decoder.cpp index 721b080..c89de0b 100644 --- a/tests/decoder.cpp +++ b/tests/decoder.cpp @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. - #include #include #include diff --git a/tests/encoder.cpp b/tests/encoder.cpp index e2b517c..b3261ca 100644 --- a/tests/encoder.cpp +++ b/tests/encoder.cpp @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. - #include #include From 245887af4535ad1e372c3460d14daf45672fd466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 20:09:20 +0200 Subject: [PATCH 08/19] Avoid deprecated low level API in OpenSSL 3.0 --- tests/transport.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/transport.cpp b/tests/transport.cpp index 511c193..6929c42 100644 --- a/tests/transport.cpp +++ b/tests/transport.cpp @@ -40,14 +40,19 @@ extern "C" { #include "test-common.hpp" std::pair MakeCertAndKey(const char *name) { + static constexpr int kModulusSize{2048}; +#if OPENSSL_VERSION_NUMBER < 0x30000000L RSA *rsa = RSA_new(); BIGNUM *bne = BN_new(); BN_set_word(bne, RSA_F4); - RSA_generate_key_ex(rsa, 2048, bne, NULL); + RSA_generate_key_ex(rsa, kModulusSize, bne, NULL); BN_free(bne); EVP_PKEY *pkey = EVP_PKEY_new(); EVP_PKEY_assign_RSA(pkey, rsa); +#else + EVP_PKEY *pkey = EVP_RSA_gen(kModulusSize); +#endif X509 *x509 = X509_new(); ASN1_INTEGER_set(X509_get_serialNumber(x509), 1); From def6d15a56f029f129e0184a0253eb880fc46cdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 22:13:28 +0200 Subject: [PATCH 09/19] Call OPENSSL_init_crypto to initialize ciphers required for RSA --- tests/transport.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/transport.cpp b/tests/transport.cpp index 6929c42..7e86410 100644 --- a/tests/transport.cpp +++ b/tests/transport.cpp @@ -22,6 +22,7 @@ #include #include +#include #if MGCLIENT_ON_WINDOWS // NOTE: @@ -40,18 +41,17 @@ extern "C" { #include "test-common.hpp" std::pair MakeCertAndKey(const char *name) { - static constexpr int kModulusSize{2048}; #if OPENSSL_VERSION_NUMBER < 0x30000000L RSA *rsa = RSA_new(); BIGNUM *bne = BN_new(); BN_set_word(bne, RSA_F4); - RSA_generate_key_ex(rsa, kModulusSize, bne, NULL); + RSA_generate_key_ex(rsa, 2048, bne, nullptr); BN_free(bne); EVP_PKEY *pkey = EVP_PKEY_new(); EVP_PKEY_assign_RSA(pkey, rsa); #else - EVP_PKEY *pkey = EVP_RSA_gen(kModulusSize); + EVP_PKEY *pkey = EVP_RSA_gen(2048); #endif X509 *x509 = X509_new(); @@ -83,6 +83,7 @@ class SecureTransportTest : public ::testing::Test { #endif } virtual void SetUp() override { + OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, nullptr); int sv[2]; ASSERT_EQ(mg_socket_pair(AF_UNIX, SOCK_STREAM, 0, sv), 0); sc = sv[0]; @@ -120,7 +121,7 @@ class SecureTransportTest : public ::testing::Test { client_key_path = std::filesystem::temp_directory_path() / "client.key"; BIO *key_file = BIO_new_file(client_key_path.string().c_str(), "w"); - PEM_write_bio_PrivateKey(key_file, client_key, NULL, NULL, 0, NULL, NULL); + PEM_write_bio_PrivateKey(key_file, client_key, nullptr, nullptr, 0, nullptr, nullptr); BIO_free(key_file); X509_free(client_cert); @@ -185,7 +186,7 @@ TEST_F(SecureTransportTest, NoCertificate) { }); mg_transport *transport; - ASSERT_EQ(mg_secure_transport_init(sc, NULL, NULL, + ASSERT_EQ(mg_secure_transport_init(sc, nullptr, nullptr, (mg_secure_transport **)&transport, (mg_allocator *)&allocator), 0); @@ -216,7 +217,7 @@ TEST_F(SecureTransportTest, WithCertificate) { X509_STORE_add_cert(store, ca_cert); } SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, - NULL); + nullptr); ASSERT_TRUE(ctx); SSL *ssl = SSL_new(ctx); From cf9a05747af17c2c77ed6bf57897b9c82e945cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 22:15:06 +0200 Subject: [PATCH 10/19] Format transport.cpp --- tests/transport.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/transport.cpp b/tests/transport.cpp index 7e86410..0b1773e 100644 --- a/tests/transport.cpp +++ b/tests/transport.cpp @@ -121,7 +121,8 @@ class SecureTransportTest : public ::testing::Test { client_key_path = std::filesystem::temp_directory_path() / "client.key"; BIO *key_file = BIO_new_file(client_key_path.string().c_str(), "w"); - PEM_write_bio_PrivateKey(key_file, client_key, nullptr, nullptr, 0, nullptr, nullptr); + PEM_write_bio_PrivateKey(key_file, client_key, nullptr, nullptr, 0, nullptr, + nullptr); BIO_free(key_file); X509_free(client_cert); From 32521cd7772886c669fefc781635991b2ecd22eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 22:31:29 +0200 Subject: [PATCH 11/19] Ignore warning from gmock --- tests/client.cpp | 3 ++- tests/gmock_wrapper.h | 6 ++++++ tests/integration/basic_c.cpp | 3 ++- tests/integration/basic_cpp.cpp | 3 ++- tests/transport.cpp | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 tests/gmock_wrapper.h diff --git a/tests/client.cpp b/tests/client.cpp index 9cdc813..4ac1e47 100644 --- a/tests/client.cpp +++ b/tests/client.cpp @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include @@ -23,6 +22,8 @@ #include "mgcommon.h" #include "mgsession.h" #include "mgsocket.h" + +#include "gmock_wrapper.h" #include "test-common.hpp" using namespace std::string_literals; diff --git a/tests/gmock_wrapper.h b/tests/gmock_wrapper.h new file mode 100644 index 0000000..a4783e8 --- /dev/null +++ b/tests/gmock_wrapper.h @@ -0,0 +1,6 @@ +#pragma once + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-copy" +#include +#pragma GCC diagnostic pop \ No newline at end of file diff --git a/tests/integration/basic_c.cpp b/tests/integration/basic_c.cpp index 8334bff..b7c9c33 100644 --- a/tests/integration/basic_c.cpp +++ b/tests/integration/basic_c.cpp @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include "mgclient.h" +#include "gmock_wrapper.h" + template T GetEnvOrDefault(const std::string &value_name, const T &default_value) { const char *char_value = std::getenv(value_name.c_str()); diff --git a/tests/integration/basic_cpp.cpp b/tests/integration/basic_cpp.cpp index 8a8d714..b5ff5a8 100644 --- a/tests/integration/basic_cpp.cpp +++ b/tests/integration/basic_cpp.cpp @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include "mgclient.hpp" +#include "gmock_wrapper.h" + template T GetEnvOrDefault(const std::string &value_name, const T &default_value) { const char *char_value = std::getenv(value_name.c_str()); diff --git a/tests/transport.cpp b/tests/transport.cpp index 0b1773e..6b8cbe0 100644 --- a/tests/transport.cpp +++ b/tests/transport.cpp @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -38,6 +37,7 @@ extern "C" { #include "mgtransport.h" } +#include "gmock_wrapper.h" #include "test-common.hpp" std::pair MakeCertAndKey(const char *name) { From 49d1fd70c5e90a2f757c34a1e1b4f68bfb8f9a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 22:51:49 +0200 Subject: [PATCH 12/19] Fix include path for gmock_wrapper.h --- tests/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 80755f4..9621821 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -54,9 +54,11 @@ set_target_properties(${GTEST_MAIN_LIBRARY} PROPERTIES INTERFACE_LINK_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") add_dependencies(${GTEST_MAIN_LIBRARY} gtest-proj) +set(TESTS_ROOT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + macro(add_gtest target_name target_path) add_executable(${target_name} ${target_path}) - target_include_directories(${target_name} PRIVATE ${GTEST_INCLUDE_DIRS} "${PROJECT_SOURCE_DIR}/src") + target_include_directories(${target_name} PRIVATE ${GTEST_INCLUDE_DIRS} "${PROJECT_SOURCE_DIR}/src" "${TESTS_ROOT_DIRECTORY}") target_link_libraries(${target_name} mgclient-static mgclient_cpp gtest gtest-main project_cpp_warnings) if (ENABLE_COVERAGE) From 101da0f73d4324f8efe47700a877dd643359daab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 22:54:42 +0200 Subject: [PATCH 13/19] Parallelize compilation in CI --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a38a0b8..ad05246 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: mkdir build cd build cmake -DOPENSSL_ROOT_DIR="$(ls -rd -- /usr/local/Cellar/openssl@1.1/* | head -n 1)" -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_TESTING=ON -DBUILD_TESTING_INTEGRATION=ON -DC_WARNINGS_AS_ERRORS=ON -DCPP_WARNINGS_AS_ERRORS=ON .. - make + cmake --build . --parallel ctest -E "example|integration" sudo make install @@ -69,14 +69,14 @@ jobs: run: | mkdir build-gcc && cd build-gcc cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DBUILD_TESTING_INTEGRATION=ON -DC_WARNINGS_AS_ERRORS=ON -DCPP_WARNINGS_AS_ERRORS=ON .. - make + cmake --build . --parallel ctest --output-on-failure sudo make install - name: Build with clang, test and install mgclient run: | mkdir build-clang && cd build-clang cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DBUILD_TESTING_INTEGRATION=ON -DC_WARNINGS_AS_ERRORS=ON -DCPP_WARNINGS_AS_ERRORS=ON .. - make + cmake --build . --parallel ctest --output-on-failure sudo make install @@ -125,7 +125,7 @@ jobs: mkdir build cd build cmake .. -G "MinGW Makefiles" -DBUILD_TESTING=ON -DBUILD_TESTING_INTEGRATION=ON -DC_WARNINGS_AS_ERRORS=ON -DCPP_WARNINGS_AS_ERRORS=ON - cmake --build . + cmake --build . --parallel ctest --verbose -R "allocator|value|example_basic|integration_basic" build_and_test_linux_wasm: From 33b46746652fd1cf126e67aa2f1defb54fc12016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 23:03:54 +0200 Subject: [PATCH 14/19] Ignore unknown warning option to make gmock_wrapper compile with older compilers --- tests/gmock_wrapper.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/gmock_wrapper.h b/tests/gmock_wrapper.h index a4783e8..0d26157 100644 --- a/tests/gmock_wrapper.h +++ b/tests/gmock_wrapper.h @@ -1,6 +1,8 @@ #pragma once #pragma GCC diagnostic push +// On older versions of clang/gcc deprecated-copy might not exist +#pragma GCC diagnostic ignored "-Wunknown-warning-option" #pragma GCC diagnostic ignored "-Wdeprecated-copy" #include #pragma GCC diagnostic pop \ No newline at end of file From c91a964fc3d686c16946b6b5c19a18a2b1418985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 23:05:15 +0200 Subject: [PATCH 15/19] Add missing empty line --- tests/gmock_wrapper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/gmock_wrapper.h b/tests/gmock_wrapper.h index 0d26157..fa228fe 100644 --- a/tests/gmock_wrapper.h +++ b/tests/gmock_wrapper.h @@ -5,4 +5,4 @@ #pragma GCC diagnostic ignored "-Wunknown-warning-option" #pragma GCC diagnostic ignored "-Wdeprecated-copy" #include -#pragma GCC diagnostic pop \ No newline at end of file +#pragma GCC diagnostic pop From d9fee04bf04bd33a71e7c80dc895caf806544d50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 23:26:41 +0200 Subject: [PATCH 16/19] Restrict ingoring warnings for clang and gcc --- tests/gmock_wrapper.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/gmock_wrapper.h b/tests/gmock_wrapper.h index fa228fe..b4a101e 100644 --- a/tests/gmock_wrapper.h +++ b/tests/gmock_wrapper.h @@ -1,8 +1,14 @@ #pragma once -#pragma GCC diagnostic push // On older versions of clang/gcc deprecated-copy might not exist -#pragma GCC diagnostic ignored "-Wunknown-warning-option" + +#pragma GCC diagnostic push + +#if (defined(__clang_major__) && __clang_major__ >= 10) || \ + (defined(__GNUC__) && __GNUC__ >= 10) #pragma GCC diagnostic ignored "-Wdeprecated-copy" +#endif + #include + #pragma GCC diagnostic pop From 050a53a7ec598bef6f752f84f5564a92759130d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 23:27:30 +0200 Subject: [PATCH 17/19] Replace NULL by nullptr in tests --- tests/bolt-testdata.hpp | 8 ++-- tests/client.cpp | 70 ++++++++++++++++++----------------- tests/integration/basic_c.cpp | 23 +++++++----- tests/test-common.hpp | 8 ++-- tests/value.cpp | 8 ++-- 5 files changed, 62 insertions(+), 55 deletions(-) diff --git a/tests/bolt-testdata.hpp b/tests/bolt-testdata.hpp index 2105c87..c7f67e9 100644 --- a/tests/bolt-testdata.hpp +++ b/tests/bolt-testdata.hpp @@ -321,10 +321,10 @@ std::vector UnboundRelationshipTestCases() { std::vector PathTestCases() { std::vector inputs; { - mg_node *nodes[] = {mg_node_make(1, 0, NULL, mg_map_make_empty(0)), - mg_node_make(2, 0, NULL, mg_map_make_empty(0)), - mg_node_make(3, 0, NULL, mg_map_make_empty(0)), - mg_node_make(4, 0, NULL, mg_map_make_empty(0))}; + mg_node *nodes[] = {mg_node_make(1, 0, nullptr, mg_map_make_empty(0)), + mg_node_make(2, 0, nullptr, mg_map_make_empty(0)), + mg_node_make(3, 0, nullptr, mg_map_make_empty(0)), + mg_node_make(4, 0, nullptr, mg_map_make_empty(0))}; mg_unbound_relationship *relationships[] = { mg_unbound_relationship_make(12, mg_string_make("EDGE"), mg_map_make_empty(0)), diff --git a/tests/client.cpp b/tests/client.cpp index 4ac1e47..50e15b8 100644 --- a/tests/client.cpp +++ b/tests/client.cpp @@ -100,8 +100,8 @@ int __wrap_mg_secure_transport_init(int sockfd, const char *cert, ttransport->send = mg_raw_transport_send; ttransport->recv = mg_raw_transport_recv; ttransport->destroy = test_transport_destroy; - ttransport->suspend_until_ready_to_read = NULL; - ttransport->suspend_until_ready_to_write = NULL; + ttransport->suspend_until_ready_to_read = nullptr; + ttransport->suspend_until_ready_to_write = nullptr; ttransport->peer_pubkey_type = "rsaEncryption"; ttransport->peer_pubkey_fp = TEST_KEY_FP; *transport = (mg_secure_transport *)ttransport; @@ -189,7 +189,7 @@ class ConnectTest : public ::testing::Test { void RunServer(const std::function &server_func) { server_thread = std::thread([this, server_func] { - int sockfd = accept(ss, NULL, NULL); + int sockfd = accept(ss, nullptr, nullptr); if (sockfd < 0) { abort(); } @@ -793,9 +793,9 @@ void RunTest::ProtocolViolation(int version) { }); session->version = version; - ASSERT_EQ( - mg_session_run(session, "MATCH (n) RETURN n", NULL, NULL, NULL, NULL), - MG_ERROR_PROTOCOL_VIOLATION); + ASSERT_EQ(mg_session_run(session, "MATCH (n) RETURN n", nullptr, nullptr, + nullptr, nullptr), + MG_ERROR_PROTOCOL_VIOLATION); ASSERT_EQ(mg_session_status(session), MG_SESSION_BAD); mg_session_destroy(session); StopServer(); @@ -864,9 +864,9 @@ void RunTest::InvalidStatement(int version) { mg_session_destroy(session); }); session->version = version; - ASSERT_EQ( - mg_session_run(session, "MATCH (n) RETURN m", NULL, NULL, NULL, NULL), - MG_ERROR_CLIENT_ERROR); + ASSERT_EQ(mg_session_run(session, "MATCH (n) RETURN m", nullptr, nullptr, + nullptr, nullptr), + MG_ERROR_CLIENT_ERROR); ASSERT_THAT(std::string(mg_session_error(session)), HasSubstr("Unbound variable: m")); ASSERT_EQ(mg_session_status(session), MG_SESSION_READY); @@ -944,12 +944,13 @@ void RunTest::OkNoResults(int version) { session->version = version; - ASSERT_EQ( - mg_session_run(session, "MATCH (n) RETURN n", NULL, NULL, NULL, NULL), 0); + ASSERT_EQ(mg_session_run(session, "MATCH (n) RETURN n", nullptr, nullptr, + nullptr, nullptr), + 0); ASSERT_EQ(mg_session_status(session), MG_SESSION_EXECUTING); mg_result *result; - ASSERT_EQ(mg_session_pull(session, NULL), 0); + ASSERT_EQ(mg_session_pull(session, nullptr), 0); ASSERT_EQ(mg_session_fetch(session, &result), 0); ASSERT_TRUE(CheckColumns(result, std::vector{"n"})); ASSERT_TRUE(CheckSummary(result, 0.01)); @@ -1046,7 +1047,7 @@ void RunTest::MultipleQueries(int version) { for (int i = 0; i < 10; ++i) { ASSERT_EQ(mg_session_run(session, ("RETURN " + std::to_string(i) + " AS n").c_str(), - NULL, NULL, NULL, NULL), + nullptr, nullptr, nullptr, nullptr), 0); ASSERT_EQ(mg_session_status(session), MG_SESSION_EXECUTING); @@ -1054,7 +1055,7 @@ void RunTest::MultipleQueries(int version) { mg_result *result; // Check result. - ASSERT_EQ(mg_session_pull(session, NULL), 0); + ASSERT_EQ(mg_session_pull(session, nullptr), 0); ASSERT_EQ(mg_session_status(session), MG_SESSION_FETCHING); ASSERT_EQ(mg_session_fetch(session, &result), 1); ASSERT_EQ(mg_session_status(session), MG_SESSION_FETCHING); @@ -1163,13 +1164,13 @@ void RunTest::OkWithResults(int version) { ASSERT_EQ( mg_session_run(session, "UNWIND [1, 2, 3] AS n RETURN n, n + 5 AS m", - NULL, NULL, NULL, NULL), + nullptr, nullptr, nullptr, nullptr), 0); ASSERT_EQ(mg_session_status(session), MG_SESSION_EXECUTING); mg_result *result; - ASSERT_EQ(mg_session_pull(session, NULL), 0); + ASSERT_EQ(mg_session_pull(session, nullptr), 0); ASSERT_EQ(mg_session_status(session), MG_SESSION_FETCHING); // Check results. @@ -1294,14 +1295,14 @@ void RunTest::QueryRuntimeError(int version) { session->version = version; - ASSERT_EQ(mg_session_run(session, "MATCH (n) RETURN size(n.prop)", NULL, NULL, - NULL, NULL), + ASSERT_EQ(mg_session_run(session, "MATCH (n) RETURN size(n.prop)", nullptr, + nullptr, nullptr, nullptr), 0); ASSERT_EQ(mg_session_status(session), MG_SESSION_EXECUTING); mg_result *result; - ASSERT_EQ(mg_session_pull(session, NULL), 0); + ASSERT_EQ(mg_session_pull(session, nullptr), 0); ASSERT_EQ(mg_session_fetch(session, &result), MG_ERROR_CLIENT_ERROR); ASSERT_EQ(mg_session_status(session), MG_SESSION_READY); @@ -1379,14 +1380,14 @@ void RunTest::QueryDatabaseError(int version) { session->version = version; - ASSERT_EQ(mg_session_run(session, "MATCH (n) RETURN size(n.prop)", NULL, NULL, - NULL, NULL), + ASSERT_EQ(mg_session_run(session, "MATCH (n) RETURN size(n.prop)", nullptr, + nullptr, nullptr, nullptr), 0); ASSERT_EQ(mg_session_status(session), MG_SESSION_EXECUTING); mg_result *result; - ASSERT_EQ(mg_session_pull(session, NULL), 0); + ASSERT_EQ(mg_session_pull(session, nullptr), 0); ASSERT_NE(mg_session_fetch(session, &result), 0); ASSERT_EQ(mg_session_status(session), MG_SESSION_BAD); @@ -1482,14 +1483,14 @@ void RunTest::RunWithParams(int version) { mg_map *params = mg_map_make_empty(1); mg_map_insert_unsafe(params, "param", mg_value_make_integer(42)); - ASSERT_EQ(mg_session_run(session, "WITH $param AS x RETURN x", params, NULL, - NULL, NULL), + ASSERT_EQ(mg_session_run(session, "WITH $param AS x RETURN x", params, + nullptr, nullptr, nullptr), 0); mg_map_destroy(params); mg_result *result; { - ASSERT_EQ(mg_session_pull(session, NULL), 0); + ASSERT_EQ(mg_session_pull(session, nullptr), 0); ASSERT_EQ(mg_session_fetch(session, &result), 1); ASSERT_TRUE(CheckColumns(result, std::vector{"x"})); const mg_list *row = mg_result_row(result); @@ -1637,7 +1638,7 @@ TEST_F(RunTest, MultipleResultPull) { ASSERT_EQ( mg_session_run(session, "UNWIND [1, 2, 3] AS n RETURN n, n + 5 AS m", - NULL, NULL, NULL, NULL), + nullptr, nullptr, nullptr, nullptr), 0); ASSERT_EQ(mg_session_status(session), MG_SESSION_EXECUTING); @@ -1792,17 +1793,18 @@ TEST_F(RunTest, TransactionBasic) { session->version = 4; - ASSERT_EQ(mg_session_begin_transaction(session, NULL), 0); + ASSERT_EQ(mg_session_begin_transaction(session, nullptr), 0); - ASSERT_EQ( - mg_session_run(session, "MATCH (n) RETURN n", NULL, NULL, NULL, NULL), 0); + ASSERT_EQ(mg_session_run(session, "MATCH (n) RETURN n", nullptr, nullptr, + nullptr, nullptr), + 0); ASSERT_EQ(mg_session_status(session), MG_SESSION_EXECUTING); mg_result *result; ASSERT_EQ(mg_session_rollback_transaction(session, &result), MG_ERROR_BAD_CALL); - ASSERT_EQ(mg_session_pull(session, NULL), 0); + ASSERT_EQ(mg_session_pull(session, nullptr), 0); ASSERT_EQ(mg_session_fetch(session, &result), 0); ASSERT_TRUE(CheckColumns(result, std::vector{"n"})); ASSERT_TRUE(CheckSummary(result, 0.01)); @@ -1995,18 +1997,18 @@ TEST_F(RunTest, TransactionWithMultipleRuns) { session->version = 4; - ASSERT_EQ(mg_session_begin_transaction(session, NULL), 0); + ASSERT_EQ(mg_session_begin_transaction(session, nullptr), 0); ASSERT_EQ(mg_session_status(session), MG_SESSION_READY); int64_t r1_qid; ASSERT_EQ(mg_session_run(session, "UNWIND [1, 2] AS n RETURN n, n + 5 AS m", - NULL, NULL, NULL, &r1_qid), + nullptr, nullptr, nullptr, &r1_qid), 0); ASSERT_EQ(mg_session_status(session), MG_SESSION_EXECUTING); int64_t r2_qid; ASSERT_EQ(mg_session_run(session, "UNWIND [3, 4] AS n RETURN n, n + 5 AS m", - NULL, NULL, NULL, &r2_qid), + nullptr, nullptr, nullptr, &r2_qid), 0); ASSERT_EQ(mg_session_status(session), MG_SESSION_EXECUTING); @@ -2055,7 +2057,7 @@ TEST_F(RunTest, TransactionWithMultipleRuns) { // Send third RUN int64_t r3_qid; ASSERT_EQ(mg_session_run(session, "UNWIND [5, 6] AS n RETURN n, n + 5 AS m", - NULL, NULL, NULL, &r3_qid), + nullptr, nullptr, nullptr, &r3_qid), 0); ASSERT_EQ(mg_session_status(session), MG_SESSION_EXECUTING); diff --git a/tests/integration/basic_c.cpp b/tests/integration/basic_c.cpp index b7c9c33..16205bb 100644 --- a/tests/integration/basic_c.cpp +++ b/tests/integration/basic_c.cpp @@ -111,16 +111,17 @@ class MemgraphConnection : public ::testing::Test { mg_result *result; const char *delete_all_query = "MATCH (n) DETACH DELETE n"; - ASSERT_EQ(mg_session_run(session, delete_all_query, NULL, NULL, NULL, NULL), + ASSERT_EQ(mg_session_run(session, delete_all_query, nullptr, nullptr, + nullptr, nullptr), 0); - ASSERT_EQ(mg_session_pull(session, NULL), 0); + ASSERT_EQ(mg_session_pull(session, nullptr), 0); ASSERT_EQ(mg_session_fetch(session, &result), 0); ASSERT_EQ(mg_session_fetch(session, &result), MG_ERROR_BAD_CALL); } }; TEST_F(MemgraphConnection, InsertAndRetriveFromMemegraph) { - ASSERT_EQ(mg_session_begin_transaction(session, NULL), 0); + ASSERT_EQ(mg_session_begin_transaction(session, nullptr), 0); mg_result *result; int status = 0, rows = 0; const char *create_query = @@ -129,13 +130,17 @@ TEST_F(MemgraphConnection, InsertAndRetriveFromMemegraph) { "'test2', is_deleted: false})"; const char *get_query = "MATCH (n)-[r]->(m) RETURN n, r, m"; - ASSERT_EQ(mg_session_run(session, create_query, NULL, NULL, NULL, NULL), 0); - ASSERT_EQ(mg_session_pull(session, NULL), 0); + ASSERT_EQ( + mg_session_run(session, create_query, nullptr, nullptr, nullptr, nullptr), + 0); + ASSERT_EQ(mg_session_pull(session, nullptr), 0); ASSERT_EQ(mg_session_fetch(session, &result), 0); ASSERT_EQ(mg_session_fetch(session, &result), MG_ERROR_BAD_CALL); - ASSERT_EQ(mg_session_run(session, get_query, NULL, NULL, NULL, NULL), 0); - ASSERT_EQ(mg_session_pull(session, NULL), 0); + ASSERT_EQ( + mg_session_run(session, get_query, nullptr, nullptr, nullptr, nullptr), + 0); + ASSERT_EQ(mg_session_pull(session, nullptr), 0); while ((status = mg_session_fetch(session, &result)) == 1) { const mg_list *mg_columns = mg_result_columns(result); const mg_list *mg_row = mg_result_row(result); @@ -191,9 +196,9 @@ TEST_F(MemgraphConnection, InsertAndRetriveFromMemegraph) { "CREATE (n:ValuesTest {int: 1, string:'Name', " "float: 2.3, bool: True, " "list: [1, 2], map: {key: 'value'}}) RETURN n;", - NULL, NULL, NULL, NULL), + nullptr, nullptr, nullptr, nullptr), 0); - ASSERT_EQ(mg_session_pull(session, NULL), 0); + ASSERT_EQ(mg_session_pull(session, nullptr), 0); mg_result *result; ASSERT_EQ(mg_session_fetch(session, &result), 1); const mg_list *mg_columns = mg_result_columns(result); diff --git a/tests/test-common.hpp b/tests/test-common.hpp index b1da228..5053502 100644 --- a/tests/test-common.hpp +++ b/tests/test-common.hpp @@ -62,7 +62,7 @@ struct tracking_allocator { void *tracking_allocator_malloc(mg_allocator *allocator, size_t size) { std::set *allocated = &((tracking_allocator *)allocator)->allocated; void *buf = malloc(size); - if (buf != NULL) { + if (buf != nullptr) { allocated->insert(buf); } return buf; @@ -72,14 +72,14 @@ void *tracking_allocator_realloc(mg_allocator *allocator, void *buf, size_t size) { std::set *allocated = &((tracking_allocator *)allocator)->allocated; assert(size > 0); - if (buf == NULL) { + if (buf == nullptr) { return tracking_allocator_malloc(allocator, size); } else { auto it = allocated->find(buf); assert(it != allocated->end()); allocated->erase(it); void *new_buf = realloc(buf, size); - if (new_buf != NULL) { + if (new_buf != nullptr) { allocated->insert(new_buf); } return new_buf; @@ -88,7 +88,7 @@ void *tracking_allocator_realloc(mg_allocator *allocator, void *buf, void tracking_allocator_free(mg_allocator *allocator, void *buf) { std::set *allocated = &((tracking_allocator *)allocator)->allocated; - if (buf != NULL) { + if (buf != nullptr) { auto it = allocated->find(buf); assert(it != allocated->end()); allocated->erase(it); diff --git a/tests/value.cpp b/tests/value.cpp index 720e69e..05e52f4 100644 --- a/tests/value.cpp +++ b/tests/value.cpp @@ -424,10 +424,10 @@ TEST(Value, Path) { EXPECT_EQ(mg_path_relationship_reversed_at(path, 6), -1); EXPECT_EQ(mg_path_relationship_reversed_at(path, 83291038), -1); }; - mg_node *nodes[] = {mg_node_make(1, 0, NULL, mg_map_make_empty(0)), - mg_node_make(2, 0, NULL, mg_map_make_empty(0)), - mg_node_make(3, 0, NULL, mg_map_make_empty(0)), - mg_node_make(4, 0, NULL, mg_map_make_empty(0))}; + mg_node *nodes[] = {mg_node_make(1, 0, nullptr, mg_map_make_empty(0)), + mg_node_make(2, 0, nullptr, mg_map_make_empty(0)), + mg_node_make(3, 0, nullptr, mg_map_make_empty(0)), + mg_node_make(4, 0, nullptr, mg_map_make_empty(0))}; mg_unbound_relationship *relationships[] = { mg_unbound_relationship_make(12, mg_string_make("EDGE"), mg_map_make_empty(0)), From 52af9471bc25963719f4f4392fc9517483e5abb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Mon, 13 Jun 2022 23:33:20 +0200 Subject: [PATCH 18/19] Explicitly ignore macOS for diagnostic pragma --- tests/gmock_wrapper.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/gmock_wrapper.h b/tests/gmock_wrapper.h index b4a101e..935770a 100644 --- a/tests/gmock_wrapper.h +++ b/tests/gmock_wrapper.h @@ -4,7 +4,8 @@ #pragma GCC diagnostic push -#if (defined(__clang_major__) && __clang_major__ >= 10) || \ +#if (defined(__clang_major__) && __clang_major__ >= 10 && \ + !defined(__APPLE__)) || \ (defined(__GNUC__) && __GNUC__ >= 10) #pragma GCC diagnostic ignored "-Wdeprecated-copy" #endif From 2623fd1714350941e4bd12bdcb6c165254adc495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Tue, 14 Jun 2022 00:05:24 +0200 Subject: [PATCH 19/19] Add a single Ubuntu 18.04 build --- .github/workflows/ci.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad05246..9d4d720 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,14 +41,18 @@ jobs: matrix: platform: [ubuntu-20.04, ubuntu-22.04] mgversion: ["2.0.0", "2.3.0"] + packages: ["gcc g++ clang"] + gcc-postfix: [""] + clang-postfix: [""] + include: + - {platform: [ubuntu-18.04], mgversion: "2.0.0", packages: "gcc-8 g++-8 clang-8 clang++-8", gcc-postfix: "-8", clang-postfix: "-8"} runs-on: ${{ matrix.platform }} steps: - name: Set-up repository uses: actions/checkout@v1 - name: Install environment run: | - sudo apt install -y gcc g++ clang - + sudo apt install -y ${{ matrix.packages }} - name: Cache Memgraph Docker image id: cache-memgraph-docker uses: actions/cache@v1 @@ -68,14 +72,14 @@ jobs: - name: Build with gcc, test and install mgclient run: | mkdir build-gcc && cd build-gcc - cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DBUILD_TESTING_INTEGRATION=ON -DC_WARNINGS_AS_ERRORS=ON -DCPP_WARNINGS_AS_ERRORS=ON .. + cmake -DCMAKE_C_COMPILER=gcc${{ matrix.gcc-postfix }} -DCMAKE_CXX_COMPILER=g++${{ matrix.gcc-postfix }} -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DBUILD_TESTING_INTEGRATION=ON -DC_WARNINGS_AS_ERRORS=ON -DCPP_WARNINGS_AS_ERRORS=ON .. cmake --build . --parallel ctest --output-on-failure sudo make install - name: Build with clang, test and install mgclient run: | mkdir build-clang && cd build-clang - cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DBUILD_TESTING_INTEGRATION=ON -DC_WARNINGS_AS_ERRORS=ON -DCPP_WARNINGS_AS_ERRORS=ON .. + cmake -DCMAKE_C_COMPILER=clang${{ matrix.clang-postfix }} -DCMAKE_CXX_COMPILER=clang++${{ matrix.clang-postfix }} -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DBUILD_TESTING_INTEGRATION=ON -DC_WARNINGS_AS_ERRORS=ON -DCPP_WARNINGS_AS_ERRORS=ON .. cmake --build . --parallel ctest --output-on-failure sudo make install