Commit Graph

17 Commits

Author SHA1 Message Date
Julien Fischer
0cbbe0e9c1 Fix a typo.
tests/valid_seq/test_xmlreader.m:
    As above.
2020-11-15 21:24:15 +11:00
Zoltan Somogyi
21b0e35039 Update the style of the tests in valid_seq. 2020-11-15 08:02:47 +11:00
Peter Wang
88047bbb45 Delete Erlang from tests.
tests/general/float_test.exp3:
tests/general/float_test.m:
tests/general/read_dir_regression.exp4:
tests/general/read_dir_regression.m:
tests/hard_coded/remove_file.exp2:
tests/hard_coded/remove_file.m:
    Delete Erlang backend specific expected outputs.

tests/hard_coded/Mmakefile:
tests/hard_coded/erlang_deconstruct.exp:
tests/hard_coded/erlang_deconstruct.m:
tests/hard_coded/existential_list.exp:
tests/hard_coded/existential_list.m:
tests/valid/Mmakefile:
tests/valid/erl_ite_vars.m:
tests/valid/zf_erlang_bug.m:
    Delete erlang target specific tests.

tests/*:
    Delete Erlang foreign procs and foreign types.
2020-10-27 11:10:11 +11:00
Zoltan Somogyi
35656df2ef Fix test case failures by adding foreign_procs. 2020-08-09 20:30:54 +10:00
Zoltan Somogyi
6d79ac7802 Fix some anachronisms in tests/valid*.
tests/valid/Mmake.valid.common:
    Delete the RESERVE_TAG_PROGS make variable, since we have not supported
    reserved tags for a long time.

    Delete the NO_SPECIAL_PREDS_PROG make variable, since (despite its
    documentation) we do not actually specify --no-special-preds for
    the test cases listed in it.

tests/valid/Mmakefile:
    Conform to the changes above. Move the only test listed for
    NO_SPECIAL_PREDS_PROG to OTHER_PROGS.

tests/valid_seq/Mmakefile:
    Conform to the changes above.

tests/valid/unify_typeinfo_bug.m:
    Fix programming style.

tests/valid_seq/intermod_user_sharing.m:
    Delete a redundant import.
2020-07-14 00:51:50 +10:00
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
Zoltan Somogyi
afe2887882 Remove stale references to test subdirs.
A long time ago, test directories such as hard_coded had subdirectories
such as hard_coded/typeclasses. These have since been flattened out
(e.g. hard_coded/typeclasses is now just typeclasses), but there were
still remnants of the old approach. This diff deletes those remnants.

tests/*/Mmakefile:
    Delete the TESTS_DIR and the SUBDIRS mmake variables; TESTS_DIR
    was always set to "..", and SUBDIRS to the empty string.

    Delete any references to the make variable NOT_WORKING, since
    it is never used.

tests/Mmake.common:
    Document that Mmakefiles in test directories don't have to set
    TESTS_DIR and SUBDIRS anymore. Fix the formatting of the documentation
    of the make variables they do still have to set.

    Delete the targets and actions for handling subdirectories of
    test directories, since there aren't any.

tests/Mmakefile:
    Simplify some code.
2020-04-14 11:23:12 +10:00
Zoltan Somogyi
cb517805a2 Delete an (irrelevant) unused import. 2019-08-07 21:17:18 +02:00
Zoltan Somogyi
10e7ababb0 Don't generate irrelevant warnings. 2019-08-07 21:16:16 +02:00
Zoltan Somogyi
4b2a4a88b5 Fix handling "int used, imp imported" modules when making interface files.
This fixes the second incarnation of Mantis bug #401. (The first incarnation
was the handling of such modules when generating target code.)

compiler/grab_modules.m:
    Compute the set of modules that have a use_module declaration in the
    interface section and an import_module declaration in the implementation
    section, and set the status of the items imported from that module
    accordingly.

compiler/module_qual.id_set.m:
    If module A defines an entity (such as a type) that module B refers to
    without the required qualification (which can happen if B has a use_module,
    not import_module for A), then do NOT report A as unused in B; it IS used,
    just not properly.

tests/hard_coded/int_impl_imports.exp:
tests/hard_coded/int_impl_imports.m:
tests/hard_coded/int_impl_imports_2.m:
    A new test case to see whether we can compile a module that has
    "int used, imp imported" references to another module, and has
    unqualified references to an imported entity in the implementation.

