Commit Graph

9 Commits

Author SHA1 Message Date
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
8a764392d9 Avoid warnings from make in test directories.
tests/Mmake.common:
    Don't invoke any actions in the clean_local and realclean_local
    targets, since if using mmc --make, the builtin mmake rules
    have actions for those targets as well, and make can't handle
    more than one action for a target having actions. Replace those
    actions with dependencies on other, unique targets that have
    the actions instead.

tests/*/Mmakefile:
    Avoid actions in clean_local and realclean_local targets the same way.

    Sort the test names in some directories that didn't already do so.

    Delete some obsolete comments.

    Fix style.

tests/valid/Mmake.valid.common:
    As for the Mmakefiles above, and also move the definition of a make
    variable before it is needed.
2015-09-08 05:57:53 +10:00
Zoltan Somogyi
73f0a36719 Allow the use of -jN in many test directories.
tests/Mmake.common:
    Replace the -j1 in the runtests_local target used by all the test
    directories with $(MAYBE_J1).

tests/*/Mmakefile:
    Define MAYBE_J1 it as the empty string in test directories in which
    different tests don't share source files.

    Define MAYBE_J1 as -j1 in test directories in which
    different tests do share source files.

tests/submodules/sub2_a.m:
    Add this copy of sub_a.m to allow tests in the submodules directory
    to be done in parallel.

tests/submodules/accessibility2.m:
    Import sub2_a.m instead of sub_a.m.

tests/warnings/ambig_types_high_level.m:
    Add this copy of ambig_types.m to allow tests in the warnings directory
    to be done in parallel.

tests/warnings/ambig_high_level.m:
    Import ambig_types_high_level.m instead of ambig_types.m.
2015-02-19 06:02:45 +11:00
Zoltan Somogyi
de2f7b2a0c Flatten the test directories, step 2.
Specifically, rename the following subdirectories of the test directory:

    old dir name                new dir name

    analysis/ext                analysis_external
    analysis/ctgc               analysis_ctgc
    analysis/excp               analysis_excp
    analysis/table              analysis_table
    analysis/trail              analysis_trail
    invalid/purity              invalid_purity
    analysis/sharing            analysis_sharing
    hard_coded/purity           purity
    general/accumulator         accumulator
    analysis/unused_args        analysis_unused_args
    debugger/declarative        declarative_debugger
    hard_coded/exceptions       exceptions
    general/string_format       string_format
    hard_coded/sub-modules      submodules
    hard_coded/typeclasses      typeclasses
    general/structure_reuse     structure_reuse

Some subdirectories are still there, to wit, the subdirs of the inactive
test directory stm, each of which (if I remember correctly) holds only one
test case.

The general/structure_reuse directory previously wasn't enabled; I think
this was a bug.

tests/Mmakefile:
tools/bootcheck:
    List the new test directories.

tests/Mmake.common:
    The analysis_* directories each need to know whether the workspace
    uses subdirs. This used to be controlled from one place,
    analysis/Mmakefile, but since analysis_* are not subdirs of analysis,
    we need a new central place to find this out.

tests/analysis/common.sh:
    Update documentation for the move.

tests/OLDDIRS/Mmakefile:
    Set the subdir list to empty.

tests/NEWDIRS/Mmakefile:
    Update the "this" directory's name, as well as TESTS_DIR.

    In analysis_*/Mmakefile, use the new mechanism for detecting the presence
    of subdirs.
2015-02-10 00:44:14 +11:00
Zoltan Somogyi
d33273d033 Tell vim not to expand tabs in Makefiles.
This file-specific setting will override a default setting of expandtabs
in $HOME/.vimrc.

*/Makefile:
*/Mmakefile:
    As above.

tests/hard_coded/.gitignore:
    Don't ignore the purity subdir. This ignore must have been left over
    from when purity.m was a test in hard_coded, not hard_coded/purity,
    and it ignored an executable, not a directory.
