Commit Graph

14 Commits

Author SHA1 Message Date
Zoltan Somogyi
6413b4fb08 Create invalid_nodepend and invalid_onlydepend.
tests/invalid_onlydepend:
    Move the one test case in tests/invalid for which we want to check
    the error messages generated during the generation of dependencies
    to this new test directory.

tests/invalid_nodepend:
    Move all test cases in tests/invalid which get errors during the
    generation of dependencies but for which we want to check the error
    messages generated during normal compilation to this new test directory.

tests/invalid_nodepend/Mmakefile:
tests/invalid_nodepend/Mercury.options:
tests/invalid_onlydepend/Mmakefile:
tests/invalid_onlydepend/Mercury.options:
    Versions of the same files in tests/invalid, but containing only
    the entries relevant to the moved test cases.

tests/invalid/Mmakefile:
tests/invalid/Mercury.options:
    Delete the entries that refer to the moved test cases.

tests/README:
    Document the two new test directories.

tools/bootcheck:
    Add invalid_onlydepend and invalid_nodepend to the list of
    test directories.
2021-07-28 00:59:04 +10:00
Julien Fischer
cd2380ac81 Minor fixes for tests README file.
tests/README:
    Fix the descriptions of a couple of test directories.
2020-04-14 19:11:13 +10:00
Zoltan Somogyi
b79cdbe0e6 Describe all the test directories. 2020-04-14 09:36:54 +10:00
Peter Wang
d5992c5d60 Describe the `tests/analysis' directory.
Estimated hours taken: 0.1
Branches: main

tests/README:
	Describe the `tests/analysis' directory.

tools/bootcheck:
	Add `tests/analysis' subdirectors to the `all_test_dirs' variable.
2008-07-31 03:20:54 +00:00
Julien Fischer
d13356c38e Add the trailing directory to the list of test dirs.
Estimated hours taken: 0
Branches: main

tools/bootcheck:
	Add the trailing directory to the list of test dirs.

tests/README:
	Add a note that the bootcheck script may need to be updated
	if a new (sub)directory is added to the test suite.

tests/Mmake.common:
	Fix an overlong line.
2006-01-25 07:03:44 +00:00
Julien Fischer
6af09740fd Move some of the regression tests for trailing from
Estimated hours taken: 1
Branches: main

Move some of the regression tests for trailing from
extras/trailed_update/tests to a new trailing subdirectory in the test suite.
The motivation for doing this is that parts of the trailed_update package are
broken (and likely to remain so until the solver type/purity situation is
sorted out) and the tests are not being run.

extras/trailed_update/tests/Mmakefile:
extras/trailed_update/tests/func_trail_test.{m,exp}:
extras/trailed_update/tests/func_trail_test_2.{m,exp}:
	Delete these tests from here.

tests/trailing:
	New subdirectory that contains regression tests for trailing.

tests/trailing/Mmakefile:
tests/trailing/Mercury.options:
tests/trailing/func_trail_test.{m,exp}:
tests/trailing/func_trail_test_2.{m,exp}:
	Move the test cases from extras/trailed_update/tests to here.

	Update the syntax in the test cases and escape some special characters
	in the C code correctly.

tests/README:
	Update this file to mention the trailing directory.
2006-01-11 05:12:23 +00:00
Julien Fischer
980afa90c5 Add an analysis that tries to identify those procedures
Estimated hours taken: 70
Branches: main

Add an analysis that tries to identify those procedures
in a module that will not throw an exception.
(I guess it may be more accurate to call it a non-exception analysis).

For those procedures that might throw exceptions the
analysis further tries to distinguish between those
that throw an exception as a result of a call to throw
and those that throw an exception as a result of a
call to a unification/comparison predicate that may involve
calls to user-defined equality/comparison predicates that throw
exceptions.

This sort of thing used to be done by the termination analysis,
where being able to prove termination was equated with not
throwing an exception.  This no longer works now that
the termination analyser considers exception.throw/1 to
be terminating - and in fact it never quite worked anyway
because the termination analyser was not handling things
like foreign code and user-defined equality and comparison
predicates correctly.

There are currently a few limitations, the main ones being:

* we currently use transitive-intermodule optimization rather
  than the intermodule-analysis framework.  This may causes
  problems when their are cycles in the module dependency graph.

* we currently assume that all calls to higher-order predicates
  may result in an exception being thrown.

* we currently assume that all foreign procs that make calls
  back to Mercury may throw exceptions.

* we currently assume that all solver types and existentially
  quantified types might result in an exception being thrown.

It should be possible to remove these limitations in later
versions.

