Files
mercury/tests/invalid_purity/Mmakefile
Zoltan Somogyi 1f45f91886 Make "mmake runtests" work again.
My commit afe2887882 broke 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 after afe2887 runs 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 = .."
2020-06-10 01:05:15 +10:00

64 lines
1.6 KiB
Makefile

#-----------------------------------------------------------------------------#
# vim: ts=8 sw=8 noexpandtab ft=make
#-----------------------------------------------------------------------------#
TESTS_DIR = ..
THIS_DIR = invalid_purity
MAYBE_J1 =
PROGS = \
impure_func_t2 \
impure_func_t3 \
impure_func_t4 \
impure_func_t5 \
impure_func_t5_fixed \
impure_func_t7 \
impure_par_conj \
impure_pred_t1 \
impure_pred_t1_fixed \
impure_pred_t2 \
pragma_c_and_mercury \
purity \
purity_nonsense \
purity_nonsense2-nodepend \
purity_type_error
TESTS = $(PROGS)
include ../Mmake.common
# These tests all get spurious failures with intermodule optimization,
# because the errors get detected when creating the `.opt' file rather
# than when compiling the main module. So we disable intermodule optimization
# for these tests.
override EXTRA_MCFLAGS += \
--no-intermodule-optimization
# Module-specific options should go in Mercury.options so they can be found
# by `mmc --make'.
include Mercury.options
%.runtest: %.err_res ;
.PRECIOUS: %.err_res
#-----------------------------------------------------------------------------#
# See ../Mmakefile explanation of this.
ifneq ($(MMAKE_USE_MMC_MAKE),yes)
%.err: %.m
if $(MC) $(ALL_GRADEFLAGS) $(ALL_MCFLAGS) --errorcheck-only $* \
> $*.err 2>&1; \
then false; else true; fi
else
$(addsuffix .err,$(PROGS)):
-$(MCM) $@
if $(MCM) -r $@ > /dev/null 2>&1 ; then false; else true; fi
endif
clean_local: clean_invalid_purity
clean_invalid_purity:
rm -f *.err *.err_res
#-----------------------------------------------------------------------------#