2015-01-08 22:07:29 +11:00
Peter Wang
942b704bf5 The tests in the `tests/analysis' directory fail to run during the nightly
Estimated hours taken: 0.2
Branches: main

The tests in the `tests/analysis' directory fail to run during the nightly
tests because then `--intermodule-optimisation' might be present in
EXTRA_MCFLAGS, which is incompatible with `--intermodule-analysis'.

tests/analysis/Mmakefile:
tests/analysis/ctgc/Mmakefile:
tests/analysis/excp/Mmakefile:
tests/analysis/ext/Mmakefile:
tests/analysis/sharing/Mmakefile:
tests/analysis/table/Mmakefile:
tests/analysis/trail/Mmakefile:
tests/analysis/unused_args/Mmakefile:
	Delete `--intermodule-optimisation' and also
	`--transitive-intermodule-optimisation' from EXTRA_MCFLAGS when
	running in these directories.
2008-06-12 01:07:18 +00:00
Peter Wang
7c0119911e I accidentally committed a set of tests in the directory
Branches: main

tests/analysis/Mmakefile:
tests/analysis/ctgc/Mmakefile:
	I accidentally committed a set of tests in the directory
	`analysis/ctgc' instead of `analysis/reuse'.  Update the makefiles to
	reflect the name that was actually used.
2008-06-06 01:11:39 +00:00
Peter Wang
6eab527191 More changes to the intermodule analysis framework.
Branches: main

More changes to the intermodule analysis framework.  This patch mainly deals
with incorrect treatment of :- external procedures, opt_imported procedures,
and forcing the correct reanalyses when answers change or requests are
satisfied.

- Previously, the way to ensure that a module M is reanalysed if a request in
  module N is satisfied was, while analysing M: assume an answer for the
  procedure in N; record that as a result in N; and record that M has a
  dependency on that answer.  When N is analysed, if the real answer is
  better than the assumed answer, M would be marked `suboptimal' and later
  reanalysed.

  That's complicated and wasn't always done correctly.  Now we remember the
  module which makes a request.  When the request is satisfied, we mark the
  requesting module as `suboptimal'.  This also means the `.analysis' file of
  a module will only be modified when analysing that module and no others,
  which should be useful for parallel builds.

- In most analyses we weren't recording results for exported `:- external'
  procedures as we don't have their clauses and don't analyse them.  Other
  modules would happily make requests for `:- external' procedures, which
  would never be satisfied.

- We shouldn't make intermodule requests for `opt_imported' procedures as we
  actually have their clauses.  Even if the request is satisfied, we'd
  probably not look them up since we do have their clauses.

- If a module M opt_imports a procedure P from module N (its clauses are
  available while analysing M) then M also needs to depend on any answers
  required by P.  Otherwise a change to an answer required by P won't cause M
  to be reanalysed.

- There doesn't seem to be any reason to keep track of the analysis status of
  individual results.  If an answer changes requiring another module to be
  reanalysed, the *whole module* will be marked suboptimal or invalid.  And
  if that results in changed answers, its dependant modules will be marked.
  This patch doesn't remove the status of individual results but makes them
  always `optimal'.


compiler/analysis.m:
	Remember the name of the module being analysed in the analysis_info.
	Simplify some predicate interfaces with this information.

	Remember whether we're currently making an analysis file or just
	reading from them.  Make the record_* predicates do nothing in the
	latter case, so the caller doesn't need to check.  Also make the
	record predicates do the right thing if the callee module is
	non-local, e.g.  don't make requests to non-local modules.

	Automatically add a request if depending on a result that doesn't
	exist.

	Add a procedure to return the existing call patterns for a procedure,
	regardless of whether the module has been marked `invalid'.

	Add some assertions to check the analysis framework is being used as
	intended.

	Minor cleanups.

compiler/analysis.file.m:
	Record the module that made the request in `.request' files.

	Bump the analysis file version number.

compiler/hlds_module.m:
	Pass extra arguments to `init_analysis_info'.

