Skip to content

Commit

Permalink
Fix bugs in tooling
Browse files Browse the repository at this point in the history
Fix bugs in tools used to manage the gyselalibxx repo.
In the static analysis a bug is fixed where directive quoting errors were reported on the wrong file. A second bug is fixed where the cppcheck output did not affect whether the test passed or failed.
In the github CI tools environment variables are set to continue using OpenMPI despite the use of root in the docker file (necessary to avoid permission errors when creating/copying files). See open-mpi/ompi#4451 for more details

See merge request gysela-developpers/gyselalibxx!655

--------------------------------------------
  • Loading branch information
EmilyBourne committed Aug 12, 2024
1 parent 900b8a3 commit ceefeb8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ jobs:
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchains/docker.gyselalibxx_env/${{ matrix.toolchain }} ..
cmake --build . -j 4
ctest -j 2 --timeout 5 --output-junit tests.xml
env:
OMPI_ALLOW_RUN_AS_ROOT: 1 # OpenMPI can run as root safely inside a docker container
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
Expand Down
11 changes: 8 additions & 3 deletions ci_tools/gyselalib_static_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,8 @@ def check_directives(file):
if file.file.suffix == '.hpp' and not file.root.findall("./dump/directivelist/directive[@str='#pragma once']"):
report_error(FATAL, file, 2, "#pragma once missing from the top of a hpp file")

directives = {d.attrib['linenr']: d.attrib['str'].split() for d in file.root.findall("./dump/directivelist/directive")}
directives = {d.attrib['linenr']: d.attrib['str'].split() for d in file.root.findall("./dump/directivelist/directive")
if Path(d.attrib['file']) == file.file}
include_directives = {linenr: words[1] for linenr, words in directives.items() if len(words)>1 and words[0] == '#include'}
for linenr, include_str in include_directives.items():
include_file = include_str[1:-1]
Expand Down Expand Up @@ -413,12 +414,16 @@ def check_licence_presence(file):
for f in multipatch_geom:
if no_file_filter or f in filter_files:
print("------------- Checking ", f, " -------------")
subprocess.run([*cppcheck_command, f], check=False)
p = subprocess.run([*cppcheck_command, f], check=False)
if p.returncode:
error_level = max(error_level, possible_error_levels[STYLE])

for geom, files in relevant_files.items():
if no_file_filter or any(f in filter_files for f in files):
print("------------- Checking ", geom, " -------------")
subprocess.run(cppcheck_command + list(files) + [f'--file-filter={f}' for f in filter_files], check=False)
p = subprocess.run(cppcheck_command + list(files) + [f'--file-filter={f}' for f in filter_files], check=False)
if p.returncode:
error_level = max(error_level, possible_error_levels[STYLE])

files = [FileObject(f) for f in HOME_DIR.glob('**/*.dump')]
for myfile in files:
Expand Down

0 comments on commit ceefeb8

Please sign in to comment.