From d1f7136481a286e3b363b5cb12631fe7db04ecb4 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 14 Aug 2020 20:28:30 +0000 Subject: cppcheck: Add several missing override statements to make cppcheck happy (which is one of our unit tests). --- tests/unit/adbd-client-test.cpp | 2 +- tests/unit/rotation-lock-test.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/unit/adbd-client-test.cpp b/tests/unit/adbd-client-test.cpp index d1ce740..9b5f1b3 100644 --- a/tests/unit/adbd-client-test.cpp +++ b/tests/unit/adbd-client-test.cpp @@ -38,7 +38,7 @@ protected: std::shared_ptr m_tmpdir; - void SetUp() + void SetUp() override { super::SetUp(); diff --git a/tests/unit/rotation-lock-test.cpp b/tests/unit/rotation-lock-test.cpp index b9630b5..a5a6f6c 100644 --- a/tests/unit/rotation-lock-test.cpp +++ b/tests/unit/rotation-lock-test.cpp @@ -28,12 +28,12 @@ private: protected: - void SetUp() + void SetUp() override { super::SetUp(); } - void TearDown() + void TearDown() override { super::TearDown(); } -- cgit v1.2.3 From 8286c68710c9a69461bb23fa7e8ba56f727c3a6e Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 14 Aug 2020 20:28:49 +0000 Subject: tests/unit/adbd-client-test.cpp: white-space fix --- tests/unit/adbd-client-test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/unit/adbd-client-test.cpp b/tests/unit/adbd-client-test.cpp index 9b5f1b3..b9e7a49 100644 --- a/tests/unit/adbd-client-test.cpp +++ b/tests/unit/adbd-client-test.cpp @@ -86,7 +86,7 @@ TEST_F(AdbdClientFixture, SocketPlumbing) EXPECT_EQ(test.expected_pk, pk); ASSERT_EQ(1, adbd_server->m_responses.size()); EXPECT_EQ(test.expected_response, adbd_server->m_responses.front()); - + // cleanup connection.disconnect(); adbd_client.reset(); -- cgit v1.2.3 From 65cd340d5770834cb823e18fba23dbd2a90689c0 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 14 Aug 2020 20:29:28 +0000 Subject: tests/CMakeLists.txt: Add options --suppress=missingInclude and --suppress=unusedFunction. Be less strict and make the cppcheck pass. --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d5fb909..1fcc7fd 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -28,7 +28,7 @@ endif() add_compile_options(${CXX_WARNING_ARGS}) -add_test(cppcheck cppcheck --enable=all -USCHEMA_DIR --error-exitcode=2 --inline-suppr -I${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests) +add_test(cppcheck cppcheck --force --enable=all -USCHEMA_DIR --error-exitcode=2 --suppress=missingInclude --suppress=unusedFunction --library=qt --inline-suppr -I${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests) add_subdirectory(integration) add_subdirectory(unit) -- cgit v1.2.3 From 800cc787d343e9a78b9e4f7b146fa5b3effd6dbf Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 9 Jun 2021 12:11:47 +0200 Subject: tests/test-dbus-fixture.h: Turn TestDBusFixture::TestDBusFixture into an explicitly declared constructor. Resolves issues like these: In file included from /rootdir/tests/unit/rotation-lock-test.cpp:20: In file included from /rootdir/tests/utils/test-dbus-fixture.h:22: In file included from /rootdir/tests/utils/glib-fixture.h:30: In file included from /usr/src/googletest/googletest/include/gtest/gtest.h:62: /usr/src/googletest/googletest/include/gtest/internal/gtest-internal.h:472:44: error: call to implicitly-deleted default constructor of 'RotationLockFixture_CheckIndicator_Test' Test* CreateTest() override { return new TestClass; } ^ /rootdir/tests/unit/rotation-lock-test.cpp:46:1: note: in instantiation of member function 'testing::internal::TestFactoryImpl::CreateTest' requested here TEST_F(RotationLockFixture, CheckIndicator) ^ /usr/src/googletest/googletest/include/gtest/gtest.h:2381:3: note: expanded from macro 'TEST_F' GTEST_TEST_(test_fixture, test_name, test_fixture, \ ^ /usr/src/googletest/googletest/include/gtest/internal/gtest-internal.h:1565:15: note: expanded from macro 'GTEST_TEST_' new ::testing::internal::TestFactoryImpl:198:1: note: expanded from here RotationLockFixture_CheckIndicator_Test ^ /rootdir/tests/unit/rotation-lock-test.cpp:46:1: note: default constructor of 'RotationLockFixture_CheckIndicator_Test' is implicitly deleted because base class 'RotationLockFixture' has a deleted default constructor /usr/src/googletest/googletest/include/gtest/gtest.h:2381:3: note: expanded from macro 'TEST_F' GTEST_TEST_(test_fixture, test_name, test_fixture, \ ^ /usr/src/googletest/googletest/include/gtest/internal/gtest-internal.h:1542:9: note: expanded from macro 'GTEST_TEST_' : public parent_class { \ ^ /rootdir/tests/unit/rotation-lock-test.cpp:24:28: note: default constructor of 'RotationLockFixture' is implicitly deleted because base class 'TestDBusFixture' has a deleted default constructor class RotationLockFixture: public TestDBusFixture ^ /rootdir/tests/utils/test-dbus-fixture.h:32:5: note: explicitly defaulted function was implicitly deleted here TestDBusFixture() =default; ^ /rootdir/tests/utils/test-dbus-fixture.h:69:36: note: default constructor of 'TestDBusFixture' is implicitly deleted because field 'service_dirs' of const-qualified type 'const std::vector' (aka 'const vector>') would not be initialized const std::vector service_dirs; ^ 2 warnings and 1 error generated. --- tests/utils/test-dbus-fixture.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/utils/test-dbus-fixture.h b/tests/utils/test-dbus-fixture.h index 3947e58..b01405a 100644 --- a/tests/utils/test-dbus-fixture.h +++ b/tests/utils/test-dbus-fixture.h @@ -29,7 +29,7 @@ class TestDBusFixture: public GlibFixture { public: - TestDBusFixture() =default; + explicit TestDBusFixture() {}; virtual ~TestDBusFixture() =default; explicit TestDBusFixture(const std::vector& service_dirs_in): service_dirs(service_dirs_in) {} -- cgit v1.2.3 From 95d827e7d535a07f340418094a063854875a1f52 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 9 Jun 2021 14:40:36 +0200 Subject: tests/CMakeLists.txt: Build unit tests with -no-pie CXXFLAG if GNU compiler is used. --- tests/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1fcc7fd..e2ea0e6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,7 @@ set(CMAKE_AUTOMOC ON) + +SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -no-pie") + find_package(GMock REQUIRED) find_package(Qt5Core REQUIRED) find_package(Qt5Test REQUIRED) -- cgit v1.2.3 From 3336228bccde7de599e7f56b4b8b67b8552c6a95 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Tue, 3 Aug 2021 15:48:26 +0200 Subject: tests/CMakeLists.txt: Adjust cppcheck call so that it succeeds with less --suppress parameters. --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e2ea0e6..42e6cb2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -31,7 +31,7 @@ endif() add_compile_options(${CXX_WARNING_ARGS}) -add_test(cppcheck cppcheck --force --enable=all -USCHEMA_DIR --error-exitcode=2 --suppress=missingInclude --suppress=unusedFunction --library=qt --inline-suppr -I${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests) +add_test(cppcheck cppcheck --enable=all -USCHEMA_DIR --error-exitcode=2 --inline-suppr --library=qt -I${CMAKE_SOURCE_DIR} -i${CMAKE_SOURCE_DIR}/tests/utils/qmain.cpp -i${CMAKE_SOURCE_DIR}/tests/gmock ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests --suppress=missingIncludeSystem) add_subdirectory(integration) add_subdirectory(unit) -- cgit v1.2.3