Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Improve test.summary rule #462

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 7 additions & 26 deletions .testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,8 @@ $(WORKSPACE)/work/%/$(1)/ocean.stats $(WORKSPACE)/work/%/$(1)/chksum_diag: build
&& $(TIME) $(5) $(MPIRUN) -n $(6) $(abspath $$<) 2> std.err > std.out \
|| !( \
mkdir -p ../../../results/$$*/ ; \
cat std.out | tee ../../../results/$$*/std.$(1).out | tail -n 20 ; \
cat std.err | tee ../../../results/$$*/std.$(1).err | tail -n 20 ; \
cat std.out | tee ../../../results/$$*/std.$(1).out | tail -n 40 ; \
cat std.err | tee ../../../results/$$*/std.$(1).err | tail -n 40 ; \
rm ocean.stats chksum_diag ; \
echo -e "$(FAIL): $$*.$(1) failed at runtime." \
)
Expand Down Expand Up @@ -630,8 +630,8 @@ $(WORKSPACE)/work/%/restart/ocean.stats: build/symmetric/MOM6 | preproc
# Run the first half-period
cd $(@D) && $(TIME) $(MPIRUN) -n 1 $(abspath $<) 2> std1.err > std1.out \
|| !( \
cat std1.out | tee ../../../results/$*/std.restart1.out | tail -n 20 ; \
cat std1.err | tee ../../../results/$*/std.restart1.err | tail -n 20 ; \
cat std1.out | tee ../../../results/$*/std.restart1.out | tail -n 40 ; \
cat std1.err | tee ../../../results/$*/std.restart1.err | tail -n 40 ; \
echo -e "$(FAIL): $*.restart failed at runtime." \
)
# Setup the next inputs
Expand All @@ -641,8 +641,8 @@ $(WORKSPACE)/work/%/restart/ocean.stats: build/symmetric/MOM6 | preproc
# Run the second half-period
cd $(@D) && $(TIME) $(MPIRUN) -n 1 $(abspath $<) 2> std2.err > std2.out \
|| !( \
cat std2.out | tee ../../../results/$*/std.restart2.out | tail -n 20 ; \
cat std2.err | tee ../../../results/$*/std.restart2.err | tail -n 20 ; \
cat std2.out | tee ../../../results/$*/std.restart2.out | tail -n 40 ; \
cat std2.err | tee ../../../results/$*/std.restart2.err | tail -n 40 ; \
echo -e "$(FAIL): $*.restart failed at runtime." \
)

Expand All @@ -652,26 +652,7 @@ $(WORKSPACE)/work/%/restart/ocean.stats: build/symmetric/MOM6 | preproc
# Not a true rule; only call this after `make test` to summarize test results.
.PHONY: test.summary
test.summary:
@if ls $(WORKSPACE)/results/*/* &> /dev/null; then \
if ls $(WORKSPACE)/results/*/std.*.err &> /dev/null; then \
echo "The following tests failed to complete:" ; \
ls $(WORKSPACE)/results/*/std.*.out \
| awk '{split($$0,a,"/"); split(a[3],t,"."); v=t[2]; if(length(t)>3) v=v"."t[3]; print a[2],":",v}'; \
fi; \
if ls $(WORKSPACE)/results/*/ocean.stats.*.diff &> /dev/null; then \
echo "The following tests report solution regressions:" ; \
ls $(WORKSPACE)/results/*/ocean.stats.*.diff \
| awk '{split($$0,a,"/"); split(a[3],t,"."); v=t[3]; if(length(t)>4) v=v"."t[4]; print a[2],":",v}'; \
fi; \
if ls $(WORKSPACE)/results/*/chksum_diag.*.diff &> /dev/null; then \
echo "The following tests report diagnostic regressions:" ; \
ls $(WORKSPACE)/results/*/chksum_diag.*.diff \
| awk '{split($$0,a,"/"); split(a[3],t,"."); v=t[2]; if(length(t)>3) v=v"."t[3]; print a[2],":",v}'; \
fi; \
false ; \
else \
echo -e "$(PASS): All tests passed!"; \
fi
@./tools/report_test_results.sh $(WORKSPACE)/results


#---
Expand Down
42 changes: 42 additions & 0 deletions .testing/tools/report_test_results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh
RESULTS=${1:-${PWD}/results}

GREEN="\033[0;32m"
RESET="\033[0m"
PASS="${GREEN}PASS${RESET}"

if [ -d ${RESULTS} ]; then
if ls ${RESULTS}/*/std.*.err &> /dev/null; then
echo "The following tests failed to complete:"
ls ${RESULTS}/*/std.*.out \
| awk '{ \
split($$0,a,"/"); \
split(a[length(a)],t,"."); \
v=t[2]; \
if(length(t)>4) v=v"."t[4]; print a[length(a)-1],":",v}'
fi

if ls ${RESULTS}/*/ocean.stats.*.diff &> /dev/null; then
echo "The following tests report solution regressions:"
ls ${RESULTS}/*/ocean.stats.*.diff \
| awk '{ \
split($$0,a,"/"); \
split(a[length(a)],t,"."); \
v=t[3]; \
if(length(t)>4) v=v"."t[4]; print a[length(a)-1],":",v}'
fi

if ls ${RESULTS}/*/chksum_diag.*.diff &> /dev/null; then
echo "The following tests report diagnostic regressions:"
ls ${RESULTS}/*/chksum_diag.*.diff \
| awk '{ \
split($$0,a,"/"); \
split(a[length(a)],t,"."); \
v=t[2]; \
if(length(t)>4) v=v"."t[4]; print a[length(a)-1],":",v}'
fi

exit 1
else
printf "${PASS}: All tests passed!\n"
fi