tests/invalid/int_impl_imports.err_exp:
tests/invalid/int_impl_imports.m:
tests/invalid/int_impl_imports_2.m:
    A new test case to see whether we can generate the right error message
    for a module that has "int used, imp imported" references to another
    module, and has an unqualified references to an imported entity
    in the interface.

tests/hard_coded/Mmakefile:
tests/invalid/Mmakefile:
    Enable the two new test cases.

tests/valid_seq/int_impl_imports.m:
tests/valid_seq/int_impl_imports_2.m:
    Add vim mode lines.
2019-08-02 10:36:59 +02:00
Zoltan Somogyi
faa78b348e Fix a test case after Julien's recent change. 2017-03-15 09:58:21 +11:00
Julien Fischer
bcef4e5ea0 Do not run tests/valid_seq/test_xmlreader in non-C grades.
tests/valid_seq/Mmakefile:
    Do not runt he test_xmlreader test case in non-C grades, since
    it lacks the relevant foreign code definitions (and is a regression
    test for the LLDS code generator anyway.)
2016-06-23 11:13:18 +10:00
Julien Fischer
1d351be438 Avoid running some tests in decldebug grades.
Fix an error message.

tests/valid/Mmake.valid.common:
tests/valid/Mmakefile:
tests/valid_seq/Mmakefile:
     Don't run valid/bug50 and valid/bug50_full in decldebug grades,
     since they force the use of --trace deep.

compiler/handle_options.m:
   Quote the trace level when referring to it in an error message.

   Fix an incorrect option name in an error message.
2016-02-09 18:27:57 +11:00
Zoltan Somogyi
5649f36c80 Handle "use_module in interface, import_module in implementation".
If a module m1 imports module m2 using a use_module declaration in its
interface section but also imports it using an import_module declaration
in its implementation section, then references to entities defined in m2
in the interface of m1 must be module qualified, but similar references
in the implementation of m1 need NOT be module qualified.

The Mercury compiler has long had a bug that allowed entities imported
in the implementation of module m1 to be used in the interface of m1,
against the rules of the language. When I fixed that bug on 2015 nov 11,
the compiler became unable to properly process the situation described
in the paragraph above, because it still had another bug, which was that
it had a single setting for module qualification requirements: either it
was required *everywhere* in m1, or it was required *nowhere* in m1.
This diff fixes that bug (mantis bug 401) by allowing different requirements
in this respect in the interface of m1 versus its implementation.

It also changes the de-facto meaning of what exactly a use_module declaration
requires. The reference manual says only:

    Uses of entities imported using @code{use_module} declarations
    @emph{must} be explicitly module qualified.

This WAS unambiguous when it was written in june 1997, a few months before
submodules were added to the language. With a flat module system, there were
no nested module names, so either the module name was present, or it wasn't.
In the presence of nested modules, though, it IS ambiguous: HOW MUCH of
the module name must be present? The reference manual is silent on this.

At the moment, in the presence of a use_module for module ma.mb.mc,
a predicate p1 in ma.mb.mc may of course be referred to as ma.mb.mc.p1,
but may also be referred to as mb.mc.p1, or even just mc.p1. The specification
of mc is always required, but exactly WHICH of the previous module name
components are required depends on whether e.g. ma or ma.mb were themselves
imported via use_module or import_module declarations. The code implementing
the check (find_matches_in_permissions_map in module_qual.id_set.m) is itself
not too clear.

This diff changes the rules so that all references to anything imported
via a use_module declarations have to be fully qualified. This is stricter
than the existing rule, but it is MUCH simpler, and it better matches
the original intent of use_module declarations, which is the avoidance
of ALL POSSIBILITY of ambiguity.

NEWS:
doc/reference_manual.texi:
    Document this change to the language.

compiler/prog_item.m:
    Change the representation of sections in .int* files. Previously,
    we recorded whether the interface file that the section was from
    was read for an `import_module' or a `use_module' declaration.
    We now allow the recording of the fact that it had both declarations,
    a use_module in the interface and an import_module in the implementation.

compiler/modules.m:
    Treat modules that have both a `use_module' declaration in interface
    and an `import_module' declaration in the implementation as being of this
    new internal section kind.

    Add some infrastructure for debugging similar problems in the future.

