Skip to content

Commit

Permalink
CI: Avoid error with cat if there are multiple output log files per…
Browse files Browse the repository at this point in the history
… test

If a test is run with multiple (different) numbers of parallel processes,
a separate set of `test-stderr*.log` and `test-stdout*.log` files is
created for each number of parallel processes. If one of these tests
fails for some reason, `cat` is essentially called with multiple file
arguments (which it doesn't support).

Avoid that error by iterating through the list of `test-stderr*.log` and
`test-stdout*.log` files.
  • Loading branch information
mmuetzel committed Jan 12, 2025
1 parent 18505d2 commit 38946da
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 28 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/build-macos-homebrew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,18 @@ jobs:
echo ---- Files ----
ls -Rl ${test_root}/${test}
if [ -f ${test_root}/${test}/test-stderr*.log ]; then
echo ---- Content of test-stderr*.log ----
cat ${test_root}/${test}/test-stderr*.log
err_logs=($(ls ${test_root}/${test}/test-stderr*.log))
for err_log in "${err_logs[@]}"; do
echo ---- Content of ${err_log} ----
cat ${err_log}
done
fi
if [ -f ${test_root}/${test}/test-stdout*.log ]; then
echo ---- Content of test-stdout*.log ----
cat ${test_root}/${test}/test-stdout*.log
out_logs=($(ls ${test_root}/${test}/test-stdout*.log))
for out_log in "${out_logs[@]}"; do
echo ---- Content of ${out_log} ----
cat ${out_log}
done
fi
echo "::endgroup::"
done
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/build-windows-mingw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,18 @@ jobs:
echo ---- Files ----
ls -Rl ${test_root}/${test}
if [ -f ${test_root}/${test}/test-stderr*.log ]; then
echo ---- Content of test-stderr*.log ----
cat ${test_root}/${test}/test-stderr*.log
err_logs=($(ls ${test_root}/${test}/test-stderr*.log))
for err_log in "${err_logs[@]}"; do
echo ---- Content of ${err_log} ----
cat ${err_log}
done
fi
if [ -f ${test_root}/${test}/test-stdout*.log ]; then
echo ---- Content of test-stdout*.log ----
cat ${test_root}/${test}/test-stdout*.log
out_logs=($(ls ${test_root}/${test}/test-stdout*.log))
for out_log in "${out_logs[@]}"; do
echo ---- Content of ${out_log} ----
cat ${out_log}
done
fi
echo "::endgroup::"
done
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,18 @@ jobs:
echo ---- Files ----
ls -Rl ${test_root}/${test}
if [ -f ${test_root}/${test}/test-stderr*.log ]; then
echo ---- Content of test-stderr*.log ----
cat ${test_root}/${test}/test-stderr*.log
err_logs=($(ls ${test_root}/${test}/test-stderr*.log))
for err_log in "${err_logs[@]}"; do
echo ---- Content of ${err_log} ----
cat ${err_log}
done
fi
if [ -f ${test_root}/${test}/test-stdout*.log ]; then
echo ---- Content of test-stdout*.log ----
cat ${test_root}/${test}/test-stdout*.log
out_logs=($(ls ${test_root}/${test}/test-stdout*.log))
for out_log in "${out_logs[@]}"; do
echo ---- Content of ${out_log} ----
cat ${out_log}
done
fi
echo "::endgroup::"
done
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/ubuntu-clang-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,18 @@ jobs:
echo ---- Files ----
ls -Rl ${test_root}/${test}
if [ -f ${test_root}/${test}/test-stderr*.log ]; then
echo ---- Content of test-stderr*.log ----
cat ${test_root}/${test}/test-stderr*.log
err_logs=($(ls ${test_root}/${test}/test-stderr*.log))
for err_log in "${err_logs[@]}"; do
echo ---- Content of ${err_log} ----
cat ${err_log}
done
fi
if [ -f ${test_root}/${test}/test-stdout*.log ]; then
echo ---- Content of test-stdout*.log ----
cat ${test_root}/${test}/test-stdout*.log
out_logs=($(ls ${test_root}/${test}/test-stdout*.log))
for out_log in "${out_logs[@]}"; do
echo ---- Content of ${out_log} ----
cat ${out_log}
done
fi
echo "::endgroup::"
done
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/ubuntu-elmerice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,18 @@ jobs:
echo ---- Files ----
ls -Rl ${test_root}/${test}
if [ -f ${test_root}/${test}/test-stderr*.log ]; then
echo ---- Content of test-stderr*.log ----
cat ${test_root}/${test}/test-stderr*.log
err_logs=($(ls ${test_root}/${test}/test-stderr*.log))
for err_log in "${err_logs[@]}"; do
echo ---- Content of ${err_log} ----
cat ${err_log}
done
fi
if [ -f ${test_root}/${test}/test-stdout*.log ]; then
echo ---- Content of test-stdout*.log ----
cat ${test_root}/${test}/test-stdout*.log
out_logs=($(ls ${test_root}/${test}/test-stdout*.log))
for out_log in "${out_logs[@]}"; do
echo ---- Content of ${out_log} ----
cat ${out_log}
done
fi
echo "::endgroup::"
done
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/ubuntu-gcc-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,18 @@ jobs:
echo ---- Files ----
ls -Rl ${test_root}/${test}
if [ -f ${test_root}/${test}/test-stderr*.log ]; then
echo ---- Content of test-stderr*.log ----
cat ${test_root}/${test}/test-stderr*.log
err_logs=($(ls ${test_root}/${test}/test-stderr*.log))
for err_log in "${err_logs[@]}"; do
echo ---- Content of ${err_log} ----
cat ${err_log}
done
fi
if [ -f ${test_root}/${test}/test-stdout*.log ]; then
echo ---- Content of test-stdout*.log ----
cat ${test_root}/${test}/test-stdout*.log
out_logs=($(ls ${test_root}/${test}/test-stdout*.log))
for out_log in "${out_logs[@]}"; do
echo ---- Content of ${out_log} ----
cat ${out_log}
done
fi
echo "::endgroup::"
done
Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/ubuntu-parallel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,18 @@ jobs:
echo ---- Files ----
ls -Rl ${test_root}/${test}
if [ -f ${test_root}/${test}/test-stderr*.log ]; then
echo ---- Content of test-stderr*.log ----
cat ${test_root}/${test}/test-stderr*.log
err_logs=($(ls ${test_root}/${test}/test-stderr*.log))
for err_log in "${err_logs[@]}"; do
echo ---- Content of ${err_log} ----
cat ${err_log}
done
fi
if [ -f ${test_root}/${test}/test-stdout*.log ]; then
echo ---- Content of test-stdout*.log ----
cat ${test_root}/${test}/test-stdout*.log
out_logs=($(ls ${test_root}/${test}/test-stdout*.log))
for out_log in "${out_logs[@]}"; do
echo ---- Content of ${out_log} ----
cat ${out_log}
done
fi
echo "::endgroup::"
done
Expand Down

0 comments on commit 38946da

Please sign in to comment.