# Makefile for testing code by comparing test output with sample output
# For heavy

#------------------------------------------------------------
# Examples for vanilla tests:

#    make -f Make_test "ARCH=vanilla" test
# or, for a specific project or projects
#    make -f Make_test "ARCH=vanilla" "PROJS=su3_rmd" test

# For tests on the SP, do the same, but use "ARCH=sp_mpi" with
# the appropriate MP_PROCS environment variable set.

# For tests on other platforms, first edit the file ../Make_test_template
# to select the appropriate LAUNCH and ARCH.  Then run
# commands as above, but without the command line "ARCH=..." definition.

# Results are in the files out.test.diff.* 
#------------------------------------------------------------

# For comparing test output with sample output

PROJS = su3_hev_mr su3_hev_cg

PRECLIST = 1 2

PATTERNS = BEGIN_ALL END_ALL
TOL = 1e-5

CUSTOM = .meson

include ../Make_test_template

# Change according to in.sample.su3_sum.${PREC}
OUTSTEM = out.meson.120
TESTOUTLIST = ${OUTSTEM}.static ${OUTSTEM}.100 ${OUTSTEM}.120
OUTBIN = meson.120 meson.140

utilities/su3_sum:
	cd utilities; ${MAKE} -f Makefile su3_sum ; cd ..

${TESTOUTLIST}: utilities/su3_sum in.sample.su3_sum.${PREC} out.test.${PROJ}.${PREC} ${OUTBIN}
	utilities/su3_sum < in.sample.su3_sum.${PREC} > out.test.su3_sum.${PREC}
	rm -f ${OUTBIN}

out.test.meson.${PROJ}.${PREC}: ${TESTOUTLIST}
	echo "BEGIN_ALL" > out.test.meson.${PROJ}.${PREC}
	for file in ${TESTOUTLIST};\
	do\
	   echo $$file >> $@;\
	   cat  $$file >> $@;\
	done
	echo "END_ALL" >> $@
	-/bin/rm -f ${TESTOUTLIST}

check: test

clean: test_clean
