Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add template coverage #51

Merged
merged 7 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,29 @@ jobs:
run: |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build --preset conan-${{ env.conan_preset }}

- name: Template coverage
run: |
wget https://github.com/petiaccja/TemplateCoverage/releases/download/v1.4.0/TemplateCoverage_Linux_x86_64.zip
unzip TemplateCoverage_Linux_x86_64.zip
chmod +x ./TemplateCoverage_Linux_x86_64/template-coverage
export RESOURCE_DIR=$(clang++ -print-resource-dir)
sed -i 's/-x c++//g' ${{github.workspace}}/build/${{env.conan_preset}}/compile_commands.json
python3 ./TemplateCoverage_Linux_x86_64/run_on_compile_commands.py -p ${{github.workspace}}/build/${{env.conan_preset}}/compile_commands.json ./TemplateCoverage_Linux_x86_64/template-coverage -- --format=lcov --out-file=${{github.workspace}}/template_coverage.info -extra-arg=-resource-dir=$RESOURCE_DIR

- name: Test & code coverage
working-directory: ${{github.workspace}}/build/${{ env.conan_preset }}/bin
shell: bash
run: |
./UnitTest --reporter junit --out ${{github.workspace}}/tests.xml
llvm-profdata-17 merge -sparse default.profraw -o coverage.profdata
llvm-cov-17 show ./UnitTest -instr-profile=coverage.profdata > ${{github.workspace}}/coverage.txt
llvm-cov-17 export -format=lcov -object ./UnitTest -instr-profile=coverage.profdata > ${{github.workspace}}/test_coverage.info

- name: Merge coverage reports
uses: danielpalme/[email protected]
with:
reports: template_coverage.info;test_coverage.info
targetdir: coverage
reporttypes: SonarQube

- name: Run sonar-scanner
env:
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ endif()
# Installation
install(TARGETS Mathter EXPORT MathterTargets
FILE_SET headers DESTINATION "include"
FILE_SET swizzle_headers DESTINATION "include"
FILE_SET natvis DESTINATION "include"
)

Expand Down
4 changes: 2 additions & 2 deletions include/Mathter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ target_sources(Mathter
"Common/Functional.hpp"
"Common/OptimizationUtil.hpp"
"Common/MathUtil.hpp"
"Common/Range.hpp"
"Common/Types.hpp"
"Common/TypeTraits.hpp"
# Decompositions
Expand Down Expand Up @@ -67,14 +66,15 @@ target_sources(Mathter
"Vector/SIMDUtil.hpp"
"Vector/Swizzle.hpp"
"Vector/Vector.hpp"
INTERFACE FILE_SET swizzle_headers TYPE HEADERS BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/.." FILES
# Swizzles
"Vector/SwizzleInc/Swizzle1.hpp.inc"
"Vector/SwizzleInc/Swizzle2.hpp.inc"
"Vector/SwizzleInc/Swizzle3.hpp.inc"
"Vector/SwizzleInc/Swizzle4.hpp.inc"
)

set_target_properties(Mathter PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON)
set_target_properties(Mathter PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON INTERFACE_HEADER_SETS_TO_VERIFY headers)

target_compile_features(Mathter INTERFACE cxx_std_17)

Expand Down
9 changes: 8 additions & 1 deletion include/Mathter/Common/OptimizationUtil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#include <utility>


#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-attributes"


namespace mathter {


Expand Down Expand Up @@ -57,4 +61,7 @@ MATHTER_FORCEINLINE auto ForUnrolled(Fun&& fun, Args&&... args) -> std::enable_i
std::forward<Args>(args)...);
}

} // namespace mathter
} // namespace mathter


#pragma GCC diagnostic pop
76 changes: 0 additions & 76 deletions include/Mathter/Common/Range.hpp

This file was deleted.

5 changes: 2 additions & 3 deletions include/Mathter/Decompositions/DecomposeSVD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@

#pragma once

#include "../Matrix/Matrix.hpp"
#include "../Transforms/IdentityBuilder.hpp"
#include "DecomposeQR.hpp"

#include <Mathter/Matrix/Matrix.hpp>
#include <Mathter/Transforms/IdentityBuilder.hpp>

#include <algorithm>
#include <array>

Expand Down
1 change: 0 additions & 1 deletion include/Mathter/Matrix/Arithmetic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#pragma once

#include "../Common/OptimizationUtil.hpp"
#include "../Vector/Arithmetic.hpp"
#include "../Vector/Math.hpp"
#include "Cast.hpp"
Expand Down
1 change: 0 additions & 1 deletion include/Mathter/Matrix/Cast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#pragma once

#include "../Common/OptimizationUtil.hpp"
#include "Matrix.hpp"


Expand Down
2 changes: 1 addition & 1 deletion include/Mathter/Vector/Math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ namespace impl {
using Scalar = scalar_type_t<Vec>;
constexpr auto Dim = dimension_v<Vec>;
Vec result;
Matrix<Scalar, Dim - 1, Dim - 1> detCalc;
Matrix<Scalar, Dim - 1, Dim - 1, eMatrixOrder::FOLLOW_VECTOR, eMatrixLayout::COLUMN_MAJOR, false> detCalc;

std::array<std::optional<std::reference_wrapper<const Vec>>, Dim - 1> vectors;
auto [argIt, outIt] = std::tuple(first, vectors.begin());
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ sonar.projectName=Mathter

sonar.sources=include,test

sonar.cfamily.llvm-cov.reportPath=./coverage.txt
sonar.coverageReportPaths=./coverage/SonarQube.xml
sonar.junit.reportPaths=./tests.xml
sonar.cfamily.threads=4
3 changes: 3 additions & 0 deletions test/Quaternion/TestRotationArithmetic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#include <catch2/catch_template_test_macros.hpp>


#pragma GCC diagnostic ignored "-Wdeprecated-declarations"


using namespace mathter;
using namespace test_util;

Expand Down
3 changes: 3 additions & 0 deletions test/Vector/TestVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ using namespace mathter;
using namespace test_util;


#pragma GCC diagnostic ignored "-Wunknown-attributes"


[[gnu::noinline, msvc::noinline]] void TestDefaultInit_Init(void* data, size_t size) {
std::memset(data, 0xCC, size);
}
Expand Down
Loading