Files
mercury/tests/valid/Mmake.valid.common
Zoltan Somogyi 769412bec5 Attempt to fix a test failure in C# grades ...
... and make the set of test cases in the valid/valid_seq test directories
easier to handle.

tests/valid_seq/call_impure_in_opt_helper_1.m:
    Add a C# definition for a predicate that is defined entirely
    by foreign_procs.

tests/valid/Mmake.valid.common:
    Note the reason why many of the test cases using this file fail
    when executed in C# grades.

    Add a target that I used to debug that problem.

    Put the descriptions of a set of make variables in lexicographic order,
    except for OTHER_PROGS, which has to stay at thee end as it means
    "none of the above". Without this reordering, it was not clear that
    the cause of the failures was NOT a mistake in the spelling of
    one of these variable names.

tests/valid/Mmakefile:
tests/valid_seq/Mmakefile:
    Put the definitions of those make variables in the same order.

tests/Mmake.common:
    Improve programming style.
2023-10-02 19:01:03 +11:00

213 lines
6.1 KiB
Makefile

#-----------------------------------------------------------------------------#
# vim: ts=8 sw=8 noexpandtab ft=make
#-----------------------------------------------------------------------------#
#
# This file is included in the Mmakefile of both ../valid and ../valid_seq.
# Both those directories contain test cases for which we check only that
# compilation succeeds, and don't test what its result is. The difference
# is that in the valid directory, each test file is self-contained and
# may be compiled in parallel, while the test cases valid_seq each consist of
# more than one module (some separate, some nested), and thus must be compiled
# sequentially, without parallelism.
#
# The Mmakefiles in both directories should define the following make variables
# beyond those required by ../Mmake.common.
#
# AGC_PROGS:
# The test cases testing the accurate gc system.
#
# C_INTERFACE_PROGS:
# The test cases that test the operation of the foreign language interface
# with C.
#
# C_PROGS:
# The test cases for which we should only produce a `.c' file.
#
# CONSTRAINT_TYPECHECK_PROGS:
# Tests that use constraint based type checking.
# XXX These are never enabled.
#
# CTGC_PROGS:
# The test cases that only work in grades that support compile-time
# garbage collection. Debugging is incompatible with ctgc.
#
# DEEP_PROF_CAPABLE_PROGS:
# The test cases that test compilation with deep profiling enabled.
#
# LLDS_PROGS:
# The test cases that require debugging, which hasn't been implemented
# for the MLDS backend.
#
# NON_DECLDEBUG_PROGS:
# Test that do not work in .decldebug grades
#
# PAR_CONJ_PROGS:
# The test cases that only work in grades that support parallel conjunction.
#
# SOLVER_PROGS:
# The test cases that test the handling of solver type variables.
#
# TABLE_PROGS:
# The test cases that only work in grades that support tabling.
#
# TRAIL_PROGS:
# The test cases that only work in trailing grades.
#
# TYPECLASS_PROGS:
# The test cases testing the handling of typeclasses.
#
# OTHER_PROGS:
# All the other test cases.
# The agc.* tests don't work in --high-level-code grades,
# except hl*.agc*, because they require grade-specific header
# files to be installed.
ifeq "$(findstring hl,$(GRADE))$(findstring .agc,$(GRADE))" "hl"
PROGS1 = $(TYPECLASS_PROGS) $(OTHER_PROGS)
else
# The agc.* tests don't work in the java or csharp grades.
# The agc.* tests also don't work in minimal model grades,
# because the collector doesn't scan the copied areas of the stacks.
ifneq "$(filter java% csharp%,$(GRADE))$(findstring mm,$(GRADE))" ""
PROGS1 = $(TYPECLASS_PROGS) $(OTHER_PROGS)
else
PROGS1 = $(AGC_PROGS) $(TYPECLASS_PROGS) $(OTHER_PROGS)
endif
endif
ifneq "$(findstring mm,$(GRADE))" ""
PROGS2 = $(PROGS1)
else
ifeq "$(filter java% csharp%,$(GRADE))" ""
PROGS2 = $(PROGS1) $(TRAIL_PROGS)
else
PROGS2 = $(PROGS1)
endif
endif
ifneq "$(filter java% csharp%,$(GRADE))$(findstring profdeep,$(GRADE))" ""
PROGS3 = $(PROGS2)
else
PROGS3 = $(PROGS2) $(TABLE_PROGS)
endif
ifeq "$(filter hl% java% csharp%,$(GRADE))" ""
PROGS4 = $(PROGS3) $(C_INTERFACE_PROGS) $(SOLVER_PROGS) \
$(DEEP_PROF_CAPABLE_PROGS)
else
PROGS4 = $(PROGS3)
endif
ifeq "$(filter hl% java% csharp%,$(GRADE))$(findstring par,$(GRADE))" ""
PROGS5 = $(PROGS4) $(LLDS_PROGS)
else
PROGS5 = $(PROGS4)
endif
ifneq "$(findstring decldebug,$(GRADE))" ""
PROGS6 = $(PROGS5)
else
PROGS6 = $(PROGS5) $(PAR_CONJ_PROGS)
endif
ifeq "$(findstring debug,$(GRADE))" ""
PROGS7 = $(PROGS6) $(CTGC_PROGS)
else
PROGS7 = $(PROGS6)
endif
ifeq "$(filter hl% java% csharp%,$(GRADE))$(findstring par,$(GRADE))$(findstring decldebug,$(GRADE))" ""
PROGS8 = $(PROGS7) $(NON_DECLDEBUG_PROGS)
else
PROGS8 = $(PROGS7)
endif
OBJ_PROGS = $(PROGS8)
ifneq "$(findstring tsw,$(GRADE))$(findstring tsc,$(GRADE))" ""
PROGS = $(OBJ_PROGS) $(C_PROGS)
else
PROGS = $(OBJ_PROGS) $(C_PROGS)
endif
# `mmc --make' doesn't expect subdirectories to appear in targets.
ifeq ($(MMAKE_USE_MMC_MAKE),yes)
OS_SUBDIR =
DLLS_SUBDIR =
CLASSES_SUBDIR =
else
OS_SUBDIR = $(os_subdir)
DLLS_SUBDIR = $(dlls_subdir)
CLASSES_SUBDIR = $(classes_subdir)
endif
ifeq ($(findstring csharp,$(GRADE)),csharp)
# XXX Setting TARGET_OBJ_EXT to "cs" DOES NOT WORK.
# This is because the default interpretation of make targets
# of the form <modulename.cs> is not "build the .cs target file
# for the named module", but "build all the .c target files
# for the named module".
TARGET_OBJ_EXT = cs
TARGET_OBJ_SUBDIR = $(DLLS_SUBDIR)
else
ifeq ($(findstring java,$(GRADE)),java)
TARGET_OBJ_EXT = class
TARGET_OBJ_SUBDIR = $(CLASSES_SUBDIR)
else
TARGET_OBJ_EXT = $(O)
TARGET_OBJ_SUBDIR = $(OS_SUBDIR)
endif
endif
OBJS = $(OBJ_PROGS:%=$(TARGET_OBJ_SUBDIR)%.$(TARGET_OBJ_EXT))
#-----------------------------------------------------------------------------#
# When compiling using the installed libraries, setting GRADEFLAGS
# may cause mgnuc to look for the `.mih' files for a non-installed grade.
# test_mercury runs the tests using the installed libraries, so GRADEFLAGS
# won't be set, but test_mercury runs the tests in at least one `.tr' grade
# on all machines, so it isn't a problem.
ifneq ($(origin WORKSPACE),undefined)
GRADEFLAGS_TRAIL = --use-trail
else
GRADEFLAGS_TRAIL =
endif
# Make sure GRADEFLAGS_TRAIL is passed to `mmc --make'.
export GRADEFLAGS_TRAIL
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
# $(OBJ_PROGS:%=%.runtest): %.runtest: %.$(TARGET_OBJ_EXT) ;
$(OBJ_PROGS:%=%.runtest): %.runtest: %.$(TARGET_OBJ_EXT) ;
$(C_PROGS:%=%.runtest): %.runtest: %.c ;
#-----------------------------------------------------------------------------#
print_test_params:
@echo TARGET_OBJ_EXT is set to =$(TARGET_OBJ_EXT)=
@echo TARGET_OBJ_SUBDIR is set to =$(TARGET_OBJ_SUBDIR)=
@echo OBJ_PROGS is set to =$(OBJ_PROGS)=
@echo C_PROGS is set to =$(C_PROGS)=
objs: $(OBJS)
printtests:
@echo $(PROGS)
printobjs:
@echo $(OBJS)
clean_local: clean_valid
clean_valid:
rm -f *.err *.h
#-----------------------------------------------------------------------------#