mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-21 12:23:44 +00:00
My commitafe2887882broke the ability to run the test suite outside of a bootcheck by executing "mmake runtests" in the tests directory. This diff fixes that. tests/Mmake.common: Don't define "TESTS_DIR = ..". While every single tests/*/Mmakefile defined it as such, I overlooked the fact that tests/Mmakefile itself defined it ".", referring to the same directory from a different starting point. Document this easily-overlooked fact. Rename the old runtests target, which afterafe2887runs the tests in a single directory, as runtests_dir, to leave the target name "runtests" itself free for tests/Mmakefile to use. tests/Mmakefile: Define "TESTS_DIR = .", and add a target "runtests" which invokes "mmake runtests_dir" in each test directory. tools/bootcheck: Invoke "mmake runtests_dir" instead of "mmake runtests" in each test directory. Initialize a variable just before it is used. tests/*/Mmakefile: Add back the definition "TESTS_DIR = .."
323 lines
7.5 KiB
Makefile
323 lines
7.5 KiB
Makefile
#-----------------------------------------------------------------------------#
|
|
# vim: ts=8 sw=8 noexpandtab ft=make
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
TESTS_DIR = ..
|
|
THIS_DIR = tabling
|
|
MAYBE_J1 =
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
SIMPLE_NONLOOP_PROGS = \
|
|
boyer \
|
|
expand \
|
|
expand_bitmap \
|
|
expand_float \
|
|
expand_poly \
|
|
expand_tuple \
|
|
expand_tuple2 \
|
|
fast_loose \
|
|
fib \
|
|
fib_float \
|
|
fib_int16 \
|
|
fib_int32 \
|
|
fib_int64 \
|
|
fib_int8 \
|
|
fib_list \
|
|
fib_stats \
|
|
fib_string \
|
|
fib_uint \
|
|
fib_uint16 \
|
|
fib_uint32 \
|
|
fib_uint64 \
|
|
fib_uint8 \
|
|
loopcheck_no_loop \
|
|
loopcheck_nondet_no_loop \
|
|
mercury_java_parser_dead_proc_elim_bug \
|
|
mercury_java_parser_dead_proc_elim_bug2 \
|
|
oota \
|
|
pack_args_memo \
|
|
reset_stats_intermod \
|
|
specified_hidden_arg \
|
|
table_foreign_enum \
|
|
table_foreign_output \
|
|
test_enum \
|
|
test_packed \
|
|
unused_args
|
|
|
|
# Tabling of nondet predicates and deep profiling are (currently)
|
|
# incompatible.
|
|
ifeq "$(findstring profdeep,$(GRADE))" ""
|
|
BROKEN_FOR_PROFDEEP_NONLOOP_PROGS = \
|
|
memo_non
|
|
else
|
|
BROKEN_FOR_PROFDEEP_NONLOOP_PROGS =
|
|
endif
|
|
|
|
NONLOOP_SPECIFIED_PROGS0 = \
|
|
specified \
|
|
specified_stats
|
|
|
|
# The above test uses the '--allow-table-reset' option which is not
|
|
# implemented for the MLDS backend.
|
|
#
|
|
ifeq "$(findstring hl,$(GRADE))" ""
|
|
NONLOOP_SPECIFIED_PROGS1 = $(NONLOOP_SPECIFIED_PROGS0)
|
|
else
|
|
NONLOOP_SPECIFIED_PROGS1 =
|
|
endif
|
|
|
|
# The overhead caused by profiling causes this test to fail in some of the
|
|
# profiling grades, so we disable it in all of them.
|
|
#
|
|
ifeq "$(findstring prof,$(GRADE))" ""
|
|
NONLOOP_SPECIFIED_PROGS2 = $(NONLOOP_SPECIFIED_PROGS1)
|
|
else
|
|
NONLOOP_SPECIFIED_PROGS2 =
|
|
endif
|
|
|
|
# We also don't enable it in term-size profiling grades.
|
|
#
|
|
ifeq "$(findstring tsc,$(GRADE))" ""
|
|
NONLOOP_SPECIFIED_PROGS3 = $(NONLOOP_SPECIFIED_PROGS2)
|
|
else
|
|
NONLOOP_SPECIFIED_PROGS3 =
|
|
endif
|
|
|
|
ifeq "$(findstring tsw,$(GRADE))" ""
|
|
NONLOOP_SPECIFIED_PROGS = $(NONLOOP_SPECIFIED_PROGS3)
|
|
else
|
|
NONLOOP_SPECIFIED_PROGS =
|
|
endif
|
|
|
|
SIMPLE_LOOP_PROGS = \
|
|
loopcheck \
|
|
loopcheck_nondet \
|
|
tc_loop \
|
|
tc_memo \
|
|
tc_memo2
|
|
|
|
MAYBE_MINIMAL_NONLOOP_PROGS = \
|
|
combine \
|
|
completed_consumer_in_solutions \
|
|
consumer_in_commit \
|
|
consumer_in_solutions \
|
|
coup \
|
|
coup2 \
|
|
coup3 \
|
|
coup4 \
|
|
coup_det_frame \
|
|
coup_no_commit \
|
|
coup_non_tabled_frame \
|
|
generator_in_commit \
|
|
mday \
|
|
repeat \
|
|
rotate \
|
|
rotate2 \
|
|
seq \
|
|
seq2 \
|
|
seq3 \
|
|
seq4 \
|
|
sg \
|
|
tc_minimal \
|
|
tc_minimal2
|
|
|
|
# Minimal model tests don't yet work in own stack (mmos) grades.
|
|
# Since in most cases the symptom of failure is an infinite loop,
|
|
# we don't want to execute these tests in such grades.
|
|
ifneq "$(findstring mmos,$(GRADE))" ""
|
|
MINIMAL_NONLOOP_PROGS =
|
|
else
|
|
MINIMAL_NONLOOP_PROGS = $(MAYBE_MINIMAL_NONLOOP_PROGS)
|
|
endif
|
|
|
|
MINIMAL_LOOP_PROGS =
|
|
|
|
# The following programs do not work:
|
|
# semidet_minimal.m
|
|
# tc_minimal_semidet.m
|
|
|
|
ALL_SIMPLE_PROGS = \
|
|
$(SIMPLE_NONLOOP_PROGS) \
|
|
$(BROKEN_FOR_PROFDEEP_NONLOOP_PROGS) \
|
|
$(NONLOOP_SPECIFIED_PROGS) \
|
|
$(SIMPLE_LOOP_PROGS)
|
|
|
|
ALL_MINIMAL_PROGS = $(MINIMAL_NONLOOP_PROGS)
|
|
|
|
ifneq "$(findstring .gc,$(GRADE))" ""
|
|
# The substitution is there to avoid unwanted "mm" matches from "rbmm".
|
|
ifneq "$(findstring mm,$(subst rbmm,x,$(GRADE)))" ""
|
|
PROGS0 = $(ALL_SIMPLE_PROGS) $(ALL_MINIMAL_PROGS)
|
|
NONLOOP_PROGS = $(SIMPLE_NONLOOP_PROGS) \
|
|
$(MINIMAL_NONLOOP_PROGS)
|
|
else
|
|
PROGS0 = $(ALL_SIMPLE_PROGS)
|
|
NONLOOP_PROGS = $(SIMPLE_NONLOOP_PROGS)
|
|
endif
|
|
else
|
|
PROGS0 =
|
|
endif
|
|
|
|
# Tabling is buggy in the lowlevel .par grades so it's disabled for now.
|
|
# XXX What is the bug? If it is lack of synchronization on table updates,
|
|
# why are these tests enabled for hlc par grades?
|
|
ifeq "$(findstring .par,$(GRADE))" ""
|
|
PROGS1 = $(PROGS0)
|
|
else
|
|
ifeq "$(findstring hl,$(GRADE))" ""
|
|
PROGS1 =
|
|
else
|
|
PROGS1 = $(PROGS0)
|
|
endif
|
|
endif
|
|
|
|
# Disable these tests in MLDS grades (targeting C, C# and Java)
|
|
# with high level data representation, because tabling is not implemented
|
|
# for high level data representation.
|
|
ifneq "$(findstring java,$(GRADE))$(findstring csharp,$(GRADE))" ""
|
|
# This is either the C# grade or the Java grade.
|
|
PROGS =
|
|
else
|
|
ifneq "$(findstring hl,$(GRADE))" ""
|
|
# This is either a hl.* grade (high level data)
|
|
# or a hlc.* grade (low level data).
|
|
ifeq "$(findstring hlc,$(GRADE))" ""
|
|
# This is a hl.* grade.
|
|
PROGS =
|
|
else
|
|
# This is a hlc.* grade.
|
|
PROGS = $(PROGS1)
|
|
endif
|
|
else
|
|
# This is not a high level data grade, since those
|
|
# are all covered above.
|
|
PROGS = $(PROGS1)
|
|
endif
|
|
endif
|
|
|
|
TESTS = $(sort $(PROGS))
|
|
include ../Mmake.common
|
|
|
|
# Module-specific options should go in Mercury.options so they
|
|
# can be found by `mmc --make'.
|
|
include Mercury.options
|
|
|
|
%.runtest: %.res ;
|
|
|
|
#-----------------------------------------------------------------------------#
|
|
|
|
# Some test cases are expected to abort.
|
|
# We also need to pipe the output for these test cases through sed to avoid
|
|
# hard-coding dependencies on particular line numbers in the standard library
|
|
# source code.
|
|
|
|
tc_loop.out: tc_loop
|
|
if ./$< > $@.tmp 2>&1; then \
|
|
grep . $@.tmp; \
|
|
exit 1; \
|
|
else \
|
|
sed -e 's/exception.m:[0-9]*/exception.m:NNNN/g' \
|
|
-e 's/require.m:[0-9]*/require.m:NNNN/g' \
|
|
-e 's/std_util.m:[0-9]*/std_util.m:NNNN/g' \
|
|
< $@.tmp > $@; \
|
|
rm -f $@.tmp; \
|
|
fi
|
|
|
|
tc_memo.out: tc_memo
|
|
if ./$< > $@.tmp 2>&1; then \
|
|
grep . $@.tmp; \
|
|
exit 1; \
|
|
else \
|
|
sed -e 's/exception.m:[0-9]*/exception.m:NNNN/g' \
|
|
-e 's/require.m:[0-9]*/require.m:NNNN/g' \
|
|
-e 's/std_util.m:[0-9]*/std_util.m:NNNN/g' \
|
|
< $@.tmp > $@; \
|
|
rm -f $@.tmp; \
|
|
fi
|
|
|
|
tc_memo2.out: tc_memo2
|
|
if ./$< > $@.tmp 2>&1; then \
|
|
grep . $@.tmp; \
|
|
exit 1; \
|
|
else \
|
|
sed -e 's/exception.m:[0-9]*/exception.m:NNNN/g' \
|
|
-e 's/require.m:[0-9]*/require.m:NNNN/g' \
|
|
-e 's/std_util.m:[0-9]*/std_util.m:NNNN/g' \
|
|
< $@.tmp > $@; \
|
|
rm -f $@.tmp; \
|
|
fi
|
|
|
|
loopcheck.out: loopcheck
|
|
if test -s loopcheck.err; then \
|
|
cat loopcheck.err > loopcheck.out; \
|
|
exit 1; \
|
|
elif ./$< > $@.tmp 2>&1; then \
|
|
grep . $@.tmp; \
|
|
exit 1; \
|
|
else \
|
|
sed -e 's/exception.m:[0-9]*/exception.m:NNNN/g' \
|
|
-e 's/require.m:[0-9]*/require.m:NNNN/g' \
|
|
< $@.tmp > $@; \
|
|
rm -f $@.tmp; \
|
|
fi
|
|
|
|
loopcheck_nondet.out: loopcheck_nondet
|
|
if test -s loopcheck_nondet.err; then \
|
|
cat loopcheck_nondet.err > loopcheck_nondet.out; \
|
|
exit 1; \
|
|
elif ./$< > $@.tmp 2>&1; then \
|
|
grep . $@.tmp; \
|
|
exit 1; \
|
|
else \
|
|
sed -e 's/exception.m:[0-9]*/exception.m:NNNN/g' \
|
|
-e 's/require.m:[0-9]*/require.m:NNNN/g' \
|
|
< $@.tmp > $@; \
|
|
rm -f $@.tmp; \
|
|
fi
|
|
|
|
consumer_in_solutions.out: consumer_in_solutions
|
|
if ./$< > $@.tmp 2>&1; then \
|
|
grep . $@.tmp; \
|
|
exit 1; \
|
|
else \
|
|
mv $@.tmp $@ ; \
|
|
fi
|
|
|
|
specified_stats.out: specified_stats
|
|
if ./$< > $@.tmp 2>&1; then \
|
|
sed -e 's/(100.00\%)/(NNN\%)/' \
|
|
-e 's/ ([1-9][0-9]\.[0-9][0-9]\%)/(NNN\%)/' \
|
|
-e 's/ ([0-9]\.[0-9][0-9]\%)/(NNN\%)/' \
|
|
-e 's/[1-9],[0-9][0-9][0-9],[0-9][0-9][0-9]/ NNN/' \
|
|
-e 's/ [1-9][0-9][0-9],[0-9][0-9][0-9]/ NNN/' \
|
|
-e 's/ [1-9][0-9],[0-9][0-9][0-9]/ NNN/' \
|
|
-e 's/ [1-9],[0-9][0-9][0-9]/ NNN/' \
|
|
-e 's/ [1-9][0-9][0-9]/ NNN/' \
|
|
-e 's/ [1-9][0-9]/ NNN/' \
|
|
-e 's/ [0-9]/ NNN/' \
|
|
< $@.tmp > $@; \
|
|
rm -f $@.tmp; \
|
|
else \
|
|
grep . $@.tmp; \
|
|
exit 1; \
|
|
fi
|
|
|
|
.PHONY: echo_progs
|
|
echo_progs:
|
|
@echo $(PROGS)
|
|
|
|
.PHONY: echo_nonloop_progs
|
|
echo_nonloop_progs:
|
|
@echo $(NONLOOP_PROGS)
|
|
|
|
.PHONY: echo_minimal_nonloop_progs
|
|
echo_minimal_nonloop_progs:
|
|
@echo $(MINIMAL_NONLOOP_PROGS)
|
|
|
|
.PHONY: echo_simple_nonloop_progs
|
|
echo_simple_nonloop_progs:
|
|
@echo $(SIMPLE_NONLOOP_PROGS)
|
|
|
|
#-----------------------------------------------------------------------------#
|