compiler/module_qual.id_set.m:
    Change the permissions system. Instead of recording *independently*
    whether (a) an entity may be used in the interface and (b) whether
    references to it must be qualified, record *separately* whether
    (a) it may be used in the interface, and if so with what qualification
    requirements, and (b) what its qualification requirements are in the
    implementation. Unlike the old permission setup, the new one allows us
    to express the "use_module in interface, import_module in implementation"
    situation.

    Implement the change to the language, by requiring full module
    qualification of entities imported via use_module declarations.
    This allows us to use a single parameterized piece of code to handle
    both unqualified and qualified references, whereas before we used
    separate pieces of code for them.

    Change the way we handle errors in module qualification. Instead of
    looking only for precise matches only, and looking for the possible causes
    of errors only if we find either no matches or two or more matches, we now
    return the near-miss matches as well, the ones that we need to decide
    on what error message we want to generate. While this is slightly slower,
    it is *much* simpler, since it allows us to avoid duplicating the search
    code: once for precise matches only, once for no-match errors, and once
    for multiple-match errors.

compiler/module_qual.collect_mq_info.m:
    Set permissions for symbol access according to the new permissions system.
    Code that previously triggered the bug will use the new interface file
    section kind, and can now have its permissions record correctly.

compiler/module_qual.qual_errors.m:
    Use a single predicate to generate error messages for all situations
    in which there is not a single precise match for a module qualification.
    This allows us to diagnose multiple potential problems with a single
    lookup.

    Change the wording of an existing error message to avoid a possibly-untrue
    implication.

compiler/hlds_data.m:
    Rename a field of the type_defn type to better document its meaning.

compiler/make_hlds.m:
    Document the meaning of the need_qualifier field in sec_infos.

compiler/add_type.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.m:
compiler/pred_table.m:
compiler/parse_tree_out.m:
compiler/prog_item_stats.m:
    Conform to the above changes.

mdbcomp/sym_name.m:
    Add a utility predicate for use in looking for near-miss matches
    in module qualification.

    Make the documentation of a related predicate more precise.

tests/invalid/bad_instance.m:
tests/submodules/class.m:
tests/submodules/nested.m:
tests/submodules/nested3.m:
tests/submodules/parent.m:
    Make names fully module qualified where the language rules now require it.

tests/submodules/deeply_nested.m:
    Comment out a part of the test that tested the partially qualified names,
    since these are now not allowed.

tests/invalid/errors.err_exp:
    Expect a now-improved error message.

tests/invalid/test_nested.err_exp:
tests/invalid/transitive_import.err_exp:
tests/invalid/undef_type.err_exp:
    Expect a now less-likely-to-mislead error message.

tests/valid_seq/int_impl_imports.m:
tests/valid_seq/int_impl_imports_2.m:
    The test case for mantis bug 401.

tests/valid_seq/Mmakefile:
    Enable the new test case.
2016-01-11 23:05:39 +11:00
Julien Fischer
3dd02876a5 Delete the MLDS->IL backend.
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_managed.m:
compiler/il_peephole.m:
compiler/ilasm.m:
compiler/ilds.m:
    Delete the modules making up the MLDS->IL code generator.

compiler/globals.m:
compiler/prog_data.m:
    Delete IL as a target and foreign language.

compiler/prog_io_pragma.m:
    Delete the max_stack_size/1 foreign proc attribute.  This was only
    ever required by the IL backend.

compiler/options.m
    Delete options used for the IL backend.

compiler/write_deps_file.m:
    Don't generate mmake targets for .il files etc.