This diff also modifies the cannot_loop_or_throw family of
predicates in goal_form.m.  There are now two versions of each
predicate; one that can make use of information from the
termination and exception analyses and one that cannot.

compiler/exception_analysis.m:
	The new analysis.

compiler/prog_data.m:
compiler/prog_io_pragma.m:
	Handle `:- pragma exceptions(...' in .opt and .trans_opt files.

compiler/hlds_module.m:
	Attach information to each module about whether each procedure
	in the module may throw an exception.

compiler/goal_form.m:
	Rewrite the predicates in this module so that they can
	optionally use information from the exception analysis.

compiler/constraint.m:
compiler/goal_util.m:
compiler/rl.m:
compiler/simplify.m:
	Use information from exception and termination analyses
	when performing various optimizations.

compiler/type_util.m:
	Add a new predicate type_util.type_is_existq/2 that tests
	whether a type is existentially quantified or not.

compiler/mercury_compile.m:
compiler/mercury_to_mercury.m:
compiler/modules.m:
compiler/options.m:
compiler/module_qual.m:
compiler/make_hlds.m:
compiler/recompilation.version.m:
compiler/trans_opt.m:
compiler/transform_hlds.m:
	Minor changes needed by the above.

NEWS:
compiler/notes/compiler_design.html:
doc/user_guide.texi:
	Mention the new analysis.

tests/README:
	Include a description of the term directory.

tests/term/Mercury.options:
tests/term/Mmakefile:
tests/term/exception_analysis_test.m:
tests/term/exception_analysis_test.trans_opt_exp:
	Add a test for the new analysis.
2004-10-16 15:08:55 +00:00
Simon Taylor
47a4d62dc1 Improve the test framework to make it easier to find out which tests
Estimated hours taken: 30
Branches: main

Improve the test framework to make it easier to find out which tests
failed and to reduce disk usage (important in debug grades).

Allow the tests to be run with `mmc --make' (still some failures).

Allow the user to run only the failing tests from a previous
run by using `mmake ERROR_FILE=runtests.errs', where runtests.errs
is the log file from the previous run.

tests/Mmake.common:
tests/*/Mmakefile:
	Move common code (such as the code to deal with subdirectories)
	to Mmake.common.

	Run the tests using `mmake runtests' rather than using slightly
	different runtests scripts in each directory.

	Add to the output from `mmake runtests' to make it easier to
	identify which tests failed in which grades.

	Move per-module options into Mercury.options files so they
	can be read by `mmc --make'.

	Remove the last of the NU-Prolog support.

	Consistently use the main module name when listing tests.
	Some directories (e.g. invalid) were using the source file
	name.

tests/process_log.awk:
	Collect the parts of the output relating to failing tests.

