#-----------------------------------------------------------------------------# THIS_DIR = hard_coded #-----------------------------------------------------------------------------# ORDINARY_PROGS= \ abstract_eqv \ address_of_builtins \ agg \ any_free_unify \ backquoted_qualified_ops \ bidirectional \ boyer \ brace \ builtin_inst_rename \ cc_and_non_cc_test \ cc_multi_bug \ cc_nondet_disj \ checked_nondet_tailcall \ closure_extension \ common_type_cast \ compare_spec \ comparison \ constant_prop_1 \ constraint \ constraint_order \ construct_bug \ construct_test \ construct_test_exist \ contains_char \ contravariance_bug \ contravariance_poly \ curry \ curry2 \ cut_test \ c_write_string \ cycles \ cycles2 \ deconstruct_arg \ deep_copy \ deep_copy_bug \ deep_copy_exist \ deforest_cc_bug \ dense_lookup_switch \ dense_lookup_switch2 \ dense_lookup_switch3 \ dense_lookup_switch_non \ det_in_semidet_cntxt \ disjs_in_switch \ division_test \ dos \ dot_separator \ dst_test \ dummy_type_construct \ dupcall_impurity \ dupcall_types_bug \ elim_special_pred \ equality_pred_which_requires_boxing \ eqv_type_bug \ erroneous_liveness \ error_func \ existential_bound_tvar \ existential_float \ existential_reordering \ existential_reordering_class \ existential_types_test \ existential_type_switch_opt \ expand \ export_test \ external_unification_pred \ failure_unify \ field_syntax \ finalise_decl \ float_field \ float_map \ float_reg \ float_rounding_bug \ foreign_and_mercury \ foreign_import_module \ foreign_name_mutable \ foreign_type \ foreign_type2 \ foreign_type3 \ frameopt_pragma_redirect \ free_free_mode \ func_and_pred \ func_ctor_ambig \ func_test \ getopt_test \ ground_dd \ hash_bug \ hash_init_bug \ higher_order_func_test \ higher_order_syntax \ higher_order_syntax2 \ higher_order_type_manip \ ho_func_default_inst \ ho_func_reg \ ho_order \ ho_order2 \ ho_solns \ ho_univ_to_type \ impossible_unify \ impure_foreign \ impure_foreign2 \ impure_foreign3 \ impure_init_and_final \ impure_prune \ initialise_decl \ integer_test \ intermod_c_code \ intermod_foreign_type \ intermod_multimode_main \ intermod_poly_mode \ intermod_pragma_clause \ intermod_type_qual \ intermod_unused_args \ int_fold_up_down \ join_list \ list_series_int \ loop_inv_test \ loop_inv_test1 \ mapped_module \ merge_and_remove_dups \ minint_bug \ mode_check_clauses \ mode_choice \ multi_map_test \ multimode \ myset_test \ name_mangling \ no_fully_strict \ no_inline \ no_inline_builtins \ nonascii \ nondet_copy_out \ nondet_ctrl_vn \ no_warn_singleton \ nullary_ho_func \ null_char \ one_member \ ppc_bug \ pprint_test \ pprint_test2 \ pragma_c_code \ pragma_export \ pragma_import \ pragma_inline \ pretty_printing \ prince_frameopt \ promise_equivalent_clauses \ promise_equivalent_solutions_test \ promise_equiv_with_svars \ pure_mutable \ qual_adv_test \ qual_basic_test \ qual_is_test \ quantifier \ quantifier2 \ quoting_bug_test \ random_permutation \ random_simple \ rational_test \ recursive_main \ redoip_clobber \ relation_test \ remove_file \ reorder_di \ rev_arith \ reverse_arith \ rtc_bug \ rtree_test \ rtti_strings \ setjmp_test \ shift_test \ solve_quadratic \ solver_build_call \ solver_construction_init_test \ solver_disj_inits \ solver_ite_inits \ space \ stable_sort \ string_alignment \ string_alignment_bug \ string_loop \ string_string \ string_strip \ string_suffix_bug \ switch_detect \ system_sort \ target_mlobjs \ term_io_test \ term_to_univ_test \ test_bitset \ test_cord \ test_imported_no_tag \ test_promise_impure_implicit \ time_test \ tim_qual1 \ transform_value \ trans_intermod_user_equality \ transitive_inst_type \ trigraphs \ tuple_test \ tuple_test \ type_ctor_desc \ type_ctor_desc_manip \ type_info_order \ type_qual \ type_spec_ho_term \ type_spec_modes \ type_to_term_bug \ unify_existq_cons \ unify_expression \ unify_typeinfo_bug \ uniq_duplicate_call \ unused_float_box_test \ unusual_name_mutable \ user_compare \ user_defined_equality2 \ version_array_test \ write \ write_reg1 \ write_reg2 \ write_xml \ xmlable_test # JAVA_PASS_PROGS lists those tests which will succeed in grade Java. JAVA_PASS_PROGS= \ address_of_builtins \ brace \ c_write_string \ compare_spec \ constant_prop_2 \ contains_char \ constraint \ curry \ cut_test \ deforest_cc_bug \ division_test \ dot_separator \ dst_test \ existential_type_switch_opt \ failure_unify \ foreign_and_mercury \ foreign_type \ free_free_mode \ func_and_pred \ func_test \ higher_order_func_test \ higher_order_syntax \ ho_func_reg \ join_list \ mapped_module \ no_inline_builtins \ no_warn_singleton \ nondet_ctrl_vn \ nondet_copy_out \ pragma_inline \ qual_basic_test \ recursive_main \ reorder_di \ rev_arith \ reverse_arith \ solve_quadratic \ string_alignment \ string_loop \ string_suffix_bug \ system_sort \ target_mlobjs \ time_test # Some tests only link in trailing grades. ifeq "$(filter tr%,$(GRADE))" "" TRAILED_PROGS = else TRAILED_PROGS = \ mutable_decl endif # Tests of the C#, MC++, and IL foreign language interfaces only # work in IL grades ifeq "$(filter il%,$(GRADE))" "" DOTNET_PROGS = else DOTNET_PROGS = \ csharp_test endif # Tests of the Java foreign language interface only # work in Java grades ifeq "$(filter java%,$(GRADE))" "" JAVA_PROGS = else JAVA_PROGS = \ java_test endif # Fact tables currently work only in the C grades. # The foreign_type_assertion test is currently meaningful only in C grades. # Mutables work properly only in C grades. ifeq "$(filter il% java%,$(GRADE))" "" C_ONLY_PROGS= \ factt \ factt_sort_test \ float_gv \ foreign_type_assertion else C_ONLY_PROGS= endif # constant_prop_2 fails in hl*prof* grades, due to a complicated phase # ordering problem. The first simplify pass eliminates a call to # private_builtin.typed_unify, but does not yet simplify the if-then-else # which contains it; then at the end of that pass determinism analysis # is rerun, and the condition is inferred to be det. Then dead proc # elimination is run, and it does not eliminate link_error, since there # is still a call to it. The second simplify pass notices that the # condition is det, and simplifies the if-then-else, deleting the else part, # so link_error is now dead. But dead proc elimination doesn't get run # again, so we go ahead and emit a declaration for link_error, and in # MLDS profiling grades also a reference, which causes the test case to fail. # constant_prop_2 relies on deleting all references to an external predicate, # but the appearance of the call in the caller puts a reference to its proc # layout structure into the call sites array of its caller, even if the call # is never made. We could fix this by skipping over call sites in unreachable # code, but doing so would require duplicating, in deep_profiling.m, the code # used by simplify.m to eliminate the unreachable code. Since the only profit # would be to pass unrealistic test cases like constant_prop_2, this is not # worth doing. ifeq "$(findstring hl,$(GRADE))$(findstring prof,$(GRADE))" "hlprof" PROF_PROGS = else ifeq "$(findstring profdeep,$(GRADE))" "" PROF_PROGS = \ constant_prop_2 else PROF_PROGS = endif endif # These tests trigger a bug in lcc ifeq "$(findstring lcc,$(shell $(MGNUC) -v 2>&1))" "lcc" BROKEN_FOR_LCC_PROGS = else BROKEN_FOR_LCC_PROGS = \ bigtest \ rnd endif # These tests require the implementation to support closure layouts CLOSURE_LAYOUT_PROGS = \ copy_pred \ copy_pred_2 # This test requires the implementation's representation of characters # to be the same as their representation in files, which is not true # for the IL and Java back-ends, which use Unicode internally. ifeq "$(filter il% java%,$(GRADE))" "" CHAR_REP_PROGS = special_char else CHAR_REP_PROGS = endif # We do not pass the following tests at all: # # XXX export_test2 # Fails in hl* grades. I think this never passed. # # XXX float_consistency: # floats in Mercury aren't consistent -- see the comments at the # top of library/float.m. # # XXX loop_inv_test0, loop_inv_test2: # These test cases test some more sophisticated cases of loop invariant # optimization which our current loop_inv pass is not capable of # optimizing. # # XXX var_not_found -- mode error in automatically generated unification # predicate. This test uses partially instantiated modes, # which are not yet fully supported. # # XXX needs_init doesn't work yet in profiling grades. # # XXX compare_rep_array doesn't work because MR_COMPARE_BY_RTTI is # not yet implemented for arrays. # # XXX puzzle_detism_bug exposes a bug in mode analysis # # XXX we fail some of the commented-out tests in write_binary # The following tests are passed only in some grades. # The following tests do not work in the the .profdeep grades. # All of them, aside from backend_external, don't work because # deep profiling cannot yet handle exceptions being caught and # these test cases do that. # # backend_external fails because the predicates whose implementation # is handwritten in C do not have the necessary proc_statics etc, # defined. ifeq "$(findstring profdeep,$(GRADE))" "" NON_PROFDEEP_PROGS = \ allow_stubs \ backend_external \ dir_test \ test_array2d \ test_injection \ user_defined_equality \ write_binary else NON_PROFDEEP_PROGS = endif # compare_representation does not work in the MLDS grades (e.g. hlc.gc), # because comparison of closures gives "Sorry, not implemented" when # MR_HIGHLEVEL_CODE is set. Likewise for closure_arg_comparison. # # factt_non does not work in the MLDS grades because the code for nondet # fact tables assumes that we're using the LLDS back-end. Also, fact tables # and deep profiling do not (yet) mix. # # type_tables does not work in the MLDS grades because the test itself # is a quick hack that assumes the use of the LLDS backend; it should # be replaced by a test that exercises functionality enabled by type tables. # However, this must wait for the implementation of that functionality. ifeq "$(filter hl% il% java%,$(GRADE))" "" ifeq "$(findstring profdeep,$(GRADE))" "" BACKEND_PROGS_2 = \ factt_non else BACKEND_PROGS_2 = endif BACKEND_PROGS = \ $(BACKEND_PROGS_2) \ closure_arg_comparison \ compare_representation \ compare_rep_usereq \ stable_foreign \ type_tables else BACKEND_PROGS = endif # The MLDS back-end doesn't support nondet C in trailing grades, # or in no-GC grades (except with --no-reclaim-heap-on-failure). # We also don't support nondet C in deep profiling grades. # These tests are also not supported in IL and Java grades, # since those back-ends don't support the C interface at all. # (XXX perhaps we should add analogous tests of the nondet IL, C#, MC++, # and [eventually] Java interfaces?) ifneq "$(filter il% java%,$(GRADE))" "" NONDET_C_PROGS = else ifeq "$(findstring hl,$(GRADE))$(findstring .tr,$(GRADE))" "hl.tr" NONDET_C_PROGS = else ifeq "$(findstring hl,$(GRADE))$(findstring .gc,$(GRADE))" "hl" NONDET_C_PROGS = else ifneq "$(findstring profdeep,$(GRADE))" "" NONDET_C_PROGS = else NONDET_C_PROGS = \ inline_nondet_pragma_c \ nondet_c \ nondet_pragma_c_bug endif endif endif endif # string_hash tests features of the Mercury C runtime. # It requires too much memory to be used in non-GC grades. ifeq "$(filter il% java%,$(GRADE))$(findstring gc,$(GRADE))" "gc" C_AND_GC_ONLY_PROGS=string_hash else C_AND_GC_ONLY_PROGS= endif # Static linking doesn't work on Solaris in debug grades # ('-ldl' doesn't work with static linking). # # Static linking (against the system libraries) doesn't # work on MacOS X because the static versions of the # libraries are not installed by default. # STATIC_LINK_PROGS = ifneq "$(findstring apple-darwin,$(FULLARCH))" "apple-darwin" ifneq "$(findstring solaris,$(FULLARCH))" "solaris" # The `parse' test also links with the debug libraries, # so it only works in LLDS grades. ifeq "$(filter hl% java% il%,$(GRADE))" "" STATIC_LINK_PROGS = parse endif endif endif # We currently test only a limited selection in grade java on this directory. ifneq "$(findstring java,$(GRADE))" "" PROGS = $(JAVA_PROGS) $(JAVA_PASS_PROGS) else PROGS = $(ORDINARY_PROGS) $(PROF_PROGS) $(BROKEN_FOR_LCC_PROGS) \ $(CLOSURE_LAYOUT_PROGS) $(NON_PROFDEEP_PROGS) \ $(BACKEND_PROGS) $(NONDET_C_PROGS) \ $(C_AND_GC_ONLY_PROGS) $(STATIC_LINK_PROGS) \ $(CHAR_REP_PROGS) $(C_ONLY_PROGS) \ $(DOTNET_PROGS) $(JAVA_PROGS) $(TRAILED_PROGS) endif #-----------------------------------------------------------------------------# TESTS = $(PROGS) SUBDIRS = typeclasses sub-modules exceptions purity TESTS_DIR=.. include $(TESTS_DIR)/Mmake.common # Module-specific options should go in Mercury.options so they # can be found by `mmc --make'. include Mercury.options %.runtest: %.res ; mapped_module.depend: Mercury.modules #-----------------------------------------------------------------------------# # For term_io_test, we want to run it once using the supplied input file. # But we want to check that the output parses the same as the input did, # so we also run it with the .exp file as the input. term_io_test.fix_out: term_io_test term_io_test.exp ./term_io_test < term_io_test.exp > $@ 2>&1 || \ { grep . $@ /dev/null; exit 1; } term_io_test.res: term_io_test.out term_io_test.fix_out @echo "Comparing term_io_test.{,fix_}out with term_io_test.exp," @echo " results in $@" @-rm -f $@ term_io_test.res @{ diff $(DIFF_OPTS) term_io_test.exp term_io_test.out > $@ && \ echo "term_io_test.out matched term_io_test.exp"; } && \ { diff $(DIFF_OPTS) term_io_test.exp term_io_test.fix_out >> $@ && \ echo "term_io_test.fix_out matched term_io_test.exp"; } || \ { echo "** term_io_test.{,fix_}out did not match the expected output"; \ cat $@; \ exit 1; } nonascii.out: nonascii.data nonascii.data: nonascii_gen ./nonascii_gen > nonascii.data nonascii_gen: nonascii_gen.c $(CC) nonascii_gen.c -o nonascii_gen # no_fully_strict is expected to fail (it calls error/1). # We also need to pipe the output through sed to avoid hard-coding # dependencies on particular line numbers in the standard library source code. no_fully_strict.out: no_fully_strict if ./no_fully_strict > $@.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 # For the constant_prop_1 test case, we test that constant propagation # has been achieved by grepping the generated target code for particular # patterns that will only arise if the Mercury compiler did the intended # constant propagation. constant_prop_1.c: constant_prop_1.c_date grep foobar $@ grep 1234 $@ grep '5678\.0' $@ constant_prop_1.s: constant_prop_1.s_date grep foobar $@ grep 1234 $@ grep '5678\.0' $@ constant_prop_1.pic_s: constant_prop_1.pic_s_date grep foobar $@ grep 1234 $@ grep '5678\.0' $@ constant_prop_1.java: constant_prop_1.java_date grep foobar $@ grep 1234 $@ grep '5678\.0' $@ constant_prop_1.il: constant_prop_1.il_date grep foobar $@ grep 1234 $@ grep '5678\.0' $@ # Force intermod_unused_args2.m to be compiled and analysed before # intermod_unused_args.m. intermod_unused_args.c: intermod_unused_args2.c #-----------------------------------------------------------------------------# dir_test.out: prepare_for_dir_test prepare_for_dir_test: rm -rf test_dir unwritable touch unwritable chmod -w unwritable dir_test.clean: clean_dir_test .PHONY: clean_dir_test clean_dir_test: rm -rf test_dir unwritable #-----------------------------------------------------------------------------# # dst_test checks various predicates associated with Daylight Savings. # Since all the test data is based on Melbourne's DST conventions, the # timezone environment variable TZ must be set accordingly. ifneq "$(findstring java,$(GRADE))" "" dst_test.out: dst_test.class TZ="Australia/Melbourne" $(JAVA) dst_test > $@ 2>&1 || \ { grep . $@ /dev/null; exit 1; } else dst_test.out: dst_test TZ="Australia/Melbourne" ./$< > $@ 2>&1 || \ { grep . $@ /dev/null; exit 1; } endif #-----------------------------------------------------------------------------# clean_local: rm -f target_mlobjs_c.o realclean_local: rm -f Mercury.modules #-----------------------------------------------------------------------------# .PHONY: Mercury.modules Mercury.modules: $(MC) -f $(ALL_MCFLAGS) source_file_map.m #-----------------------------------------------------------------------------#