-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile
122 lines (113 loc) · 4.74 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#
# Makefile for the PyFerret bench subdirectory
#
# include platform specific macro definitions for make_stream_file
include ../site_specific.mk
include ../platform_specific.mk.$(BUILDTYPE)
## Run all the benchmark tests, including those requiring remote data
## (environment variable SKIP_REMOTE is empty)
.PHONY: check
check:
@$(MAKE) "SKIP_REMOTE=" run_tests
@$(MAKE) "SKIP_REMOTE=" compare_plots
@$(MAKE) "SKIP_REMOTE=" compare_logs
## Run all the benchmark tests except those requiring remote data
## (environment variable SKIP_REMOTE is not empty)
.PHONY: check_noremote
check_noremote:
@$(MAKE) "SKIP_REMOTE=XXXX" run_tests
@$(MAKE) "SKIP_REMOTE=XXXX" compare_plots
@$(MAKE) "SKIP_REMOTE=XXXX" compare_logs
## Execute the RUN_TESTS.sh test suite
## If the environment variable SKIP_REMOTE is not empty, skips tests requiring remote data
.PHONY: run_tests
run_tests:
@( \
ferret_exe=`which pyferret` ;\
if [ $$ferret_exe = "" -o "$(FER_DIR)" = "" ] ; then \
echo "*** PyFerret must be installed and the ferret_paths script must have sourced for these tests ***" ;\
exit 1 ;\
fi ;\
echo "Using $$ferret_exe" ;\
SED_EXTREGEX_FLAG="$(SED_EXTREGEX_FLAG)" ;\
export SED_EXTREGEX_FLAG ;\
./RUN_TESTS.sh $$ferret_exe "$(PYFER_EXTERNAL_FUNCTIONS)" \
)
## Compare the plots from executing the RUN_TESTS.sh test suite with those saved.
## If the environment variable SKIP_REMOTE is empty, compares to those under "test_result";
## otherwise compares to those under "test_results_noremote"
.PHONY: compare_plots
compare_plots:
-@( \
if [ -z "$(SKIP_REMOTE)" ] ; then \
results_dir="test_results" ;\
else \
results_dir="test_results_noremote" ;\
fi ;\
echo "Comparing PNG and PDF files to those in bench/$$results_dir" ;\
for img in `find . -name '*.p[nd][gf]' -a \! -regex '.*_diff.png' -exec basename {} \; | sort -u` ; do \
if [ ! -f $$img ] ; then \
echo "****** File $$img is missing ******" ;\
elif [ ! -f $$results_dir/$$img ] ; then \
echo "****** File $$results_dir/$$img is missing ******" ;\
elif diff -q $$img $$results_dir/$$img 1> /dev/null ; then \
echo "(Files $$img and $$results_dir/$$img are identical)" ;\
else \
numdiffpix=`compare -quiet -metric AE $$img $$results_dir/$$img $${img}_diff.png 2>&1` ;\
if [ "$$numdiffpix" = "0" ] ; then \
rm -f $${img}_diff.png ;\
echo "(Images $$img and $$results_dir/$$img are identical)" ;\
else \
echo "****** Images $$img and $$results_dir/$$img are different ******" ;\
fi ;\
fi ;\
done \
)
@echo ''
@echo 'Inspect the *_diff.png files for actual differences in the images'
@echo ''
## Compare the log, err, and ncdump results from executing the RUN_TESTS.sh test suite.
## If the environment variable SKIP_REMOTE is empty, compares to those under "test_result";
## otherwise compares to those under "test_results_noremote"
.PHONY: compare_logs
compare_logs:
-@( \
if [ -z "$(SKIP_REMOTE)" ] ; then \
results_dir="test_results" ;\
else \
results_dir="test_results_noremote" ;\
fi ;\
datetag=`date +'%d%h%yAT'|tr '[A-Z]' '[a-z]'` ;\
logfile=`/bin/ls -1 all_$${datetag}*_log` ;\
if [ -z "$$logfile" ] ; then \
echo "*** No run_tests results log file from today found ***" ;\
exit 1 ;\
fi ;\
if [ `echo "$${logfile[@]}" | wc -l` -ne 1 ] ; then \
echo "*** Multiple run_tests results logs from today found ***" ;\
exit 1 ;\
fi ;\
echo "Comparing $$logfile to bench/$$results_dir/pyferret_run_tests_log" ;\
diff $$logfile $$results_dir/pyferret_run_tests_log 1> pyferret_run_tests_log.diff 2>&1 ;\
errfile=`echo $$logfile | sed -e "s%log%err%"` ;\
echo "Comparing $$errfile to bench/$$results_dir/pyferret_run_tests_err" ;\
diff $$errfile $$results_dir/pyferret_run_tests_err 1> pyferret_run_tests_err.diff 2>&1 ;\
ncdfile=`echo $$logfile | sed -e "s%log%ncdump%"` ;\
echo "Comparing $$ncdfile to bench/$$results_dir/pyferret_run_tests_ncdump" ;\
diff $$ncdfile $$results_dir/pyferret_run_tests_ncdump 1> pyferret_run_tests_ncdump.diff 2>&1 ;\
echo '' ;\
echo 'Inspect the pyferret_run_tests_*.diff files for actual differences in the output' \
)
@echo ''
.PHONY: clean
clean:
rm -f all_*_ncdump all_*_err all_*_log all_*_ncdump_orig all_*_err_orig all_*_log_orig cleanups.sed
rm -f *.ps* *.eps* *.png* *.pdf* *.diff* ferret.jnl*
rm -f `cat TRASH_FILES`
rm -f all_ncdump.out fort.41 make_stream_file
rm -fr subdir tmp aggf
make_stream_file: make_stream_file.F
$(FC) $(FFLAGS) make_stream_file.F -o make_stream_file
#
# End of Makefile
#