Skip to content

Commit 03a3c2c

Browse files
danmarDaniel Marjamäki
authored andcommitted
partial fix #14581 (CI: run 'make test' with some old gcc versions)
1 parent 174a569 commit 03a3c2c

2 files changed

Lines changed: 39 additions & 1 deletion

File tree

.github/workflows/gcc-versions.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# the purpose of this github action is to test that cppcheck source code can be compiled using old gcc versions.
2+
# the gcc images we use here are copied from the official gcc images on docker hub
3+
4+
name: gcc-versions
5+
6+
on:
7+
push:
8+
branches:
9+
- 'main'
10+
- 'releases/**'
11+
- '2.*'
12+
tags:
13+
- '2.*'
14+
pull_request:
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
build:
21+
22+
strategy:
23+
matrix:
24+
#image: ["ghcr.io/cppcheck-opensource/gcc:5.4", "ghcr.io/cppcheck-opensource/gcc:6.5", "ghcr.io/cppcheck-opensource/gcc:7.5", "ghcr.io/cppcheck-opensource/gcc:8.5", "ghcr.io/cppcheck-opensource/gcc:9.5"]
25+
image: ["ghcr.io/cppcheck-opensource/gcc:5.4"]
26+
fail-fast: false
27+
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
with:
33+
persist-credentials: false
34+
35+
- name: Build cppcheck
36+
run: |
37+
docker run --rm -v ${{ github.workspace }}:/src -w /src ${{ matrix.image }} make -j$(nproc) CXXOPTS="-Werror" test

test/testpath.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,8 @@ class TestPath : public TestFixture {
516516
ASSERT_EQUALS(expected, Path::getAbsoluteFilePath(Path::join(cwd, "testabspath.txt")));
517517

518518
std::string cwd_up = Path::getPathFromFilename(cwd);
519-
cwd_up.pop_back(); // remove trailing slash
519+
if (cwd_up != "/")
520+
cwd_up.pop_back(); // remove trailing slash
520521
ASSERT_EQUALS(cwd_up, Path::getAbsoluteFilePath(Path::join(cwd, "..")));
521522
ASSERT_EQUALS(cwd_up, Path::getAbsoluteFilePath(Path::join(cwd, "../")));
522523
ASSERT_EQUALS(cwd_up, Path::getAbsoluteFilePath(Path::join(cwd, "..\\")));

0 commit comments

Comments
 (0)