source: PSPA/madxPSPA/make/tester.numdiff @ 445

Last change on this file since 445 was 430, checked in by touze, 11 years ago

import madx-5.01.00

File size: 2.5 KB
Line 
1# |
2# o---------------------------------------------------------------------o
3# |
4# | MAD makefile - numdiff tester settings
5# |
6# o---------------------------------------------------------------------o
7# |
8# | Methodical Accelerator Design
9# |
10# | Copyright (c) 2011+ CERN, mad@cern.ch
11# |
12# | For more information, see http://cern.ch/mad
13# |
14# o---------------------------------------------------------------------o
15# |
16# | $Id$
17# |
18
19#
20# numdiff paths
21#
22ifndef NDIFF
23NDIFFCMD := $(firstword $(wildcard \
24              $(ND)_dev$(ARCH)$(BINARY_EXT) $(ND)_dev$(BINARY_EXT) \
25              $(ND)-dev$(ARCH)$(BINARY_EXT) $(ND)-dev$(BINARY_EXT) \
26              $(ND)$(ARCH)$(BINARY_EXT)     $(ND)$(BINARY_EXT) ))
27NDIFF_R  := $(if $(NDIFFCMD),..$/..$/$(NDIFFCMD),$(ND)$(BINARY_EXT))
28NDIFF_I  := $(if $(NDIFFCMD),.$/$(NDIFFCMD),$(ND)$(BINARY_EXT))
29else
30NDIFF_R  := $(NDIFF)
31NDIFF_I  := $(NDIFF)
32endif
33
34#
35# numdiff summary
36#
37NDSUM = tests-summary.txt
38
39#
40# numdiff flags
41# quiet, ingore blanks, check constraints, list mode, serie mode, debug mode, test title
42NDFLAGS = -q -b -c -l -n $(if $(call eq,$(NDDEBUG),yes),-debug,) \
43                         $(if $(call eq,$(NDTRACE),yes),-trace,) -a ..$/$(NDSUM) -t $@
44
45#
46# init-test macro
47#
48define init-test
49$_ $(RM) tests$/$(NDSUM) \
50     $(if $(call eq,$(OSTYPE),Windows),2> _err.txt && $(RM) _err.txt,) && \
51   $(call ND_tr,$(NDIFF_I) -q -a tests$/$(NDSUM))
52endef
53
54#
55# fini-test macro
56#
57define fini-test
58$_ $(CAT) tests$/$(NDSUM)
59endef
60
61#
62# run-test macro
63#
64# $@ = test name & directory
65NDFILES     = $(basename $(NDFILES_REF))
66NDFILES_OUT = $(addsuffix .out,$(NDFILES)) $(NDFILES)
67NDFILES_REF = $(wildcard   tests/$@/$@.ref) \
68              $(filter-out tests/$@/$@.ref, $(sort $(wildcard tests/$@/*.ref)))
69
70# Remarks line-by-line
71# check for .ref files unless NREF=yes
72# check for testsuite name ; go to test directory
73# delete generated files + cleanup output on Windows (case file not found)
74# run the test command (generate outputs)
75# for each reference file, diff with the generated file + constraints
76define run-test
77$(if $(call eq,$(NREF),yes),,$(call exists,$(NDFILES_REF),invalid test $@ -- no reference file found))
78-$_ $(if $(TESTSUITE),echo [ $(TESTSUITE) ] &&,) cd tests$/$@ && \
79$(RM) $(notdir $(NDFILES_OUT)) \
80  $(if $(call eq,$(OSTYPE),Windows),2> _err.txt && $(RM) _err.txt,) && \
81$(TESTCMD) > $@.out && \
82$(call ND_tr,$(NDIFF_R) $(NDFLAGS)) $(notdir $(NDFILES)) || \
83echo "error: $@ failed, check tests$/$@$/$@.out for details"
84endef
85
86# end of makefile
Note: See TracBrowser for help on using the repository browser.