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

#136 Run C++ tests in random order #147

Merged
merged 2 commits into from
Aug 8, 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
15 changes: 4 additions & 11 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ jobs:

- name: Clang-Format
working-directory: ${{github.workspace}}/ports/cpp
run: |
find source test -iname '*.hpp' -o -iname '*.cpp' \
| xargs clang-format-18 -Werror --dry-run \
--fallback-style=Google --verbose
run: sh ./ci/check-format.sh

- name: Configure
working-directory: ${{github.workspace}}/ports/cpp
Expand All @@ -58,14 +55,10 @@ jobs:
run: make

- name: Unit Test
working-directory: ${{github.workspace}}/ports/cpp/build/test
run: |
ctest
cat Testing/Temporary/LastTest.log
working-directory: ${{github.workspace}}/ports/cpp
run: sh ./ci/test.sh

- name: Clang-Tidy on sources
if: matrix.cmake_build_type == 'Release'
working-directory: ${{github.workspace}}/ports/cpp
run: |
find source -iname '*.hpp' -o -iname '*.cpp' \
| xargs clang-tidy-18 -p build/compile_commands.json
run: sh ./ci/check-style.sh
12 changes: 12 additions & 0 deletions ports/cpp/ci/check-format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

set -e

CLANG_FORMAT="clang-format"
if command -v clang-format-18 > /dev/null 2>&1; then
CLANG_FORMAT="clang-format-18"
fi
Comment on lines +5 to +8
Copy link
Contributor Author

@vityaman vityaman Aug 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To run locally if you are not an Ubuntu user. I had clang toolchain v18 by default.


find source test -iname '*.hpp' -o -iname '*.cpp' \
| xargs "$CLANG_FORMAT" -Werror --dry-run \
--fallback-style=Google --verbose
11 changes: 11 additions & 0 deletions ports/cpp/ci/check-style.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

set -e

CLANG_TIDY="clang-tidy"
if command -v clang-tidy-18 > /dev/null 2>&1; then
CLANG_TIDY="clang-tidy-18"
fi

find source -iname '*.hpp' -o -iname '*.cpp' \
| xargs "$CLANG_TIDY" -p build/compile_commands.json
25 changes: 25 additions & 0 deletions ports/cpp/ci/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

cd "$(dirname "$0")"/../build/test

ctest
if [ $? -ne 0 ]; then
cat Testing/Temporary/LastTest.log
exit 1
fi

exit 0 # https://github.com/mike-lischke/antlr4-c3/issues/136

set -e

TESTS="
whitebox
expr
cpp14
"

for test in $TESTS; do
for i in $(seq 5); do
(cd "./$test" && "./antlr4-c3-test-$test" --gtest_shuffle)
done
done
Loading