From 6d1f028ed87224f3fbe08584334663c2e8a13ba3 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Wed, 13 Mar 2024 15:52:06 +0100 Subject: [PATCH 1/4] only display changed network errors during validation of connection Signed-off-by: Matthieu Gallien --- src/gui/accountstate.cpp | 4 ++-- src/gui/connectionvalidator.cpp | 5 +++-- src/gui/connectionvalidator.h | 5 ++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index 7d44691d0c143..36cfce37ad561 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -117,7 +117,6 @@ void AccountState::setState(State state) if (_state == SignedOut) { _connectionStatus = ConnectionValidator::Undefined; - _connectionErrors.clear(); } else if (oldState == SignedOut && _state == Disconnected) { // If we stop being voluntarily signed-out, try to connect and // auth right now! @@ -297,8 +296,9 @@ void AccountState::checkConnectivity() return; } - auto *conValidator = new ConnectionValidator(AccountStatePtr(this)); + auto *conValidator = new ConnectionValidator(AccountStatePtr(this), _connectionErrors); _connectionValidator = conValidator; + _connectionErrors.clear(); connect(conValidator, &ConnectionValidator::connectionResult, this, &AccountState::slotConnectionValidatorResult); if (isConnected()) { diff --git a/src/gui/connectionvalidator.cpp b/src/gui/connectionvalidator.cpp index 0be46b9f9160d..e39d523a48bd0 100644 --- a/src/gui/connectionvalidator.cpp +++ b/src/gui/connectionvalidator.cpp @@ -37,8 +37,9 @@ Q_LOGGING_CATEGORY(lcConnectionValidator, "nextcloud.sync.connectionvalidator", // This makes sure we get tried often enough without "ConnectionValidator already running" static qint64 timeoutToUseMsec = qMax(1000, ConnectionValidator::DefaultCallingIntervalMsec - 5 * 1000); -ConnectionValidator::ConnectionValidator(AccountStatePtr accountState, QObject *parent) +ConnectionValidator::ConnectionValidator(AccountStatePtr accountState, const QStringList &previousErrors, QObject *parent) : QObject(parent) + , _previousErrors(previousErrors) , _accountState(accountState) , _account(accountState->account()) { @@ -331,7 +332,7 @@ void ConnectionValidator::reportResult(Status status) emit connectionResult(status, _errors); // notify user of errors - if (!_errors.isEmpty()) { + if (!_errors.isEmpty() && _previousErrors != _errors) { showSystrayErrorMessage(); } diff --git a/src/gui/connectionvalidator.h b/src/gui/connectionvalidator.h index 22f8ce686e1b1..4b7193b0c8004 100644 --- a/src/gui/connectionvalidator.h +++ b/src/gui/connectionvalidator.h @@ -79,7 +79,9 @@ class ConnectionValidator : public QObject { Q_OBJECT public: - explicit ConnectionValidator(AccountStatePtr accountState, QObject *parent = nullptr); + explicit ConnectionValidator(AccountStatePtr accountState, + const QStringList &previousErrors, + QObject *parent = nullptr); enum Status { Undefined, @@ -142,6 +144,7 @@ protected slots: */ bool setAndCheckServerVersion(const QString &version); + const QStringList _previousErrors; QStringList _errors; AccountStatePtr _accountState; AccountPtr _account; From e33832fa1ddbd6f3bb10a28a5a2dace88c31084a Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Fri, 15 Mar 2024 11:34:41 +0100 Subject: [PATCH 2/4] switch to ubuntu-latest image for CI github actions Signed-off-by: Matthieu Gallien --- .github/workflows/linux-clang-compile-tests.yml | 2 +- .github/workflows/linux-gcc-compile-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux-clang-compile-tests.yml b/.github/workflows/linux-clang-compile-tests.yml index d072fc7f788bd..6ab1f4887789c 100644 --- a/.github/workflows/linux-clang-compile-tests.yml +++ b/.github/workflows/linux-clang-compile-tests.yml @@ -5,7 +5,7 @@ on: jobs: build: name: Linux Clang compilation and tests - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest container: ghcr.io/nextcloud/continuous-integration-client:client-5.15-15 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/linux-gcc-compile-tests.yml b/.github/workflows/linux-gcc-compile-tests.yml index 1c91e1116d464..de26de433ff96 100644 --- a/.github/workflows/linux-gcc-compile-tests.yml +++ b/.github/workflows/linux-gcc-compile-tests.yml @@ -5,7 +5,7 @@ on: jobs: build: name: Linux GCC compilation and tests - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest container: ghcr.io/nextcloud/continuous-integration-client:client-5.15-15 steps: - uses: actions/checkout@v4 From 8422496becf2e340af3f2c3561e27a6765c41033 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Fri, 15 Mar 2024 18:09:05 +0100 Subject: [PATCH 3/4] sonarcloud CI check with address sanitizer Signed-off-by: Matthieu Gallien --- .github/workflows/sonarcloud.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 87ae75eb8aa8a..8f92478673ce1 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -25,14 +25,14 @@ jobs: run: | mkdir build cd build - cmake .. -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DBUILD_COVERAGE=ON -DOPENSSL_ROOT_DIR=/usr/local/lib64 + cmake .. -G Ninja -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror -DOPENSSL_ROOT_DIR=/usr/local/lib64 -DBUILD_COVERAGE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} ninja - name: Run tests run: | cd build useradd -m -s /bin/bash test chown -R test:test . - su -c 'xvfb-run ctest --output-on-failure --output-junit testResult.xml' test + su -c 'ASAN_OPTIONS=detect_odr_violation=0,detect_leaks=0 xvfb-run ctest --output-on-failure --output-junit testResult.xml' test - name: Generate coverage report run: | cd build From 2346ec226d96160598f42ce7ee197f4f62d86d9f Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Fri, 15 Mar 2024 18:55:11 +0100 Subject: [PATCH 4/4] update parts of CI to get tests to be OK Signed-off-by: Matthieu Gallien --- .github/workflows/linux-clang-compile-tests.yml | 4 ++-- .github/workflows/linux-gcc-compile-tests.yml | 4 ++-- .github/workflows/sonarcloud.yml | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/linux-clang-compile-tests.yml b/.github/workflows/linux-clang-compile-tests.yml index 6ab1f4887789c..9345c21e6f6b1 100644 --- a/.github/workflows/linux-clang-compile-tests.yml +++ b/.github/workflows/linux-clang-compile-tests.yml @@ -15,11 +15,11 @@ jobs: run: | mkdir build cd build - cmake .. -G Ninja -DCMAKE_C_COMPILER=clang-14 -DCMAKE_CXX_COMPILER=clang++-14 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror -DOPENSSL_ROOT_DIR=/usr/local/lib64 + cmake .. -G Ninja -DCMAKE_C_COMPILER=clang-14 -DCMAKE_CXX_COMPILER=clang++-14 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DCMAKE_CXX_FLAGS=-Werror -DOPENSSL_ROOT_DIR=/usr/local/lib64 ninja - name: Run tests run: | cd build useradd -m -s /bin/bash test chown -R test:test . - su -c 'ASAN_OPTIONS=detect_odr_violation=0,detect_leaks=0 xvfb-run ctest --output-on-failure' test + su -c 'xvfb-run ctest --output-on-failure' test diff --git a/.github/workflows/linux-gcc-compile-tests.yml b/.github/workflows/linux-gcc-compile-tests.yml index de26de433ff96..2d556eea2ae99 100644 --- a/.github/workflows/linux-gcc-compile-tests.yml +++ b/.github/workflows/linux-gcc-compile-tests.yml @@ -15,11 +15,11 @@ jobs: run: | mkdir build cd build - cmake .. -G Ninja -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror -DOPENSSL_ROOT_DIR=/usr/local/lib64 + cmake .. -G Ninja -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DCMAKE_CXX_FLAGS=-Werror -DOPENSSL_ROOT_DIR=/usr/local/lib64 ninja - name: Run tests run: | cd build useradd -m -s /bin/bash test chown -R test:test . - su -c 'ASAN_OPTIONS=detect_odr_violation=0,detect_leaks=0 xvfb-run ctest --output-on-failure' test + su -c 'xvfb-run ctest --output-on-failure' test diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 8f92478673ce1..59ec83b32ce68 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -5,7 +5,7 @@ on: jobs: build: name: SonarCloud analysis - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest container: ghcr.io/nextcloud/continuous-integration-client:client-5.15-15 env: SONAR_SERVER_URL: "https://sonarcloud.io" @@ -25,14 +25,14 @@ jobs: run: | mkdir build cd build - cmake .. -G Ninja -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror -DOPENSSL_ROOT_DIR=/usr/local/lib64 -DBUILD_COVERAGE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + cmake .. -G Ninja -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DCMAKE_CXX_FLAGS=-Werror -DOPENSSL_ROOT_DIR=/usr/local/lib64 -DBUILD_COVERAGE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} ninja - name: Run tests run: | cd build useradd -m -s /bin/bash test chown -R test:test . - su -c 'ASAN_OPTIONS=detect_odr_violation=0,detect_leaks=0 xvfb-run ctest --output-on-failure --output-junit testResult.xml' test + su -c 'xvfb-run ctest --output-on-failure --output-junit testResult.xml' test - name: Generate coverage report run: | cd build