Skip to content

Commit cb63bf6

Browse files
committed
added selfcheck
1 parent f181a9a commit cb63bf6

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

.github/workflows/CI-unixish.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,43 +28,48 @@ jobs:
2828
- name: make test
2929
run: make -j$(nproc) test CXX=${{ matrix.compiler }}
3030

31+
- name: selfcheck
32+
run: |
33+
make -j$(nproc) selfcheck CXX=${{ matrix.compiler }}
34+
3135
- name: Run valgrind
3236
if: matrix.os == 'ubuntu-22.04'
3337
run: |
3438
make clean
3539
# this valgrind version doesn't support DWARF 5 yet
3640
make -j$(nproc) CXX=${{ matrix.compiler }} CXXFLAGS="-gdwarf-4"
3741
valgrind --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --gen-suppressions=all --error-exitcode=42 ./testrunner
42+
valgrind --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --gen-suppressions=all --error-exitcode=42 ./simplecpp -q simplecpp.cpp
3843
3944
- name: Run with libstdc++ debug mode
4045
if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'g++'
4146
run: |
4247
make clean
43-
make -j$(nproc) test CXX=${{ matrix.compiler }} CXXFLAGS="-g3 -D_GLIBCXX_DEBUG"
48+
make -j$(nproc) test selfcheck CXX=${{ matrix.compiler }} CXXFLAGS="-g3 -D_GLIBCXX_DEBUG"
4449
4550
- name: Run with libc++ debug mode
4651
if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'clang++'
4752
run: |
4853
make clean
49-
make -j$(nproc) test CXX=${{ matrix.compiler }} CXXFLAGS="-stdlib=libc++ -g3 -D_LIBCPP_ENABLE_ASSERTIONS=1" LDFLAGS="-lc++"
54+
make -j$(nproc) test selfcheck CXX=${{ matrix.compiler }} CXXFLAGS="-stdlib=libc++ -g3 -D_LIBCPP_ENABLE_ASSERTIONS=1" LDFLAGS="-lc++"
5055
5156
- name: Run AddressSanitizer
5257
if: matrix.os == 'ubuntu-22.04'
5358
run: |
5459
make clean
55-
make -j$(nproc) test CXX=${{ matrix.compiler }} CXXFLAGS="-O2 -g3 -fsanitize=address" LDFLAGS="-fsanitize=address"
60+
make -j$(nproc) test selfcheck CXX=${{ matrix.compiler }} CXXFLAGS="-O2 -g3 -fsanitize=address" LDFLAGS="-fsanitize=address"
5661
env:
5762
ASAN_OPTIONS: detect_stack_use_after_return=1
5863

5964
- name: Run UndefinedBehaviorSanitizer
6065
if: matrix.os == 'ubuntu-22.04'
6166
run: |
6267
make clean
63-
make -j$(nproc) test CXX=${{ matrix.compiler }} CXXFLAGS="-O2 -g3 -fsanitize=undefined -fno-sanitize=signed-integer-overflow" LDFLAGS="-fsanitize=undefined -fno-sanitize=signed-integer-overflow"
68+
make -j$(nproc) test selfcheck CXX=${{ matrix.compiler }} CXXFLAGS="-O2 -g3 -fsanitize=undefined -fno-sanitize=signed-integer-overflow" LDFLAGS="-fsanitize=undefined -fno-sanitize=signed-integer-overflow"
6469
6570
# TODO: requires instrumented libc++
6671
- name: Run MemorySanitizer
6772
if: false && matrix.os == 'ubuntu-22.04' && matrix.compiler == 'clang++'
6873
run: |
6974
make clean
70-
make -j$(nproc) test CXX=${{ matrix.compiler }} CXXFLAGS="-O2 -g3 -stdlib=libc++ -fsanitize=memory" LDFLAGS="-lc++ -fsanitize=memory"
75+
make -j$(nproc) test selfcheck CXX=${{ matrix.compiler }} CXXFLAGS="-O2 -g3 -stdlib=libc++ -fsanitize=memory" LDFLAGS="-lc++ -fsanitize=memory"

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ test: testrunner simplecpp
1616
./testrunner
1717
python3 run-tests.py
1818

19+
selfcheck: simplecpp
20+
./selfcheck.sh
21+
1922
simplecpp: main.o simplecpp.o
2023
$(CXX) $(LDFLAGS) main.o simplecpp.o -o simplecpp
2124

selfcheck.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
output=$(./simplecpp simplecpp.cpp -e 2>&1)
6+
echo "$output" | grep -v 'Header not found: <'

0 commit comments

Comments
 (0)