geodynamics / aspect

A parallel, extensible finite element code to simulate convection in both 2D and 3D models.
https://aspect.geodynamics.org/
Other
228 stars 238 forks source link

CI: Avoid error message in CI output #5512

Closed bangerth closed 12 months ago

bangerth commented 12 months ago

In our CI steps (see for example https://github.com/geodynamics/aspect/actions/runs/7118963444/job/19383040624?pr=5511), we break running and reporting tests into several sub-steps. In the "Write test results" step, we always get this error:

Run cd build
cd /__w/aspect/aspect/build && /__w/aspect/aspect/cmake/generate_reference_output.sh
Overwriting test output with reference output ...
Errors while running CTest
Output from these tests are in: /__w/aspect/aspect/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
warning: Not a git repository. Use --no-index to compare two paths outside a working tree
usage: git diff --no-index [<options>] <path> <path>

Diff output format options
    -p, --patch           generate patch
    -s, --no-patch        suppress diff output
    -u                    generate patch
    -U, --unified[=<n>]   generate diffs with <n> lines context
...

This is from the cmake/generate_reference_output.sh script, which is called by the generate_reference_output target in CMakeLists.txt:

# Provide the "generate_reference_output" target:
ADD_CUSTOM_TARGET(generate_reference_output
  COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cmake/generate_reference_output.sh
  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

Note that it is called in the build directory.

The script itself looks like this:

...
SRC_PATH=`dirname $0`
SRC_PATH=`cd $SRC_PATH/..;pwd`

...

cd $SRC_PATH
git diff tests/ >$OUT
if [ -s $OUT ]; then
  echo "generated patch file: $OUT";
  echo "modified files:"
  git diff --name-only tests/
else
  echo "no reference file changed."
fi

I think that we ought to be ending up in the top-level source directory, but git diff nevertheless says that this is a git directory in the error message. Does anyone see what is going on here? Are we only pulling from a git repository instead of creating a local clone?

gassmoeller commented 12 months ago

I think what you see is a combination of two error messages. The first is ctest failing, in this case because of the multigrid failures with deal.II dev. For example the first part of the message is not present in the passing 9.5 tester output: https://github.com/geodynamics/aspect/actions/runs/7118963444/job/19383040245?pr=5511#step:7:18).

The second error that is a real problem is the line with warning: Not a git repository. and below. I am relatively certain that this is the issue I tried to fix in #5499. I didnt realize that generate_reference_output already calls git diff, so I think the change from #5499 may have to move up one line to fix this. The problem as far as I understand is that the git version on the github actions runner that checks out the repository is slightly incompatible with the git version inside our tester container, and the version inside the container does not recognize the repository as safe, which leads to it refusing to do commands like git diff. I can prepare a PR, which will hopefully fix the issue.