Skip to content

Commit 76283ee

Browse files
authored
improved testing and CI (#278)
1 parent 3082bd7 commit 76283ee

3 files changed

Lines changed: 38 additions & 13 deletions

File tree

.github/workflows/CI-unixish.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/checkout@v2
1818

1919
- name: Install missing software on ubuntu
20-
if: matrix.os == 'ubuntu-20.04'
20+
if: matrix.os == 'ubuntu-22.04'
2121
run: |
2222
sudo apt-get update
2323
sudo apt-get install valgrind
@@ -28,31 +28,43 @@ jobs:
2828
- name: make test
2929
run: make -j$(nproc) test CXX=${{ matrix.compiler }}
3030

31-
- name: ensure that simplecpp.cpp uses c++03
32-
run: CXX=${{ matrix.compiler }} ; $CXX -fsyntax-only -std=c++98 simplecpp.cpp
33-
3431
- name: Run valgrind
35-
if: matrix.os == 'ubuntu-20.04'
32+
if: matrix.os == 'ubuntu-22.04'
3633
run: |
34+
make clean
35+
# this valgrind version doesn't support DWARF 5 yet
36+
make -j$(nproc) CXX=${{ matrix.compiler }} CXXFLAGS="-gdwarf-4"
3737
valgrind --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --gen-suppressions=all --error-exitcode=42 ./testrunner
3838
39+
- name: Run with libstdc++ debug mode
40+
if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'gcc'
41+
run: |
42+
make clean
43+
make -j$(nproc) test CXX=${{ matrix.compiler }} CXXFLAGS="-g3 -D_GLIBCXX_DEBUG"
44+
45+
- name: Run with libc++ debug mode
46+
if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'clang++'
47+
run: |
48+
make clean
49+
make -j$(nproc) test CXX=${{ matrix.compiler }} CXXFLAGS="-stdlib=libc++ -g3 -DLIBCXX_ENABLE_DEBUG_MODE" LDFLAGS="-lc++"
50+
3951
- name: Run AddressSanitizer
40-
if: matrix.os == 'ubuntu-20.04'
52+
if: matrix.os == 'ubuntu-22.04'
4153
run: |
4254
make clean
4355
make -j$(nproc) test CXX=${{ matrix.compiler }} CXXFLAGS="-O2 -g3 -fsanitize=address" LDFLAGS="-fsanitize=address"
4456
env:
4557
ASAN_OPTIONS: detect_stack_use_after_return=1
4658

4759
- name: Run UndefinedBehaviorSanitizer
48-
if: matrix.os == 'ubuntu-20.04'
60+
if: matrix.os == 'ubuntu-22.04'
4961
run: |
5062
make clean
5163
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"
5264
53-
# TODO: enable when false positives are fixed
65+
# TODO: requires instrumented libc++
5466
- name: Run MemorySanitizer
55-
if: false && matrix.os == 'ubuntu-20.04' && matrix.compiler == 'clang++'
67+
if: false && matrix.os == 'ubuntu-22.04' && matrix.compiler == 'clang++'
5668
run: |
5769
make clean
5870
make -j$(nproc) test CXX=${{ matrix.compiler }} CXXFLAGS="-O2 -g3 -stdlib=libc++ -fsanitize=memory" LDFLAGS="-lc++ -fsanitize=memory"

.github/workflows/CI-windows.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
strategy:
1717
matrix:
1818
os: [windows-2019, windows-2022]
19+
config: [Release, Debug]
1920
fail-fast: false
2021

2122
runs-on: ${{ matrix.os }}
@@ -40,9 +41,9 @@ jobs:
4041
4142
- name: Build
4243
run: |
43-
msbuild -m simplecpp.sln /p:Configuration=Release /p:Platform=x64 || exit /b !errorlevel!
44+
msbuild -m simplecpp.sln /p:Configuration=${{ matrix.config }} /p:Platform=x64 || exit /b !errorlevel!
4445
4546
- name: Test
4647
run: |
47-
.\Release\testrunner.exe || exit /b !errorlevel!
48+
.\${{ matrix.config }}\testrunner.exe || exit /b !errorlevel!
4849

run-tests.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import glob
33
import os
44
import subprocess
5+
import sys
56

67
def cleanup(out):
78
ret = ''
@@ -80,6 +81,7 @@ def cleanup(out):
8081

8182
numberOfSkipped = 0
8283
numberOfFailed = 0
84+
numberOfFixed = 0
8385

8486
usedTodos = []
8587

@@ -101,10 +103,13 @@ def cleanup(out):
101103
gcc_output = cleanup(comm[0])
102104

103105
simplecpp_cmd = ['./simplecpp']
104-
simplecpp_cmd.extend(cmd.split(' '))
106+
# -E is not supported and we bail out on unknown options
107+
simplecpp_cmd.extend(cmd.replace('-E ', '', 1).split(' '))
105108
p = subprocess.Popen(simplecpp_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
106109
comm = p.communicate()
110+
simplecpp_ec = p.returncode
107111
simplecpp_output = cleanup(comm[0])
112+
simplecpp_err = comm[0].decode('utf-8').strip()
108113

109114
if simplecpp_output != clang_output and simplecpp_output != gcc_output:
110115
filename = cmd[cmd.rfind('/')+1:]
@@ -113,14 +118,21 @@ def cleanup(out):
113118
usedTodos.append(filename)
114119
else:
115120
print('FAILED ' + cmd)
121+
if simplecpp_ec:
122+
print('simplecpp failed - ' + simplecpp_err)
116123
numberOfFailed = numberOfFailed + 1
117124

118125
for filename in todo:
119126
if not filename in usedTodos:
120127
print('FIXED ' + filename)
128+
numberOfFixed = numberOfFixed + 1
121129

122130
print('Number of tests: ' + str(len(commands)))
123131
print('Number of skipped: ' + str(numberOfSkipped))
124-
print('Number of todos: ' + str(len(usedTodos)))
132+
print('Number of todos (fixed): ' + str(len(usedTodos)) + ' (' + str(numberOfFixed) + ')')
125133
print('Number of failed: ' + str(numberOfFailed))
126134

135+
if numberOfFailed or numberOfFixed:
136+
sys.exit(1)
137+
138+
sys.exit(0)

0 commit comments

Comments
 (0)