tests/generate_exp:
tests/handle_options:
tests/subdir_runtests:
tests/startup:
tests/shutdown:
tests/*/runtests:
tests/recompilation/TESTS:
	Removed.

tests/recompilation/test_functions:
	Make sure the old result file is removed before starting
	each test.

	Put the mmake output for tests which are supposed to fail
	into a different file for each test.

tests/warnings/Mmakefile:
	Use %.c rather than $(cs_subdir)%.c in a rule.
	The $(cs_subdir) part doesn't work with `mmc --make',
	and isn't necessary any more (modules.m generates a rule
	`module.c: $(cs_subdir)module.c').

tests/README:
	Updated.

tools/bootcheck:
tools/test_mercury:
	Use `mmake runtests' instead of the `runtests' script.

	Add a `-f' (`--failing-tests') option to bootcheck which
	runs only the failing tests from the last run.

tools/test_mercury:
tools/run_all_tests_from_cron:
	Use the new framework to summarize test failures.
2002-08-17 13:52:35 +00:00
Simon Taylor
9dd11b2fc6 Smart recompilation. Record version numbers for each item
Estimated hours taken: 400

Smart recompilation. Record version numbers for each item
in interface files. Record which items are used in each compilation.
Only recompile a module if the output file does not exist or
nothing has changed.

There is still some work to do on this:
- it doesn't work with inter-module optimization.
- it doesn't work when the module name doesn't match the file name.
  (this problem will go away when mmake functionality is moved into
  the compiler.

I'll hold off documenting this change in the NEWS file and
on the web page for a month or so, until I've had a bit more
experience using it.

compiler/options.m:
compiler/handle_options.m:
doc/user_guide.texi:
	Add an option `--smart-recompilation', currently off by default.

	Add an internal option `--generate-version-numbers' to control
	whether version numbers are written to the interface files. If
	`--smart-recompilation' is disabled because the module
	is being compiled with `--intermodule-optimization' (e.g. in the
	standard library), we still want to write the version numbers
	to the interface files.

	Add an option `--verbose-recompilation' (default off)
	to write messages describing why recompilation is needed.

	Add an option `--warn-smart-recompilation' (default on)
	to control warnings relating to the smart recompilation
	system. Warn if smart recompilation will not work with
	the output and inter-module optimization options given.

compiler/recompilation.m:
	Type declarations for smart recompilation.
	Predicates to record program items used by compilation.

compiler/recompilation_version.m:
	Compute version numbers for program items in interface files.

compiler/recompilation_usage.m:
	Find all items used by a compilation.

compiler/recompilation_check.m:
	Check whether recompilation is necessary.

compiler/timestamp.m:
	Timestamp ADT for smart recompilation.

compiler/mercury_compile.m:
	Invoke the smart recompilation passes.

compiler/modules.m:
compiler/prog_io.m:
	Return timestamps for modules read.

	When reading a module make sure the current input stream
	is reset to its old value, not stdin.

	Handle version number items in interface files.

compiler/module_qual.m:
compiler/unify_proc.m:
compiler/make_hlds.m:
	Record all items used by local items.

compiler/make_hlds.m:
	Process `:- pragma type_spec' declarations in
	add_item_list_clauses. The qual_info is needed
	when processing `:- pragma type_spec' declarations
	so that any equivalence types used by the declaration
	can be recorded as used by the predicate or function to
	which the `:- pragma type_spec' applies.

compiler/equiv_type.m:
	For each imported item, record which equivalence types
	are used by that item.

compiler/hlds_module.m:
	Add a field to the module_info to store information about
	items used during compilation of a module.

compiler/check_typeclass.m:
	Make sure any items used in clauses for typeclass method
	implementations are recorded in the `.used' file.

compiler/prog_data.m:
compiler/*.m:
	Factor out some duplicated code by combining the
	pred and func, and pred_mode and func_mode items.

	Make it easier to extract the name of a type, inst or mode
	from its declaration.

	Add an item type to hold the version numbers for an interface file.

	Allow warnings to be reported for `nothing' items (used for
	reporting when version numbers are written using an
	obsolete format).

compiler/prog_io.m:
compiler/prog_io_util.m:
compiler/typecheck.m:
compiler/type_util.m:
compiler/*.m:
	Strip contexts from all types, not just those in class constraints.
	This makes it possible to use ordinary unification to check
	whether items have changed (with the exception of clauses).

	Remove code to create types with contexts in typechecking.

	Remove code scattered through the compiler to remove contexts
	from types in class constraints.

compiler/hlds_pred.m:
compiler/prog_util.m:
	Move hlds_pred__adjust_func_arity to prog_util, so that it
	can be used by the pre-hlds passes.

compiler/typecheck.m:
compiler/hlds_module.m:
	Move typecheck__visible_modules to hlds_module.m, so it can
	be used by recompilation_usage.m.

compiler/typecheck.m:
	Add a comment telling where updates may be required if the
	code to typecheck a var-functor unification changes.

compiler/error_util.m:
	Allow writing messages without contexts (used for the verbose
	recompilation messages).

	Add functions to format sym_name and sym_name_and_arity,
	and to add punctuation to the end of an error message
	without unwanted line breaks before the punctuation.

scripts/Mmake.rules:
compiler/modules.m:
	Don't remove the output file before running the compiler. We need
	to leave the old output file intact if smart recompilation detects
	that recompilation is not needed.

compiler/notes/compiler_design.html:
	Document the new modules.

library/io.m:
NEWS:
	Add predicates to find the modification time of files
	and input_streams.

library/set.m:
NEWS:
	Add a predicate version of set__fold

	Don't sort the output of set__filter, it's already sorted.

library/std_util.m:
NEWS:
	Add a predicate `std_util__map_maybe/3' and a function
  	`std_util__map_maybe/2' to apply a predicate or a function to
    	a value stored in a term of type `std_util__maybe'.

configure.in:
runtime/mercury_conf.h.in:
runtime/RESERVED_MACRO_NAMES:
	When checking whether the compiler is recent enough, check for
	the --warn-smart-recompilation option.

	Check for stat().

library/Mmakefile:
	Disable warnings about smart recompilation not working with
	`--intermodule-optimization'.

browser/Mmakefile:
	Disable warnings about smart recompilation not working when
	the module name doesn't match the file name.

runtime/mercury_string.h:
	Add a macro MR_make_string_const() which automates computation
	of the length of string argument to MR_string_const().

tests/recompilation/Mmakefile:
tests/recompilation/runtests:
tests/recompilation/test_functions:
tests/recompilation/TESTS:
tests/recompilation/README:
	A framework for testing smart recompilation.
	The option currently only works for the recompilation directory.

tests/recompilation/TEST.m.{1,2}:
tests/recompilation/TEST_2.m.{1,2}:
tests/recompilation/TEST.exp.{1,2}:
tests/recompilation/TEST.err_exp.2:
	Test cases, where TEST is one of add_constructor_r, add_instance_r,
	add_instance_2_r, add_type_nr, change_class_r, change_instance_r,
	change_mode_r, field_r, func_overloading_nr, func_overloading_r,
	lambda_mode_r, nested_module_r, no_version_numbers_r,
	pragma_type_spec_r, pred_ctor_ambiguity_r, pred_overloading_r,
	add_type_re, remove_type_re, type_qual_re.

tests/handle_options:
	Add an option `-e' to generate any missing expected output files.
2001-06-27 05:05:21 +00:00
Mark Brown
55d0d482c6 Provide a more uniform interface to the test directories.
Estimated hours taken: 9

Provide a more uniform interface to the test directories.  Before this
change, the tests directory as well as direct descendents had `runtests'
scripts to execute the tests.  These would run `mmake', which in turn
would recursively run `mmake' in any subdirectories.  The subdirectories
did not have their own `runtests' scripts.

This change adds a `runtests' script to those subdirectories that did
not have them before.  The scripts have the same meaning as they did
previously---run all tests in the current directory and below, and
return a status of 0 only if all tests pass.

The rationale for this change is so that each directory in the tests
is treated the same, regardless of whether it is a top-level
directory or not.  This means, for example, that any test directory can
be used as an argument to the `--test-dir' option to tools/bootcheck.

This change also links tests/general/accumulator into the automated
testing suite.

tests/README:
	Update comments.

tests/Mmake.common:
	Introduce new target dependencies.  Targets of the form
	`foo' depend on the targets `foo_local' and `foo_subdirs'.

tests/subdir_runtests:
	New script to recursively call runtests scripts in subdirectories.
	Most of the code for this script originally came from
	tests/runtests.

tests/shutdown:
tests/startup:
	Use `realclean_local' as a target instead of `realclean', since
	the subdirectories will be handled by other runtests scripts.

tests/runtests:
tests/debugger/runtests:
tests/general/runtests:
tests/hard_coded/runtests:
	Use the new script to run tests in the subdirectories, rather
	than doing a recursive mmake.  Make sure that non-zero return
	values are propagated upwards where appropriate.

tests/debugger/declarative/runtests:
tests/hard_coded/typeclasses/runtests:
tests/hard_coded/sub-modules/runtests:
	New scripts to handle running tests in the subdirectories.

tests/debugger/Mmakefile:
tests/general/Mmakefile:
tests/hard_coded/Mmakefile:
	Add `*_subdirs' targets that do a recursive Mmake.  Change the
	existing targets to `*_local' ones.

tests/warnings/Mmakefile:
	Manually add the extra dependencies, since this Mmakefile does
	not include tests/Mmake.common.
1999-07-12 06:26:05 +00:00
Fergus Henderson
8bd5541519 Remove obsolete description of the `NUPROLOG' file, since
Estimated hours taken: 0.1

tests/README:
	Remove obsolete description of the `NUPROLOG' file, since
	that file has been removed.
1997-07-19 14:41:26 +00:00
Zoltan Somogyi
d35ded0522 A shell script to run the tests in all the subdirectories.
Estimated hours taken: 2

runtests:
	A shell script to run the tests in all the subdirectories.

handle_options:
	A shell script fragment to handle the options for the runtests
	scripts in this directory and the subdirectories.

generate_exp:
	A shell script to generate the .exp files by running NU-Prolog
	in the directories where they aren't generated by hand. This is
	now a separate activity from running the tests themselves.

Mmake:
	Only include the rule for making .exp files if mmake is executed on
	a machine whose name is listed in the file NUPROLOG. Don't remove
	.exp files for "mmake clean".

NUPROLOG:
	The control file for the Makefile change.

README:
	Document these changes.
1996-11-04 07:29:07 +00:00
David Jeffery
373c5d99d2 Added message about the new 'warnings' directory to the README.
Estimated hours taken: 0.1

Added message about the new 'warnings' directory to the README.

README:
	Added message about new 'warnings' directory.
1995-11-20 09:25:16 +00:00
Fergus Henderson
bcce831b41 General clean up of the test suite directories.
Estimated hours taken: 2.5

General clean up of the test suite directories.

tests/README:
	Add some docuemntation - a general overview.
1995-11-14 07:54:27 +00:00