aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-08-04 17:08:17 +0200
committerRobert Tari <robert@tari.in>2021-08-04 17:08:17 +0200
commit53bab0ef23c8396dd6e3473593ffe027cb2d5fc4 (patch)
tree8413072aa2b936f1bdf9ed07ad5c645472161245
parent4d6d205398bec86a702ed4af9c7834b950f67c8c (diff)
parent3336228bccde7de599e7f56b4b8b67b8552c6a95 (diff)
downloadayatana-indicator-display-53bab0ef23c8396dd6e3473593ffe027cb2d5fc4.tar.gz
ayatana-indicator-display-53bab0ef23c8396dd6e3473593ffe027cb2d5fc4.tar.bz2
ayatana-indicator-display-53bab0ef23c8396dd6e3473593ffe027cb2d5fc4.zip
Merge branch 'sunweaver-pr/travis-ci'
Attributes GH PR #15: https://github.com/AyatanaIndicators/ayatana-indicator-display/pull/15
-rw-r--r--.build.yml133
-rw-r--r--.travis.yml43
-rw-r--r--src/adbd-client.cpp10
-rw-r--r--src/indicator.h6
-rw-r--r--src/rotation-lock.h6
-rw-r--r--tests/CMakeLists.txt5
-rw-r--r--tests/unit/adbd-client-test.cpp4
-rw-r--r--tests/unit/rotation-lock-test.cpp4
-rw-r--r--tests/utils/test-dbus-fixture.h2
9 files changed, 196 insertions, 17 deletions
diff --git a/.build.yml b/.build.yml
new file mode 100644
index 0000000..abc7800
--- /dev/null
+++ b/.build.yml
@@ -0,0 +1,133 @@
+#########################################################
+# THE FOLLOWING LINES IS USED BY docker-build
+##########################################################
+requires:
+ archlinux:
+ # Useful URL: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ayatana-indicator-display
+ - clang
+ - gcc
+ - git
+ - make
+ - startup-notification
+ - which
+ - cmake
+ - cmake-extras
+ - mate-common
+ - dbus
+ - intltool
+ - glib2
+ # FIXME: add missing build-dependencies
+
+ debian:
+ # Useful URL: https://salsa.debian.org/debian-ayatana-team/ayatana-indicator-display
+ - autopoint
+ - clang
+ - clang-tools
+ - g++
+ - cppcheck
+ - git
+ - cmake
+ - cmake-extras
+ - mate-common
+ - dbus
+ - intltool
+ - libglib2.0-dev
+ - libgudev-1.0-dev
+ - libproperties-cpp-dev
+ - qtbase5-dev
+ - libqtdbusmock1-dev
+ - libqtdbustest1-dev
+ - libgtest-dev
+ - cppcheck
+ - googletest
+ - lcov
+ - gcovr
+ - systemd
+
+ ubuntu:
+ - autopoint
+ - clang
+ - clang-tools
+ - g++
+ - git
+ - cmake
+ - cmake-extras
+ - mate-common
+ - dbus
+ - intltool
+ - libglib2.0-dev
+ - libgudev-1.0-dev
+ - libproperties-cpp-dev
+ - qtbase5-dev
+ - libqtdbusmock1-dev
+ - libqtdbustest1-dev
+ - libgtest-dev
+ - cppcheck
+ - googletest
+ - lcov
+ - gcovr
+ - systemd
+ - gsettings-ubuntu-schemas
+
+variables:
+ - 'CHECKERS="
+ -enable-checker deadcode.DeadStores
+ -enable-checker alpha.deadcode.UnreachableCode
+ -enable-checker alpha.core.CastSize
+ -enable-checker alpha.core.CastToStruct
+ -enable-checker alpha.core.IdenticalExpr
+ -enable-checker alpha.core.SizeofPtr
+ -enable-checker alpha.security.ArrayBoundV2
+ -enable-checker alpha.security.MallocOverflow
+ -enable-checker alpha.security.ReturnPtrRange
+ -enable-checker alpha.unix.SimpleStream
+ -enable-checker alpha.unix.cstring.BufferOverlap
+ -enable-checker alpha.unix.cstring.NotNullTerminated
+ -enable-checker alpha.unix.cstring.OutOfBounds
+ -enable-checker alpha.core.FixedAddr
+ -enable-checker security.insecureAPI.strcpy"'
+
+build_scripts:
+ - if [ ${DISTRO_NAME} == "debian" ];then
+ - export CFLAGS+=" -Wsign-compare -Wunused-parameter"
+ - cppcheck --enable=warning,style,performance,portability,information,missingInclude .
+ - fi
+ -
+ - if [ -e ./autogen.sh ]; then
+ - NOCONFIGURE=1 ./autogen.sh
+ - scan-build $CHECKERS ./configure --prefix=/usr --enable-gtk-doc --enable-compile-warnings=maximum
+ - elif [ -e ./CMakeLists.txt ]; then
+ - if [ ${DISTRO_NAME} == "debian" ];then
+ - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTS=ON
+ - else
+ - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON
+ - fi
+ - else
+ - exit 1
+ - fi
+ -
+ - if [ $CPU_COUNT -gt 1 ]; then
+ - if [ ${DISTRO_NAME} == "debian" ];then
+ - scan-build $CHECKERS --keep-cc --use-cc=clang --use-c++=clang++ -o html-report make -j $CPU_COUNT
+ - make clean
+ - fi
+ - scan-build $CHECKERS --keep-cc -o html-report make -j $CPU_COUNT
+ - else
+ - if [ ${DISTRO_NAME} == "debian" ];then
+ - scan-build $CHECKERS --keep-cc --use-cc=clang --use-c++=clang++ -o html-report make
+ - make clean
+ - fi
+ - scan-build $CHECKERS --keep-cc -o html-report make
+ - fi
+
+after_scripts:
+ - if [ ${BUILD_TYPE} == "scripts" ];then
+ - XVFB_RUN="$(which xvfb-run || true)"
+ - if [ ${DISTRO_NAME} == "debian" ];then
+ - if [ -e ./autogen.sh ]; then
+ - ${XVFB_RUN} make check
+ - elif [ -e ./CMakeLists.txt ]; then
+ - ${XVFB_RUN} env CTEST_OUTPUT_ON_FAILURE=1 make test
+ - fi
+ - fi
+ - fi
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..5382638
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,43 @@
+# vim: set ts=2 sts=2 sw=2 expandtab :
+dist: bionic
+language: shell
+os: linux
+
+arch:
+ - amd64
+ - ppc64le
+
+services:
+ - docker
+
+addons:
+ apt:
+ packages:
+ - python3-pip
+ - python3-setuptools
+
+before_install:
+ # let's use the MATE project's docker build script...
+ - curl -Ls -o docker-build https://github.com/AyatanaIndicators/ayatana-dev-scripts/raw/master/travis/docker-build
+ - chmod +x docker-build
+
+install:
+ - pip3 install wheel
+ - pip3 install PyGithub
+ - ./docker-build --name ${DISTRO} --config .build.yml --install
+
+script:
+ - ./docker-build --name ${DISTRO} --verbose --config .build.yml --build scripts
+
+env:
+# temp disable of archlinux builds, see https://gitlab.archlinux.org/archlinux/archlinux-docker/-/issues/56
+# - DISTRO="archlinux:latest"
+ - DISTRO="debian:testing"
+ - DISTRO="debian:stable"
+# - DISTRO="ubuntu:rolling"
+ - DISTRO="ubuntu:focal"
+
+jobs:
+ exclude:
+ - env: DISTRO="archlinux:latest"
+ arch: ppc64le
diff --git a/src/adbd-client.cpp b/src/adbd-client.cpp
index 47914cb..f4f419f 100644
--- a/src/adbd-client.cpp
+++ b/src/adbd-client.cpp
@@ -107,7 +107,7 @@ private:
void on_public_key_response(PKResponse response)
{
- g_debug("%s thread %p got response %d", G_STRLOC, g_thread_self(), int(response));
+ g_debug("%s thread %p got response %d", G_STRLOC, (void*)g_thread_self(), int(response));
// set m_pkresponse and wake up the waiting worker thread
m_pkresponse = response;
@@ -125,11 +125,11 @@ private:
while (!g_cancellable_is_cancelled(m_cancellable))
{
- g_debug("%s thread %p creating a client socket to '%s'", G_STRLOC, g_thread_self(), socket_path.c_str());
+ g_debug("%s thread %p creating a client socket to '%s'", G_STRLOC, (void*)g_thread_self(), socket_path.c_str());
auto socket = create_client_socket(socket_path);
bool got_valid_req = false;
- g_debug("%s thread %p calling read_request", g_thread_self(), G_STRLOC);
+ g_debug("%s thread %p calling read_request", G_STRLOC, (void*)g_thread_self());
std::string reqstr;
if (socket != nullptr)
reqstr = read_request(socket);
@@ -139,7 +139,7 @@ private:
if (reqstr.substr(0,2) == "PK") {
PKResponse response = PKResponse::DENY;
const auto public_key = reqstr.substr(2);
- g_debug("%s thread %p got pk [%s]", G_STRLOC, g_thread_self(), public_key.c_str());
+ g_debug("%s thread %p got pk [%s]", G_STRLOC, (void*)g_thread_self(), public_key.c_str());
if (!public_key.empty()) {
got_valid_req = true;
std::unique_lock<std::mutex> lk(m_pkresponse_mutex);
@@ -151,7 +151,7 @@ private:
});
response = m_pkresponse;
g_debug("%s thread %p got response '%d', is-cancelled %d", G_STRLOC,
- g_thread_self(),
+ (void*)g_thread_self(),
int(response),
int(g_cancellable_is_cancelled(m_cancellable)));
}
diff --git a/src/indicator.h b/src/indicator.h
index c55be79..b5524d1 100644
--- a/src/indicator.h
+++ b/src/indicator.h
@@ -64,10 +64,10 @@ public:
SimpleProfile(const char* name, const std::shared_ptr<GMenuModel>& menu): m_name(name), m_menu(menu) {}
virtual ~SimpleProfile();
- std::string name() const {return m_name;}
+ std::string name() const override {return m_name;}
core::Property<Header>& header() {return m_header;}
- const core::Property<Header>& header() const {return m_header;}
- std::shared_ptr<GMenuModel> menu_model() const {return m_menu;}
+ const core::Property<Header>& header() const override {return m_header;}
+ std::shared_ptr<GMenuModel> menu_model() const override {return m_menu;}
protected:
const std::string m_name;
diff --git a/src/rotation-lock.h b/src/rotation-lock.h
index 2354c4a..7bdfb14 100644
--- a/src/rotation-lock.h
+++ b/src/rotation-lock.h
@@ -30,9 +30,9 @@ public:
RotationLockIndicator();
~RotationLockIndicator();
- const char* name() const;
- GSimpleActionGroup* action_group() const;
- std::vector<std::shared_ptr<Profile>> profiles() const;
+ const char* name() const override;
+ GSimpleActionGroup* action_group() const override;
+ std::vector<std::shared_ptr<Profile>> profiles() const override;
protected:
class Impl;
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index d5fb909..42e6cb2 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)
@@ -28,7 +31,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 --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)
diff --git a/tests/unit/adbd-client-test.cpp b/tests/unit/adbd-client-test.cpp
index d1ce740..b9e7a49 100644
--- a/tests/unit/adbd-client-test.cpp
+++ b/tests/unit/adbd-client-test.cpp
@@ -38,7 +38,7 @@ protected:
std::shared_ptr<std::string> m_tmpdir;
- void SetUp()
+ void SetUp() override
{
super::SetUp();
@@ -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();
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();
}
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<std::string>& service_dirs_in): service_dirs(service_dirs_in) {}