From 00e34946dcfe7333af1475931c781f0db1243789 Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Wed, 6 May 2026 10:44:25 -0400 Subject: [PATCH 1/6] Try without build wrapper --- .github/workflows/sonarqube.yaml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/sonarqube.yaml b/.github/workflows/sonarqube.yaml index 6e6e60d..6dc1b1e 100644 --- a/.github/workflows/sonarqube.yaml +++ b/.github/workflows/sonarqube.yaml @@ -30,8 +30,6 @@ jobs: build: name: Build and analyze runs-on: ubuntu-latest - env: - BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed steps: - uses: actions/checkout@v6 with: @@ -47,12 +45,9 @@ jobs: python3 python3-pip python3-wheel pip3 install gcovr ./build.sh deps - ./build.sh prep -DTEST_MEMCHECK=OFF -DBUILD_COVERAGE=ON -DBUILD_DOCS_API=OFF -DBUILD_DOCS_MAN=OFF - - name: Install Build Wrapper - uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v7 - - name: Run Build Wrapper - run: | - build-wrapper-linux-x86-64 --out-dir ${{env.BUILD_WRAPPER_OUT_DIR}} ./build.sh + ./build.sh prep -DTEST_MEMCHECK=OFF -DBUILD_COVERAGE=ON -DBUILD_DOCS_API=OFF -DBUILD_DOCS_MAN=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + - name: Build + run: ./build.sh - name: Install run: ./build.sh install - name: Test @@ -70,5 +65,5 @@ jobs: SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} with: args: > + --define sonar.cfamily.compile-commands=build/default/compile_commands.json --define sonar.coverageReportPaths=build/default/coverage-sonarqube.xml - --define "sonar.cfamily.compile-commands=${{env.BUILD_WRAPPER_OUT_DIR}}/compile_commands.json" From b6235846fe635c0bef8d5dc15b120928a83380cb Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Wed, 6 May 2026 10:50:16 -0400 Subject: [PATCH 2/6] Reconcile job and config with other projects --- .github/workflows/sonarqube.yaml | 32 +++++++++++++++++++++----------- CMakeLists.txt | 16 ++++++++-------- sonar-project.properties | 4 +++- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/.github/workflows/sonarqube.yaml b/.github/workflows/sonarqube.yaml index 6dc1b1e..2c4e914 100644 --- a/.github/workflows/sonarqube.yaml +++ b/.github/workflows/sonarqube.yaml @@ -29,13 +29,11 @@ on: jobs: build: name: Build and analyze - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - submodules: recursive - - name: Prep + - name: Set up OS + env: + PIP_BREAK_SYSTEM_PACKAGES: 1 run: | sudo apt-get update sudo apt-get install -y \ @@ -44,15 +42,27 @@ jobs: xmlstarlet \ python3 python3-pip python3-wheel pip3 install gcovr - ./build.sh deps - ./build.sh prep -DTEST_MEMCHECK=OFF -DBUILD_COVERAGE=ON -DBUILD_DOCS_API=OFF -DBUILD_DOCS_MAN=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + - uses: actions/checkout@v6 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + submodules: recursive + - name: Dependencies + run: ./build.sh deps + - name: Prep + run: > + ./build.sh prep + -DBUILD_DOCS_API=OFF -DBUILD_DOCS_MAN=OFF + -DBUILD_UNITTEST=ON + -DTEST_MEMCHECK=OFF -DBUILD_COVERAGE=ON + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Build run: ./build.sh - name: Install run: ./build.sh install - - name: Test + - name: Unit Test + run: ./build.sh check + - name: Mock BPA Test run: | - ./build.sh check pip3 install --upgrade pip pip3 install -r mock-bpa-test/requirements.txt python3 -m pytest mock-bpa-test @@ -60,7 +70,7 @@ jobs: run: | ./build.sh --target coverage-sonarqube -v - name: SonarQube Scan - uses: SonarSource/sonarqube-scan-action@v7 + uses: SonarSource/sonarqube-scan-action@c7ee0f9df90b7aa20e8dcf9695dcfe2e7da5b4f2 # v7.2.1 env: SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} with: diff --git a/CMakeLists.txt b/CMakeLists.txt index 14f6bf7..e3ba864 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,14 +122,9 @@ if(BUILD_LIB) endif(BUILD_LIB) include(CheckSymbolExists) -set(CMAKE_REQUIRED_DEFINITIONS "-D_POSIX_C_SOURCE=200809L") check_symbol_exists(timespec_get "time.h" HAVE_TIMESPEC_GET) check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) -include(CheckTypeSize) -check_type_size("int" SIZE_INT LANGUAGE C) -check_type_size("size_t" SIZE_SIZET LANGUAGE C) - if(BUILD_UNITTEST) if(TEST_MEMCHECK) find_package(valgrind REQUIRED) @@ -142,6 +137,7 @@ if(BUILD_UNITTEST) "--track-origins=yes" "--leak-check=full" "--show-leak-kinds=all" "--suppressions=${CMAKE_CURRENT_SOURCE_DIR}/resources/memcheck.supp" + "--gen-suppressions=all" "--error-exitcode=2" ) # Arguments as list into global scope for Findunitytools.cmake @@ -158,6 +154,7 @@ if(BUILD_COVERAGE) set(COVERAGE_EXCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/deps/*" "${CMAKE_CURRENT_SOURCE_DIR}/testroot/*" + "${CMAKE_CURRENT_SOURCE_DIR}/test/" "${CMAKE_CURRENT_BINARY_DIR}/test/*" ) set(GCOVR_ADDITIONAL_ARGS @@ -193,9 +190,12 @@ if(BUILD_LIB) endif(BUILD_LIB) set(TEST_INSTALL_PREFIX "${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME}") -add_subdirectory(test) -add_subdirectory(docs) - +if(BUILD_UNITTEST OR BUILD_FUZZING) + add_subdirectory(test) +endif(BUILD_UNITTEST OR BUILD_FUZZING) +if(BUILD_DOCS_API OR BUILD_DOCS_MAN) + add_subdirectory(docs) +endif(BUILD_DOCS_API OR BUILD_DOCS_MAN) add_custom_command( DEPENDS CMakeGraphVizOptions.cmake diff --git a/sonar-project.properties b/sonar-project.properties index 97b78f3..d94ee31 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -7,7 +7,9 @@ sonar.projectName=BSL # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. sonar.sources=src -sonar.tests=test +sonar.tests=test,mock-bpa-test +# ignore test sources +sonar.exclusions=**/*.cbor # Encoding of the source code. Default is default system encoding sonar.sourceEncoding=UTF-8 From fc7dfe9d5b4ab3d82038029b312d5483062d657d Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Wed, 6 May 2026 10:54:41 -0400 Subject: [PATCH 3/6] ignore cborseq files --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index d94ee31..3c6c4f3 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -9,7 +9,7 @@ sonar.projectName=BSL sonar.sources=src sonar.tests=test,mock-bpa-test # ignore test sources -sonar.exclusions=**/*.cbor +sonar.exclusions=**/*.cbor,**/*.cborseq # Encoding of the source code. Default is default system encoding sonar.sourceEncoding=UTF-8 From dd7e8fd6d66efb229fd884112f2720c05a71fb20 Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Wed, 6 May 2026 11:08:12 -0400 Subject: [PATCH 4/6] python version for test --- sonar-project.properties | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 3c6c4f3..4976ac0 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -3,7 +3,7 @@ sonar.organization=nasa-ammos # This is the name and version displayed in the SonarCloud UI. sonar.projectName=BSL -#sonar.projectVersion=1.0 +sonar.projectVersion=1.1.0 # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. sonar.sources=src @@ -13,3 +13,6 @@ sonar.exclusions=**/*.cbor,**/*.cborseq # Encoding of the source code. Default is default system encoding sonar.sourceEncoding=UTF-8 + +# Python used for testing from ubuntu-22.04 +sonar.python.version=3.12 From 556fa4487471953454bdc442eda653d47ce0a87c Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Thu, 7 May 2026 15:35:41 -0400 Subject: [PATCH 5/6] Ignore coverage of test --- sonar-project.properties | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 4976ac0..899f7d4 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -8,8 +8,10 @@ sonar.projectVersion=1.1.0 # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. sonar.sources=src sonar.tests=test,mock-bpa-test -# ignore test sources +# ignore binary test data sonar.exclusions=**/*.cbor,**/*.cborseq +# ignore test sources +sonar.coverage.exclusions=test/**/* # Encoding of the source code. Default is default system encoding sonar.sourceEncoding=UTF-8 From 66839090de2542e982317bf04e6204c64c36662b Mon Sep 17 00:00:00 2001 From: Brian Sipos Date: Fri, 8 May 2026 10:39:07 -0400 Subject: [PATCH 6/6] fix typo --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 899f7d4..e3e0c37 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -16,5 +16,5 @@ sonar.coverage.exclusions=test/**/* # Encoding of the source code. Default is default system encoding sonar.sourceEncoding=UTF-8 -# Python used for testing from ubuntu-22.04 +# Python used for testing from ubuntu-24.04 sonar.python.version=3.12