Skip to content

Commit

Permalink
Test in more configurations and cleanup tests (#111)
Browse files Browse the repository at this point in the history
Test shared builds, c++17 and c++20, clang on windows, and disabled
macos configurations
  • Loading branch information
jeremy-rifkin authored Jan 5, 2025
1 parent 934e163 commit ac2423c
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 13 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
compiler: [g++-10, clang++-14]
cxx_version: [ cxx_std_17, cxx_std_20 ]
target: [Debug, Release]
shared: [ON, OFF]
steps:
- uses: actions/checkout@v2
- name: dependencies
Expand All @@ -25,6 +26,7 @@ jobs:
-DCMAKE_BUILD_TYPE=${{matrix.target}} \
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
-DLIBASSERT_DESIRED_CXX_STANDARD="${{matrix.cxx_version}}" \
-DLIBASSERT_BUILD_SHARED=${{matrix.shared}} \
-DLIBASSERT_WERROR_BUILD=On
make -j
build-macos:
Expand All @@ -33,9 +35,9 @@ jobs:
fail-fast: false
matrix:
compiler: [g++-12, clang++]
c_compiler: [g++-12, clang++]
cxx_version: [ cxx_std_17, cxx_std_20 ]
target: [Debug, Release]
shared: [ON, OFF]
steps:
- uses: actions/checkout@v2
- name: build
Expand All @@ -46,6 +48,7 @@ jobs:
-DCMAKE_BUILD_TYPE=${{matrix.target}} \
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
-DLIBASSERT_DESIRED_CXX_STANDARD="${{matrix.cxx_version}}" \
-DLIBASSERT_BUILD_SHARED=${{matrix.shared}} \
-DLIBASSERT_WERROR_BUILD=On
make -j
build-windows:
Expand All @@ -56,6 +59,7 @@ jobs:
compiler: [cl, clang++]
cxx_version: [ cxx_std_17, cxx_std_20 ]
target: [Debug, Release]
shared: [ON, OFF]
steps:
- uses: actions/checkout@v2
- name: Enable Developer Command Prompt
Expand All @@ -68,6 +72,7 @@ jobs:
-DCMAKE_BUILD_TYPE=${{matrix.target}} `
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} `
-DLIBASSERT_DESIRED_CXX_STANDARD="${{matrix.cxx_version}}" `
-DLIBASSERT_BUILD_SHARED=${{matrix.shared}} `
-DLIBASSERT_WERROR_BUILD=On
msbuild .\libassert.sln
build-mingw:
Expand All @@ -78,6 +83,7 @@ jobs:
compiler: [g++]
cxx_version: [ cxx_std_17, cxx_std_20 ]
target: [Debug, Release]
shared: [ON, OFF]
steps:
- uses: actions/checkout@v2
- name: Enable Developer Command Prompt
Expand All @@ -90,6 +96,7 @@ jobs:
-DCMAKE_BUILD_TYPE=${{matrix.target}} `
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} `
-DLIBASSERT_DESIRED_CXX_STANDARD="${{matrix.cxx_version}}" `
-DLIBASSERT_BUILD_SHARED=${{matrix.shared}} `
-DLIBASSERT_WERROR_BUILD=On `
"-GUnix Makefiles"
make -j
31 changes: 20 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ jobs:
fail-fast: false
matrix:
compiler: [g++-10, clang++-14]
cxx_version: [ cxx_std_17, cxx_std_20 ]
target: [Debug]
shared: [ON, OFF]
steps:
- uses: actions/checkout@v2
- name: dependencies
Expand All @@ -28,6 +30,9 @@ jobs:
cmake .. \
-DCMAKE_BUILD_TYPE=${{matrix.target}} \
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
-DLIBASSERT_DESIRED_CXX_STANDARD="${{matrix.cxx_version}}" \
-DLIBASSERT_BUILD_SHARED=${{matrix.shared}} \
-DCPPTRACE_BUILD_SHARED=ON \
-DLIBASSERT_BUILD_TESTING=On \
-DLIBASSERT_WERROR_BUILD=On
make -j
Expand Down Expand Up @@ -68,15 +73,9 @@ jobs:
fail-fast: false
matrix:
compiler: [g++-12, clang++]
c_compiler: [gcc-12, clang]
cxx_version: [ cxx_std_17, cxx_std_20 ]
target: [Debug]
exclude: # TODO: Ugly hack
- compiler: g++-12
c_compiler: clang
- compiler: clang++
c_compiler: gcc-12
- compiler: clang++ # Disabled due to #15 TODO TODO TODO
target: Debug
shared: [ON, OFF]
steps:
- uses: actions/checkout@v2
- name: dependencies
Expand All @@ -89,7 +88,8 @@ jobs:
cmake .. \
-DCMAKE_BUILD_TYPE=${{matrix.target}} \
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
-DCMAKE_C_COMPILER=${{matrix.c_compiler}} \
-DLIBASSERT_DESIRED_CXX_STANDARD="${{matrix.cxx_version}}" \
-DCPPTRACE_BUILD_SHARED=ON \
-DLIBASSERT_BUILD_TESTING=On \
-DLIBASSERT_WERROR_BUILD=On
make -j
Expand All @@ -102,8 +102,10 @@ jobs:
strategy:
fail-fast: false
matrix:
compiler: [cl] # turned off clang for now
compiler: [cl, clang++]
cxx_version: [ cxx_std_17, cxx_std_20 ]
target: [Debug]
shared: [ON, OFF]
steps:
- uses: actions/checkout@v2
- name: Enable Developer Command Prompt
Expand All @@ -112,12 +114,15 @@ jobs:
run: |
pip install icdiff
- name: build msvc
if: ${{ matrix.compiler == 'cl' }}
# if: ${{ matrix.compiler == 'cl' }}
run: |
mkdir -p build
cd build
cmake .. `
-DCMAKE_BUILD_TYPE=${{matrix.target}} `
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} `
-DLIBASSERT_DESIRED_CXX_STANDARD="${{matrix.cxx_version}}" `
-DCPPTRACE_BUILD_SHARED=ON `
-DLIBASSERT_BUILD_TESTING=On `
-DLIBASSERT_WERROR_BUILD=On
msbuild .\libassert.sln
Expand All @@ -143,7 +148,9 @@ jobs:
fail-fast: false
matrix:
compiler: [g++]
cxx_version: [ cxx_std_17, cxx_std_20 ]
target: [Debug]
shared: [ON, OFF]
steps:
- uses: actions/checkout@v2
- name: Enable Developer Command Prompt
Expand All @@ -158,6 +165,8 @@ jobs:
cmake .. `
-DCMAKE_BUILD_TYPE=${{matrix.target}} `
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} `
-DLIBASSERT_DESIRED_CXX_STANDARD="${{matrix.cxx_version}}" `
-DCPPTRACE_BUILD_SHARED=ON `
-DLIBASSERT_BUILD_TESTING=On `
-DLIBASSERT_USE_CI_WRAPPER=On `
"-GUnix Makefiles" `
Expand Down
107 changes: 107 additions & 0 deletions tests/integration/expected/clang.macos.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
===================== [simple recursion] =====================
Debug Assertion failed at integration.cpp:501: void rec(int):
debug_assert(false);

Stack trace:
# 1 rec(int)
at integration.cpp:501
# 2 rec(int)
at integration.cpp:502
| |
| 8 layers of recursion were folded |
| |
#11 rec(int)
at integration.cpp:502
#12 test_class<int>::something_else()
at integration.cpp:2600
#13 void test_class<int>::something<N>(std::__1::pair<N, int>)
at integration.cpp:1004
#14 main
at integration.cpp:402


===================== [other recursion] =====================
Debug Assertion failed at integration.cpp:508: void recursive_a(int):
debug_assert(false);

Stack trace:
# 1 recursive_a(int)
at integration.cpp:508
# 2 recursive_b(int)
at integration.cpp:514
# 3 recursive_a(int)
at integration.cpp:509
# 4 recursive_b(int)
at integration.cpp:514
# 5 recursive_a(int)
at integration.cpp:509
# 6 recursive_b(int)
at integration.cpp:514
# 7 recursive_a(int)
at integration.cpp:509
# 8 recursive_b(int)
at integration.cpp:514
# 9 recursive_a(int)
at integration.cpp:509
#10 recursive_b(int)
at integration.cpp:514
#11 recursive_a(int)
at integration.cpp:509
#12 test_class<int>::something_else()
at integration.cpp:2700
#13 void test_class<int>::something<N>(std::__1::pair<N, int>)
at integration.cpp:1004
#14 main
at integration.cpp:402


===================== [Path differentiation] =====================
Debug Assertion failed at x/a.cpp:5: void test_path_differentiation_2():
debug_assert(false);

Stack trace:
# 1 test_path_differentiation_2()
at x/a.cpp:5
# 2 test_path_differentiation()
at integration/a.cpp:7
# 3 test_class<int>::something_else()
at integration.cpp:2800
# 4 void test_class<int>::something<N>(std::__1::pair<N, int>)
at integration.cpp:1004
# 5 main
at integration.cpp:402


===================== [Type cleaning] =====================
Debug Assertion failed at integration.cpp:3305: void test_class<int>::test_pretty_function_cleaning(const std::map<std::string, std::vector<std::string_view>> &) [T = int]:
debug_assert(map == other);
Where:
map => std::map<std::string, std::vector<std::string_view>>: [["bar", ["b1", "b3", "b5"]], ["foo", ["f1", "f3", "f5"]]]
other => std::map<std::string, std::vector<std::string_view>>: []

Stack trace:
# 1 test_class<int>::test_pretty_function_cleaning(std::__1::map<std::string, std::__1::vector<std::string_view>, std::__1::less<std::string>> const&)
at integration.cpp:3305
# 2 test_class<int>::something_else()
at integration.cpp:3201
# 3 void test_class<int>::something<N>(std::__1::pair<N, int>)
at integration.cpp:1004
# 4 main
at integration.cpp:402


===================== [Complex type resolution] =====================
Debug Assertion failed at integration.cpp:3602: void test_class<int>::test_complex_typing(const volatile std::vector<std::string> *const &, int *, const char (&)[4], decltype(&complex_typing::S::foo), int complex_typing::S::*) [T = int]:
debug_assert(false);

Stack trace:
# 1 test_class<int>::test_complex_typing(std::__1::vector<std::string> const volatile* const&, int*, char const (&) [4], void (complex_typing::S::*)(int, std::string, void***, void* (*)(int), void (* (*)(int))(), void (* (* (*)(int)) [5])()), int complex_typing::S::*)
at integration.cpp:3602
# 2 test_class<int>::something_else()
at integration.cpp:3502
# 3 void test_class<int>::something<N>(std::__1::pair<N, int>)
at integration.cpp:1004
# 4 main
at integration.cpp:402


2 changes: 1 addition & 1 deletion tests/run-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def main():
compiler_id = sys.argv[3].lower()
if compiler_id.startswith("gcc") or compiler_id.startswith("g++") or compiler_id.startswith("gnu"):
target.append("gnu")
elif compiler_id.startswith("clang"):
elif "clang" in compiler_id:
target.append("clang")
elif compiler_id.startswith("cl") or compiler_id.startswith("msvc"):
target.append("msvc")
Expand Down

0 comments on commit ac2423c

Please sign in to comment.