compiler/hlds_pred.m:
	Add `pred_info_is_imported_not_external' which doesn't succeed on
	`:- external' procedures (defined in the current module), unlike
	`pred_info_is_imported'.

compiler/exception_analysis.m:
compiler/tabling_analysis.m:
compiler/trailing_analysis.m:
compiler/unused_args.m:
	Record results for `:- external' procedures.

	Don't look up results for our own `:- external' procedures from the
	analysis registry.  In general, fix many spots where external procs
	would be treated as imported.

	Write out results for procedures which are exported to submodules.

	Conform to analysis framework changes.  Remove some redundant checks
	which have been moved into the framework.

compiler/mercury_compile.m:
	Conform to analysis framework changes.

compiler/structure_reuse.analysis.m:
	Be careful not to read in requests and call patterns for
	`opt_imported' procedures as if they were defined in the current
	module.

	If depending on an answer that doesn't exist, also make a request for
	that answer.

	Conform to analysis framework changes.

	Write out messages when removing useless reuse version procedures.

compiler/structure_reuse.indirect.m:
	Use `pred_info_is_imported_not_external' so as not to look up results
	for our own `:- external' procedures from the analysis registry.

	Treat `opt_imported' procedures as intra-module as far as requests
	are concerned.  We need to satisfy requests for them in the current
	compiler invocation rather than when analysing imported modules.

compiler/structure_sharing.analysis.m:
	Fix treatment of `:- external' procedures.

	Conform to analysis framework changes.

compiler/structure_sharing.domain.m:
	Don't return suboptimal when unable to look up a result.

compiler/mmc_analysis.m:
	Replace pred_or_func_name_arity_to_func_id by a higher-level
	predicate.

tests/Mmakefile:
tests/analysis/Mmakefile:
tests/analysis/common.sh:
tests/analysis/excp/Mercury.options:
tests/analysis/excp/Mmakefile:
tests/analysis/excp/excp_m1.m.exception:
tests/analysis/excp/excp_m1.m.no_exception:
tests/analysis/excp/excp_m2.m:
tests/analysis/excp/excp_m3.m:
tests/analysis/excp/excp_runtest.sh:
tests/analysis/ext/Mercury.options:
tests/analysis/ext/Mmakefile:
tests/analysis/ext/ext.m:
tests/analysis/ext/ext2.m:
tests/analysis/ext/ext2_runtest.sh:
tests/analysis/ext/ext_runtest.sh:
tests/analysis/sharing/Mercury.options:
tests/analysis/sharing/Mmakefile:
tests/analysis/sharing/sharing_m1.m.no_share:
tests/analysis/sharing/sharing_m1.m.share:
tests/analysis/sharing/sharing_m2.m:
tests/analysis/sharing/sharing_m3.m:
tests/analysis/sharing/sharing_runtest.sh:
tests/analysis/table/Mercury.options:
tests/analysis/table/Mmakefile:
tests/analysis/table/table_m1.m.no_tabling:
tests/analysis/table/table_m1.m.tabling:
tests/analysis/table/table_m2.m:
tests/analysis/table/table_m3.m:
tests/analysis/table/table_runtest.sh:
tests/analysis/trail/Mercury.options:
tests/analysis/trail/Mmakefile:
tests/analysis/trail/trail_m1.m.no_trail:
tests/analysis/trail/trail_m1.m.trail:
tests/analysis/trail/trail_m2.m:
tests/analysis/trail/trail_m3.m:
tests/analysis/trail/trail_runtest.sh:
tests/analysis/unused_args/Mercury.options:
tests/analysis/unused_args/Mmakefile:
tests/analysis/unused_args/ua_m1.m.no_unused_args:
tests/analysis/unused_args/ua_m1.m.unused_args:
tests/analysis/unused_args/ua_m2.m:
tests/analysis/unused_args/ua_m3.m:
tests/analysis/unused_args/unused_args_runtest.sh:
	Add test cases.
2008-06-05 06:25:20 +00:00