compiler/*.m:
    Conform to the above changes.

compiler/notes/compiler_design.html
compiler/notes/work_in_progress.html
    Conform to the above changes.

library/*.m:
    Delete IL foreign_proc and foreign_export pragmas.

README.DotNet:
    Delete this file.

browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
mdbcomp/Mmakefile:
mfilterjavac/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
slice/Mmakefile:
    Conform the above changes.

configure.ac:
    Don't check that IL is a supported foreign language when performing the
    up-to-date check.

    Delete the '--enable-dotnet-grades' option.

scripts/Mmake.vars.in:
    Delete variables used for the IL backend (and in on case by the Aditi
    backend).

scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
scripts/Mmake.rules:
scripts/canonical_grade.sh-subr:
tools/bootcheck:
    Delete stuff related to the 'il' and 'ilc' grades.

doc/reference_manual.texi:
     Delete the documentation of the 'max_stack_size' option.

doc/user_guide.texi:
     Delete stuff related to the IL backend.

tests/hard_coded/csharp_test.{m,exp}:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/valid/csharp_hello.m:
	Delete these tests: they are no longer relevant.

tests/hard_coded/equality_pred_which_requires_boxing.m:
tests/hard_coded/foreign_import_module.m:
tests/hard_coded/foreign_import_module_2.m:
tests/hard_coded/foreign_type.m:
tests/hard_coded/foreign_type2.m:
tests/hard_coded/foreign_type3.m:
tests/hard_coded/intermod_foreign_type2.m:
tests/hard_coded/lp.m:
tests/hard_coded/user_compare.m:
tests/invalid/foreign_type_2.m:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/invalid/foreign_type_visibility.m:
tests/invalid/illtyped_compare.{m,err_exp}:
tests/submodules/external_unification_pred.m
tests/valid/big_foreign_type.m
tests/valid/solver_type_bug.m
tests/valid_seq/foreign_type_spec.m
tests/valid_seq/intermod_impure2.m
    Delete IL foreign_procs where necessary.

tests/hard_coded/Mmakefile
tests/invalid/Mercury.options
tests/invalid/Mmakefile
tests/submodules/Mmakefile
tests/valid/Mercury.options
tests/valid/Mmake.valid.common
tests/valid/Mmakefile
tests/valid_seq/Mmakefile
tests/valid_seq/Mercury.options
    Conform to the above changes.
2015-09-21 11:34:46 +10:00
Zoltan Somogyi
057fe9ecd0 Clean up after --grade il tests. 2015-09-10 08:05:12 +10:00
Zoltan Somogyi
e0cdfc2fe2 Make the tests really work in parallel.
There was a bug that prevented the tests in each directory from being run
in parallel, even when the mmake was invoked with e.g. -j4. The bug
was the absence of a '+' on an action that invoked tests/run_one_test.
Without that +, the make process inside the "mmake -j4 runtests_local"
command issued by bootcheck screwed up its connection with the recursive
make invoked by run_one_test, and apparently decided to stop using
parallelism. It was telling us this all this time but its messages,
which looked like this:

    make[2]: warning: -jN forced in submake: disabling jobserver mode.

were lost in the sea of other bootcheck output until my recent change
to run_one_test.

A single-character change fixes the bug; the rest of this big change is
dealing with the consequences of fixing the bug. Many test cases in
the hard_coded and valid directories contain nested modules, which
need to be compiled sequentially.

tests/Mmake.common:
    Fix the bug.

    Delete the duplicate "ALL TESTS SUCCEEDED" message from the runtests
    target, since the runtests_local target already prints a message
    to that effect. Make this message more emphatic.

tests/run_one_test:
    Make the output a bit easier to understand.

tests/hard_coded/*.{m,exp}:
tests/submodules/*.{m,exp}:
    Move the source files and expected output files of the test cases that
    use nested modules from hard_coded to submodules, since most of the tests
    in the hard_coded can be done in parallel, while the ones in submodules
    are already done in sequence.

tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
tests/submodules/Mmakefile:
tests/submodules/Mercury.options:
    Move the Mmakefile and Mercury.options entries of the moved test cases
    from hard_coded to submodules.

tests/valid_seq:
    A new test directory, to hold the test cases originally in tests/valid
    that contain nested modules. Moving these to a new directory, which
    forces -j1, allows us to execute the remaining ones in parallel.

tests/valid/*.m:
tests/valid_seq/*.m:
    Move the source files of the test cases that use nested modules
    from valid to valid_seq.

    In a few cases, clean up the test cases a bit.

tests/valid/Mmakefile:
tests/valid/Mercury.options:
tests/valid_seq/Mmakefile:
tests/valid_seq/Mercury.options:
tests/valid/Mmake.valid.common:
    Add valid_seq/Mmakefile to list the test cases now in valid_seq,
    and add valid_seq/Mercury.options to hold their option values.
    Delete the entries of those tests from valid/Mmakefile, and their option
    values from valid/Mercury.options. Unlike valid/Mmakefile,
    valid_seq/Mmakefile forces -j1.

    To avoid unnecessary duplication between the two Makefiles, put
    all the rules that both need into valid/Mmake.valid.common, and
    include this in both Mmakefiles.

tests/string_format/Mmakefile:
    Force -j1, since these tests share a library module.

tests/Mmakefile:
    List the new valid_seq directory among the others.

tests/bootcheck:
    Execute the tests in the new valid_seq directory as well as the others.

    Record when the execution of the test suite is started.

    Comment out invocations of set -x, since they add no useful information
    in the vast majority of cases. The comment sign can be removed if and
    when the information *would* be useful.

    Don't try to copy a nonexistent file. (The error message about this
    was also lost in the noise.)
2015-08-26 01:01:54 +10:00