1#
2# Makefile gnucobol/tests
3#
4# Copyright (C) 2003-2012, 2014-2019 Free Software Foundation, Inc.
5# Written by Keisuke Nishida, Roger While, Simon Sobisch
6#
7# This file is part of GnuCOBOL.
8#
9# The GnuCOBOL compiler is free software: you can redistribute it
10# and/or modify it under the terms of the GNU General Public License
11# as published by the Free Software Foundation, either version 3 of the
12# License, or (at your option) any later version.
13#
14# GnuCOBOL is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with GnuCOBOL.  If not, see <https://www.gnu.org/licenses/>.
21
22SUBDIRS = cobol85
23
24TESTSUITE = $(srcdir)/testsuite
25TESTSUITE_MANUAL = $(srcdir)/testsuite_manual
26dist_check_SCRIPTS = listings-sed.sh
27
28testsuite_sources = \
29	testsuite.src/used_binaries.at \
30	testsuite.src/configuration.at \
31	testsuite.src/syn_copy.at \
32	testsuite.src/syn_definition.at \
33	testsuite.src/syn_file.at \
34	testsuite.src/syn_functions.at \
35	testsuite.src/syn_misc.at \
36	testsuite.src/syn_move.at \
37	testsuite.src/syn_multiply.at \
38	testsuite.src/syn_occurs.at \
39	testsuite.src/syn_redefines.at \
40	testsuite.src/syn_refmod.at \
41	testsuite.src/syn_reportwriter.at \
42	testsuite.src/syn_screen.at \
43	testsuite.src/syn_set.at \
44	testsuite.src/syn_subscripts.at \
45	testsuite.src/syn_value.at \
46	testsuite.src/listings.at \
47	testsuite.src/run_accept.at \
48	testsuite.src/run_extensions.at \
49	testsuite.src/run_file.at \
50	testsuite.src/run_functions.at \
51	testsuite.src/run_fundamental.at \
52	testsuite.src/run_initialize.at \
53	testsuite.src/run_misc.at \
54	testsuite.src/run_ml.at \
55	testsuite.src/run_refmod.at \
56	testsuite.src/run_reportwriter.at \
57	testsuite.src/run_returncode.at \
58	testsuite.src/run_subscripts.at \
59	testsuite.src/data_binary.at \
60	testsuite.src/data_display.at \
61	testsuite.src/data_packed.at \
62	testsuite.src/data_pointer.at \
63	testsuite.src/numeric-dump.cob \
64	testsuite.src/numeric-display.cob
65
66testsuite_manual_sources = \
67	testsuite.src/run_manual_screen.at
68
69EXTRA_DIST = $(srcdir)/package.m4 $(TESTSUITE) $(TESTSUITE_MANUAL) \
70	$(srcdir)/testsuite.at $(srcdir)/testsuite_manual.at \
71	$(srcdir)/listings-sed.sh \
72	$(testsuite_sources) $(testsuite_manual_sources)
73
74DISTCLEANFILES = atconfig
75
76# rule included in the check-target by automake
77check-local: prereq-testsuite
78	@GNUCOBOL_TEST_LOCAL=""  $(TESTSUITE) $(TESTSUITEFLAGS) || (rm -f testsuite.dir/at-job-fifo; exit 1)
79	@rm -f testsuite.dir/at-job-fifo
80
81# rule included in the "standard" target "installcheck" to run tests from the final install location, intended for post-install verification
82installcheck-local:
83	@echo " WARNING: currently no support for installcheck"
84#	TODO: needs additional work to handle exec_prefix and friends (datadir, ...)
85#	@GNUCOBOL_TEST_LOCAL="i" $(TESTSUITE) $(TESTSUITEFLAGS) || (rm -f testsuite.dir/at-job-fifo; exit 1)
86#	@rm -f testsuite.dir/at-job-fifo
87
88# special target to check with whatever is in PATH (uses, if exported COBC, COBCRUN, COBCRUN_DIRECT)
89localcheck: prereq-testsuite
90	@GNUCOBOL_TEST_LOCAL="1" $(TESTSUITE) $(TESTSUITEFLAGS) || (rm -f testsuite.dir/at-job-fifo; exit 1)
91	@rm -f testsuite.dir/at-job-fifo
92
93prereq-check:
94	@echo testing for working diff && diff - "$(TESTSUITE)" < "$(TESTSUITE)" \
95		|| (echo "Error: no working 'diff' in PATH" && false)
96
97prereq-testsuite: $(TESTSUITE) prereq-check
98	@rm -rf testsuite.dir
99
100prereq-manual: $(TESTSUITE_MANUAL) prereq-check
101	@rm -rf testsuite_manual.dir
102
103clean-local:
104	rm -rf *.dir *.log *.out valgrind
105
106checkmanual: prereq-manual
107	@$(TESTSUITE_MANUAL) $(TESTSUITEFLAGS) || (rm -f testsuite_manual.dir/at-job-fifo; exit 1)
108	@rm -f testsuite_manual.dir/at-job-fifo
109
110# targets that are only logical targets instead of files
111.PHONY: test checkall checkmanual localcheck \
112	prereq-check prereq-testsuite prereq-manual
113
114test:
115	@echo testing for perl && perl -v 1>/dev/null \
116		|| (echo "Error: no working 'perl' in PATH" && false)
117	@cd cobol85 && $(MAKE) $(AM_MAKEFLAGS) test
118
119checkall: check test
120
121$(srcdir)/package.m4: $(top_srcdir)/configure.ac
122	@echo "creating $(srcdir)/package.m4"
123	@{								   \
124	  echo '# Signature of the current package.';			   \
125	  echo 'm4_define([AT_PACKAGE_NAME],	  [@PACKAGE_NAME@])';	   \
126	  echo 'm4_define([AT_PACKAGE_TARNAME],	  [@PACKAGE_TARNAME@])';   \
127	  echo 'm4_define([AT_PACKAGE_VERSION],	  [@PACKAGE_VERSION@])';   \
128	  echo 'm4_define([AT_PACKAGE_STRING],	  [@PACKAGE_STRING@])';    \
129	  echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
130	  echo 'm4_define([AT_PACKAGE_URL],       [@PACKAGE_URL@])'; \
131	} > $(srcdir)/package.m4
132
133$(TESTSUITE): $(testsuite_sources) $(srcdir)/package.m4 $(srcdir)/testsuite.at
134	autom4te --language=autotest -I $(srcdir) -I $(srcdir)/testsuite.src -o $(srcdir)/testsuite $(srcdir)/testsuite.at
135	chmod +x $(srcdir)/testsuite
136
137$(TESTSUITE_MANUAL): $(testsuite_manual_sources) $(srcdir)/package.m4 $(srcdir)/testsuite_manual.at
138	autom4te --language=autotest -I $(srcdir) -I $(srcdir)/testsuite.src -o $(srcdir)/testsuite_manual $(srcdir)/testsuite_manual.at
139	chmod +x $(srcdir)/testsuite_manual
140