Patchwork [ada,testsuite] gnat.dg cleanup

login
register
mail settings
Submitter Rainer Orth
Date Jan. 10, 2011, 3:50 p.m.
Message ID <yddhbdg3gi1.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/78166/
State New
Headers show

Comments

Rainer Orth - Jan. 10, 2011, 3:50 p.m.
While working to convert ACATS to DejaGnu, I noticed a couple of issues
in the gnat.dg testsuite (which ACATS/gnat.acats will be based on) that
bear cleanup:

* Several comments in gnat.exp are out of date, or whole regions of code
  commented and unused.

* While there is a default_gnat_version proc (which doesn't work), it is
  unused since there's no corresponding gnat_version proc that calls it.
  This way, gnatmake version info is missing from
  gnat.sum/mail-report.log.

* Several procs are identical to their generic gcc-defs.exp
  counterparts, with the exception of ${tool} being replaced by gnat.
  I've just removed them to avoid unnecessary code duplication.

* There are references to gnat_libgcc_s_path, but GNAT is always tested
  with the static libgnat, so this is irrelevant.

* The `Executing on host: ' lines in gnat.log cannot be repeated as is
  since they depend on ADA_INCLUDE_PATH and ADA_OBJECTS_PATH being set
  in the environment.  While gnat.exp of course does this, you have to
  manually reconstruct what the proc does.  So I'm logging the result to
  simplify this.

* Compared to other testsuites, gnat.dg is unclean to the max: it leaves
  all .ali/.s/.o files behind, as well as some others, which massively
  clutters the testsuite directory.  I now delete the .ali/.o files in
  gnat-dg.exp (gnat-dg-test).  To get rid of files left behind by
  building supporting packages, I've introduced a new cleanup-packages
  action for dg-final, along the lines of the Fortran cleanup-modules,
  and annotated the affected sources accordingly.

  After all this, only three files are still left behind:

      atomic1_pkg.ads.004t.gimple	from used package
      data				fromo in_out_parameter.adb
      gnatg.adb.dg			from gnatg.adb, from -gnatD?

  I haven't bothered to check how to remove them; one might use
  remote_file build delete in dg-final if need be.

Bootstrapped without regressions on i386-pc-solaris2.11.  The only
changes are that the gnatmake version used is now logged (though I only
see it in gnat.sum, not mail-report.log; have to check
contrib/dg-extract-results.sh why it's missed there) and
gcc/testsuite/gnat is clean (well, mostly) after the testsuite run.

Ok for mainline?

	Rainer


2011-01-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	gcc:
	* doc/sourcebuild.texi (Final Actions): Document cleanup-packages.

	gcc/testsuite:
	* lib/gnat.exp: Fix comments.
	(default_gnat_version): Call $compiler with --version.
	Adapt regexp for gnatmake output.
	(gnat_version): New proc.
	(gnat_init): Remove gnat_libgcc_s_path.
	(gnat_target_compile): Likewise.
	Remove ld_library_path.
	Log ADA_INCLUDE_PATH, ADA_OBJECTS_PATH.
	(gnat_pass): Remove.
	(gnat_pass): Remove.
	(gnat_finish): Remove.
	(gnat_exit): Remove.
	(prune_gnat_output): Reindent.
	* lib/gnat-dg.exp (gnat-dg-test): Remove additional output files.
	* lib/gcc-dg.exp (cleanup-packages): New proc.

	* gnat.dg/array7.adb: Use cleanup-tree-dump "optimized".
	* gnat.dg/loop_optimization6.adb: Likewise.
	* gnat.dg/atomic1.adb: Use cleanup-tree-dump "gimple".

	* gnat.dg/OCONST2: Use cleanup-packages.
	* gnat.dg/OCONST3: Likewise.
	* gnat.dg/OCONST4: Likewise.
	* gnat.dg/OCONST5: Likewise.
	* gnat.dg/Oalign2: Likewise.
	* gnat.dg/Slice8_Pkg2: Likewise.
	* gnat.dg/aggr11.adb: Likewise.
	* gnat.dg/aggr16.adb: Likewise.
	* gnat.dg/assign_from_packed.adb: Likewise.
	* gnat.dg/atomic1.adb: Likewise.
	* gnat.dg/check_elaboration_code.adb: Likewise.
	* gnat.dg/constant2.adb: Likewise.
	* gnat.dg/conv_bug.adb: Likewise.
	* gnat.dg/decl_ctx_use.adb: Likewise.
	* gnat.dg/discr16.adb: Likewise.
	* gnat.dg/discr6.adb: Likewise.
	* gnat.dg/discr8.adb: Likewise.
	* gnat.dg/dispatch1.adb: Likewise.
	* gnat.dg/elim2.adb: Likewise.
	* gnat.dg/enum1.adb: Likewise.
	* gnat.dg/enum2.adb: Likewise.
	* gnat.dg/env_compile_capacity.adb: Likewise.
	* gnat.dg/frunaligned.adb: Likewise.
	* gnat.dg/handle_raise_from_pure.adb: Likewise.
	* gnat.dg/iface2.adb: Likewise.
	* gnat.dg/layered_instance.adb: Likewise.
	* gnat.dg/limited_with.adb: Likewise.
	* gnat.dg/lto10.adb: Likewise.
	* gnat.dg/lto6.adb: Likewise.
	* gnat.dg/lto9.adb: Likewise.
	* gnat.dg/modular3.adb: Likewise.
	* gnat.dg/nat1r.adb: Likewise.
	* gnat.dg/opt9.adb: Likewise.
	* gnat.dg/overflow_sum2.adb: Likewise.
	* gnat.dg/overriding_ops.adb: Likewise.
	* gnat.dg/pack13.ads: Likewise.
	* gnat.dg/parent_ltd_with-child_full_view.adb: Likewise.
	* gnat.dg/pointer_discr1.adb: Likewise.
	* gnat.dg/pointer_protected.adb: Likewise.
	* gnat.dg/renaming3.adb: Likewise.
	* gnat.dg/slice6.adb: Likewise.
	* gnat.dg/slice8.adb: Likewise.
	* gnat.dg/slice8_pkg3.adb: Likewise.
	* gnat.dg/sort2.adb: Likewise.
	* gnat.dg/specs/root-level_1-level_2.ads: Likewise.
	* gnat.dg/specs/root-level_1.ads: Likewise.
	* gnat.dg/specs/root-level_2.ads: Likewise.
	* gnat.dg/test_address_null_init.adb: Likewise.
	* gnat.dg/test_allocator_maxalign2.adb: Likewise.
	* gnat.dg/test_debug1.adb: Likewise.
	* gnat.dg/test_dse_step.adb: Likewise.
	* gnat.dg/test_equal1.adb: Likewise.
	* gnat.dg/test_ifaces.adb: Likewise.
	* gnat.dg/test_nested_subtype_byref.adb: Likewise.
	* gnat.dg/test_oalign.adb: Likewise.
	* gnat.dg/test_oconst.adb: Likewise.
	* gnat.dg/test_prefix1.adb: Likewise.
	* gnat.dg/test_raise_from_pure.adb: Likewise.
	* gnat.dg/test_self.adb: Likewise.
	* gnat.dg/test_tables.adb: Likewise.
	* gnat.dg/test_tamdt.adb: Likewise.
	* gnat.dg/tree_static_use.adb: Likewise.
	* gnat.dg/volatile2.adb: Likewise.
Arnaud Charlet - Jan. 10, 2011, 4:08 p.m.
> Ok for mainline?

Sounds like you're introducing a heavy mechanism with a maintenance burden
for each new test.

We do not want to have to put an extra

-- { dg-final { cleanup-packages "Aggr16_Pkg" } }

at the end of almost each test: this should be done automatically IMO.

In other words, all tests that compile files will generate .ali and .o file,
so the clean up should be automatic/implicit rather than explicit, otherwise
new tests will suffer from the same issues.

Arno
Rainer Orth - Jan. 10, 2011, 4:20 p.m.
Arnaud Charlet <charlet@adacore.com> writes:

[Please keep me on the Cc:; it's easier for me not to overlook responses.]

>> Ok for mainline?
>
> Sounds like you're introducing a heavy mechanism with a maintenance burden
> for each new test.
>
> We do not want to have to put an extra
>
> -- { dg-final { cleanup-packages "Aggr16_Pkg" } }
>
> at the end of almost each test: this should be done automatically IMO.
>
> In other words, all tests that compile files will generate .ali and .o file,
> so the clean up should be automatic/implicit rather than explicit, otherwise
> new tests will suffer from the same issues.

This is not for every test, but only for those that use other packages.
For all others, it's already automatic.  Like you, I'd consider anything
else inappropriate.

I don't know if it's easy to deduce the list of used packages inside the
testsuite framework.  At the moment, this annotation is only necessary
for 58 out of 840 files in gnat.dg, which I wouldn't consider too heavy
a burden on the maintainers.  In fact, it took me quite some time to get
the lists right, especially in gnat.dg/specs.

If you have suggestions on how to automate this, I'd be happy to listen.

	Rainer
Arnaud Charlet - Jan. 10, 2011, 4:25 p.m.
> This is not for every test, but only for those that use other packages.
> For all others, it's already automatic.  Like you, I'd consider anything
> else inappropriate.

The problem is that the current infrastructure already is very unfriendly
to multiple file tests, so this change is making it a bit more unfriendly,
so that's not really going in the right direction unfortunately (and is
probably one of the reasons there are not more t ests in this category).

> I don't know if it's easy to deduce the list of used packages inside the
> testsuite framework.  At the moment, this annotation is only necessary
> for 58 out of 840 files in gnat.dg, which I wouldn't consider too heavy
> a burden on the maintainers.  In fact, it took me quite some time to get
> the lists right, especially in gnat.dg/specs.
> 
> If you have suggestions on how to automate this, I'd be happy to listen.

What about running each test under a separate temp dir (perhaps that's
already what's done?) and systematically suppressing *.o *.ali *.s *.gimple?

Arno
Rainer Orth - Jan. 10, 2011, 4:30 p.m.
Arnaud Charlet <charlet@adacore.com> writes:

>> This is not for every test, but only for those that use other packages.
>> For all others, it's already automatic.  Like you, I'd consider anything
>> else inappropriate.
>
> The problem is that the current infrastructure already is very unfriendly
> to multiple file tests, so this change is making it a bit more unfriendly,
> so that's not really going in the right direction unfortunately (and is
> probably one of the reasons there are not more t ests in this category).

That's true, unfortunately.  I'm experiencing the same when converting
boehm-gc to DejaGnu which has one test that needs a shared library to be
built separately.  Getting this (and the subsequent cleanup) done proved
unexpectedly hard.

>> I don't know if it's easy to deduce the list of used packages inside the
>> testsuite framework.  At the moment, this annotation is only necessary
>> for 58 out of 840 files in gnat.dg, which I wouldn't consider too heavy
>> a burden on the maintainers.  In fact, it took me quite some time to get
>> the lists right, especially in gnat.dg/specs.
>> 
>> If you have suggestions on how to automate this, I'd be happy to listen.
>
> What about running each test under a separate temp dir (perhaps that's
> already what's done?) and systematically suppressing *.o *.ali *.s *.gimple?

It's not: separate dirs are only used when when running the same tool
(gnat in this case) in parallel on separate distinct parts of the
testsuite.  I don't yet know how hard it would be to coerce DejaGnu to
do this.  As an alternative, is it possible to detect the list of
additional packages used by the package under test?  If so, this
information could easily be used for automatic cleanup.

	Rainer
Arnaud Charlet - Jan. 10, 2011, 4:40 p.m.
> It's not: separate dirs are only used when when running the same tool
> (gnat in this case) in parallel on separate distinct parts of the
> testsuite.  I don't yet know how hard it would be to coerce DejaGnu to
> do this.  As an alternative, is it possible to detect the list of
> additional packages used by the package under test?  If so, this
> information could easily be used for automatic cleanup.

You could probably use 'gnatclean -q <mainfile>' which would basically know
what files to clean up (at least for .o and .ali files), except that
fundamentally, if you're running all the tests under the same directory, you
may end up with race conditions if e.g. two tests use the same 'support'
package/file, and gnatclean is deleting the compilation artefacts of this
support package, while another gnatmake/test tries to use/reuse it.

I don't know if some tests are in this category today, although again,
with the current infrastructure, there's no way to prevent that.
If we don't have this conflict today, I guess we could try to enforce
this implicit rule, although being able to have tests filed and run under
separate directories would make things much easier in the medium term.

Arno
Rainer Orth - Jan. 10, 2011, 4:45 p.m.
Arnaud Charlet <charlet@adacore.com> writes:

>> It's not: separate dirs are only used when when running the same tool
>> (gnat in this case) in parallel on separate distinct parts of the
>> testsuite.  I don't yet know how hard it would be to coerce DejaGnu to
>> do this.  As an alternative, is it possible to detect the list of
>> additional packages used by the package under test?  If so, this
>> information could easily be used for automatic cleanup.
>
> You could probably use 'gnatclean -q <mainfile>' which would basically know
> what files to clean up (at least for .o and .ali files), except that

Fine, will give it a try.

> fundamentally, if you're running all the tests under the same directory, you
> may end up with race conditions if e.g. two tests use the same 'support'
> package/file, and gnatclean is deleting the compilation artefacts of this
> support package, while another gnatmake/test tries to use/reuse it.

That shouldn't be a problem: the tests are run sequentially inside a
single directory.  This might be an issue with the support files used by
ACATS, which in the current structure live in the support subdirectory,
while as I envision gnat.acats right now, all would live inside the flat
gnat directory used to run ACATS.  But I'll cross that bridge when I get
there.

> I don't know if some tests are in this category today, although again,
> with the current infrastructure, there's no way to prevent that.
> If we don't have this conflict today, I guess we could try to enforce
> this implicit rule, although being able to have tests filed and run under
> separate directories would make things much easier in the medium term.

On the source side, we can already do this today, i.e. create
subdirectories under gcc/testsuite/gnat.dg as needed and store files
there.  There's no need to have separate .exp files to have those tests
run.  They would still be built an run inside the same flat
gcc/testsuite/gnat directory as today.

	Rainer
Eric Botcazou - Jan. 11, 2011, 11:22 a.m.
> The problem is that the current infrastructure already is very unfriendly
> to multiple file tests, so this change is making it a bit more unfriendly,
> so that's not really going in the right direction unfortunately (and is
> probably one of the reasons there are not more tests in this category).

There are indeed far more tests in ada/acats/tests/gcc...  There are few such 
tests simply because we try and reduce testcases as much as possible.
Rainer Orth - Jan. 11, 2011, 11:28 a.m.
Eric Botcazou <ebotcazou@adacore.com> writes:

>> The problem is that the current infrastructure already is very unfriendly
>> to multiple file tests, so this change is making it a bit more unfriendly,
>> so that's not really going in the right direction unfortunately (and is
>> probably one of the reasons there are not more tests in this category).
>
> There are indeed far more tests in ada/acats/tests/gcc...  There are few such 
> tests simply because we try and reduce testcases as much as possible.

Speaking of which: now that we have gnat.dg, would there be any
objection to simply removing ada/acats/tests/gcc when converting ACATS
to DejaGnu/gnat.acts?  The only file in there, gcc/template.ada, is
currently unused and explicitly skipped by norun.lst.

Thanks.
	Rainer
Arnaud Charlet - Jan. 11, 2011, 12:03 p.m.
> > The problem is that the current infrastructure already is very
> > unfriendly
> > to multiple file tests, so this change is making it a bit more unfriendly,
> > so that's not really going in the right direction unfortunately (and is
> > probably one of the reasons there are not more tests in this category).
> 
> There are indeed far more tests in ada/acats/tests/gcc...  There are few
> such tests simply because we try and reduce testcases as much as possible.

Yes, but that's not always possible and when you do need multiple file tests,
it's such a pain that basically, it's an incentive not to put any test at
all.

The fact that several acats tests also require multiple files is indeed a
good sign that the current infrastructure isn't very friendly.

Arno
Laurent GUERBY - Jan. 11, 2011, 4:44 p.m.
On Tue, 2011-01-11 at 13:03 +0100, Arnaud Charlet wrote:
> > > The problem is that the current infrastructure already is very
> > > unfriendly
> > > to multiple file tests, so this change is making it a bit more unfriendly,
> > > so that's not really going in the right direction unfortunately (and is
> > > probably one of the reasons there are not more tests in this category).
> > 
> > There are indeed far more tests in ada/acats/tests/gcc...  There are few
> > such tests simply because we try and reduce testcases as much as possible.
> 
> Yes, but that's not always possible and when you do need multiple file tests,
> it's such a pain that basically, it's an incentive not to put any test at
> all.
> 
> The fact that several acats tests also require multiple files is indeed a
> good sign that the current infrastructure isn't very friendly.

ACATS also uses gnatchop, may be we could teach dejagnu
about gnatchop'ing, ie recognize file like "testname.ada"
and do "gnatchop testname.ada; gnatmake testname".

At least for compile or executable tests, non compile tests
might fail to gnatchop properly.

Laurent
Rainer Orth - Jan. 11, 2011, 5:10 p.m.
Laurent GUERBY <laurent@guerby.net> writes:

>> > There are indeed far more tests in ada/acats/tests/gcc...  There are few
>> > such tests simply because we try and reduce testcases as much as possible.
>> 
>> Yes, but that's not always possible and when you do need multiple file tests,
>> it's such a pain that basically, it's an incentive not to put any test at
>> all.
>> 
>> The fact that several acats tests also require multiple files is indeed a
>> good sign that the current infrastructure isn't very friendly.
>
> ACATS also uses gnatchop, may be we could teach dejagnu
> about gnatchop'ing, ie recognize file like "testname.ada"
> and do "gnatchop testname.ada; gnatmake testname".

That's the next step I plan for the ACATS to DejaGnu conversion.
Unfortunately, that doesn't help for the `cleanup after multiple file
test' part.

	Rainer
Eric Botcazou - Jan. 13, 2011, 8:14 p.m.
> Speaking of which: now that we have gnat.dg, would there be any
> objection to simply removing ada/acats/tests/gcc when converting ACATS
> to DejaGnu/gnat.acts?  The only file in there, gcc/template.ada, is
> currently unused and explicitly skipped by norun.lst.

Not by me, I already suggested to get rid of acats/tests/gcc some time ago.
Mike Stump - Feb. 18, 2011, 5:29 a.m.
On Jan 10, 2011, at 7:50 AM, Rainer Orth wrote:
> While working to convert ACATS to DejaGnu, I noticed a couple of issues
> in the gnat.dg testsuite (which ACATS/gnat.acats will be based on) that
> bear cleanup:

> Ok for mainline?


Ok.  Please watch for testsuite results by others on other platforms and ensure that we're in monotonically better land.  Please be responsive to such issues, since we're so near release.  If you would rather wait until we flip back into stage1, I'm fine with that.  If there is unexpected badness with the patch, I'll pre-appove the revision to unstick the tree as needed.

If the Ada people think this is a bad plan or bad timing, speak up; their opinion count higher than mine, as they will see and review more ada test results than I will.

Also, as work is done in this area, it would be nice to have a canadian cross tested with the patches along the way, to try and ensure we don't have regressions along that dimension.  I don't know if the current Ada test suite is canadian clean, but if it is, it is useful to preserve that.  I  tried to hand review the patches for canadian cleanliness, but...  that code is fickle and hard to stop failures sometime.  cleanup actions are the exact type of thing that I'd expect to fail, if you get it wrong.

Thanks.
Rainer Orth - Feb. 22, 2011, 4:52 p.m.
Mike Stump <mikestump@comcast.net> writes:

> On Jan 10, 2011, at 7:50 AM, Rainer Orth wrote:
>> While working to convert ACATS to DejaGnu, I noticed a couple of issues
>> in the gnat.dg testsuite (which ACATS/gnat.acats will be based on) that
>> bear cleanup:
>
>> Ok for mainline?
>
>
> Ok.  Please watch for testsuite results by others on other platforms and ensure that we're in monotonically better land.  Please be responsive to such issues, since we're so near release.  If you would rather wait until we flip back into stage1, I'm fine with that.  If there is unexpected badness with the patch, I'll pre-appove the revision to unstick the tree as needed.

Sure.  This patch has been completely safe in all my testing across various
platforms, so I don't expect anything bad to happen.

> If the Ada people think this is a bad plan or bad timing, speak up; their opinion count higher than mine, as they will see and review more ada test results than I will.

Indeed: given that Arnaud was ok with the general idea of the revised
patch, I've installed that one now.

> Also, as work is done in this area, it would be nice to have a canadian cross tested with the patches along the way, to try and ensure we don't have regressions along that dimension.  I don't know if the current Ada test suite is canadian clean, but if it is, it is useful to preserve that.  I  tried to hand review the patches for canadian cleanliness, but...  that code is fickle and hard to stop failures sometime.  cleanup actions are the exact type of thing that I'd expect to fail, if you get it wrong.

This is certainly an area that will need work, in gnat.dg and beyond.
While I'm clear on the general concepts, I haven't done cross testing
(simple or canadian) myself yet.  I fear the DejaGnu manual leaves much
to be desired on conceptual information in that area, and I'm unsure
what scenarios are expected to work for the GCC testsuites and which
aren't.  E.g. Joseph mentioned that in his experience testing only works
if build and host system have a shared filesystem.  I cannot tell if this
is by design or just an artefact.

	Rainer
Mike Stump - Feb. 22, 2011, 7:42 p.m.
On Feb 22, 2011, at 8:52 AM, Rainer Orth wrote:
> While I'm clear on the general concepts, I haven't done cross testing
> (simple or canadian) myself yet.  I fear the DejaGnu manual leaves much
> to be desired on conceptual information in that area, and I'm unsure
> what scenarios are expected to work for the GCC testsuites and which
> aren't.  E.g. Joseph mentioned that in his experience testing only works
> if build and host system have a shared filesystem.  I cannot tell if this
> is by design or just an artifact.

My take, recent bug, we have a long history of testing on cross and canadian cross situations and in general it works just fine.  Most of those bugs tend to be trivial to fix.  New suites and drivers (.exp) changes can easily blow cross testing however.

Patch

diff -r 100d9cbd86d5 gcc/doc/sourcebuild.texi
--- a/gcc/doc/sourcebuild.texi	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/doc/sourcebuild.texi	Sat Jan 08 12:29:02 2011 +0100
@@ -1,4 +1,4 @@ 
-@c Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+@c Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
 @c Free Software Foundation, Inc.
 @c This is part of the GCC manual.
 @c For copying conditions, see the file gcc.texi.
@@ -2087,6 +2087,9 @@ 
 @item cleanup-modules
 Removes Fortran module files generated for this test.
 
+@item cleanup-packages
+Removes output files from compiling Ada packages used by this test.
+
 @item cleanup-profile-file
 Removes profiling files generated for this test.
 
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/aggr11.adb
--- a/gcc/testsuite/gnat.dg/aggr11.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/aggr11.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -15,3 +15,5 @@ 
 begin
    null;
 end;
+
+-- { dg-final { cleanup-packages "Aggr11_Pkg" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/aggr16.adb
--- a/gcc/testsuite/gnat.dg/aggr16.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/aggr16.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -24,3 +24,5 @@ 
   end;
 
 end Aggr16;
+
+-- { dg-final { cleanup-packages "Aggr16_Pkg" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/array7.adb
--- a/gcc/testsuite/gnat.dg/array7.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/array7.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -20,3 +20,4 @@ 
 end Array7;
 
 -- { dg-final { scan-tree-dump-not "MAX_EXPR" "optimized" } }
+-- { dg-final { cleanup-tree-dump "optimized" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/assign_from_packed.adb
--- a/gcc/testsuite/gnat.dg/assign_from_packed.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/assign_from_packed.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -13,3 +13,5 @@ 
       raise Program_Error;
    end if;
 end;
+
+-- { dg-final { cleanup-packages "assign_from_packed_pixels" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/atomic1.adb
--- a/gcc/testsuite/gnat.dg/atomic1.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/atomic1.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -15,3 +15,5 @@ 
 
 -- { dg-final { scan-tree-dump-times "v_16" 1 "gimple"} }
 -- { dg-final { scan-tree-dump-times "v_32" 1 "gimple"} }
+-- { dg-final { cleanup-tree-dump "gimple" } }
+-- { dg-final { cleanup-packages "Atomic1_Pkg" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/check_elaboration_code.adb
--- a/gcc/testsuite/gnat.dg/check_elaboration_code.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/check_elaboration_code.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -7,3 +7,5 @@ 
       raise Program_Error;
    end if;
 end Check_Elaboration_Code;
+
+-- { dg-final { cleanup-packages "Bug_Elaboration_Code" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/constant2.adb
--- a/gcc/testsuite/gnat.dg/constant2.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/constant2.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -9,3 +9,5 @@ 
     raise Program_Error;
   end if;
 end;
+
+-- { dg-final { cleanup-packages "Constant2_Pkg1" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/conv_bug.adb
--- a/gcc/testsuite/gnat.dg/conv_bug.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/conv_bug.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -28,3 +28,5 @@ 
       when others => Put_Line ("Wrong Exception raised");
    end;
 end Conv_Bug;
+
+-- { dg-final { cleanup-packages "discr3" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/decl_ctx_use.adb
--- a/gcc/testsuite/gnat.dg/decl_ctx_use.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/decl_ctx_use.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -12,3 +12,5 @@ 
       raise X;
    end;
 end;
+
+-- { dg-final { cleanup-packages "DECL_CTX_Def" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/discr16.adb
--- a/gcc/testsuite/gnat.dg/discr16.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/discr16.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -21,3 +21,5 @@ 
 begin
   null;
 end;
+
+-- { dg-final { cleanup-packages "Discr16_Cont Discr16_G Discr16_Pkg" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/discr6.adb
--- a/gcc/testsuite/gnat.dg/discr6.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/discr6.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -31,3 +31,5 @@ 
 begin
   I := My_Q.X(A.V_E16);
 end;
+
+-- { dg-final { cleanup-packages "Discr6_Pkg" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/discr8.adb
--- a/gcc/testsuite/gnat.dg/discr8.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/discr8.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -36,3 +36,5 @@ 
   end Iteration;
 
 end Discr8;
+
+-- { dg-final { cleanup-packages "Discr8_Pkg1 Discr8_Pkg2" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/dispatch1.adb
--- a/gcc/testsuite/gnat.dg/dispatch1.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/dispatch1.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -7,3 +7,5 @@ 
 begin
    Ptr := new I1'Class'(I1'Class (O));
 end;
+
+-- { dg-final { cleanup-packages "dispatch1_p" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/elim2.adb
--- a/gcc/testsuite/gnat.dg/elim2.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/elim2.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -5,3 +5,5 @@ 
 begin
    null;
 end;
+
+-- { dg-final { cleanup-packages "elim1" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/enum1.adb
--- a/gcc/testsuite/gnat.dg/enum1.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/enum1.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -15,3 +15,5 @@ 
     raise Constraint_Error;
   end if;
 end;
+
+-- { dg-final { cleanup-packages "Enum1_Pkg" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/enum2.adb
--- a/gcc/testsuite/gnat.dg/enum2.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/enum2.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -9,3 +9,5 @@ 
 begin
   Table := (others => (others => Null_String));
 end;
+
+-- { dg-final { cleanup-packages "Enum2_Pkg" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/env_compile_capacity.adb
--- a/gcc/testsuite/gnat.dg/env_compile_capacity.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/env_compile_capacity.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -22,3 +22,5 @@ 
      Updated_Entity        => Updated_Entity,
      Entity_Upd_Iteration  => Iteration_Aerodrome_Arrival);
 end Env_Compile_Capacity;
+
+-- { dg-final { cleanup-packages "My_Env_Versioned_Value_Set_G" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/frunaligned.adb
--- a/gcc/testsuite/gnat.dg/frunaligned.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/frunaligned.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -6,3 +6,5 @@ 
 begin
    return ss.y;
 end;
+
+-- { dg-final { cleanup-packages "FRUnaligned1" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/handle_raise_from_pure.adb
--- a/gcc/testsuite/gnat.dg/handle_raise_from_pure.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/handle_raise_from_pure.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -9,3 +9,5 @@ 
 exception
    when others => Put_Line ("exception caught");
 end;
+
+-- { dg-final { cleanup-packages "Raise_From_Pure" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/iface2.adb
--- a/gcc/testsuite/gnat.dg/iface2.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/iface2.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -5,3 +5,5 @@ 
       null;
    end;
 end Iface2;
+
+-- { dg-final { cleanup-packages "Iface1" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/layered_instance.adb
--- a/gcc/testsuite/gnat.dg/layered_instance.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/layered_instance.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -9,3 +9,6 @@ 
 begin   
    null;   
 end;    
+
+-- { dg-final { cleanup-packages "layered_abstraction" } }
+-- { dg-final { cleanup-packages "Layered_Abstraction_P" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/limited_with.adb
--- a/gcc/testsuite/gnat.dg/limited_with.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/limited_with.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -7,3 +7,5 @@ 
       null;
    end;
 end limited_with;
+
+-- { dg-final { cleanup-packages "Pack1" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/loop_optimization6.adb
--- a/gcc/testsuite/gnat.dg/loop_optimization6.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/loop_optimization6.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -23,3 +23,4 @@ 
 end Loop_Optimization6;
 
 -- { dg-final { scan-tree-dump-not "goto" "optimized"} }
+-- { dg-final { cleanup-tree-dump "optimized" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/lto10.adb
--- a/gcc/testsuite/gnat.dg/lto10.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/lto10.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -12,3 +12,5 @@ 
       raise Program_Error;
    end if;
 end;
+
+-- { dg-final { cleanup-packages "Lto10_Pkg" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/lto6.adb
--- a/gcc/testsuite/gnat.dg/lto6.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/lto6.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -9,3 +9,5 @@ 
 begin
   Table := (others => (others => Null_String));
 end;
+
+-- { dg-final { cleanup-packages "Lto6_Pkg" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/lto9.adb
--- a/gcc/testsuite/gnat.dg/lto9.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/lto9.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -13,3 +13,5 @@ 
       Location => 1);
 
 end;
+
+-- { dg-final { cleanup-packages "Lto9_Pkg1" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/modular3.adb
--- a/gcc/testsuite/gnat.dg/modular3.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/modular3.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -30,3 +30,5 @@ 
   end if;
 
 end Modular3;
+
+-- { dg-final { cleanup-packages "Modular3_Pkg" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/nat1r.adb
--- a/gcc/testsuite/gnat.dg/nat1r.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/nat1r.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -9,3 +9,4 @@ 
       end if;
    end;
 
+-- { dg-final { cleanup-packages "NAT1" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/opt9.adb
--- a/gcc/testsuite/gnat.dg/opt9.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/opt9.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -24,3 +24,5 @@ 
 begin
    null;
 end;
+
+-- { dg-final { cleanup-packages "Opt9_Pkg" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/overflow_sum2.adb
--- a/gcc/testsuite/gnat.dg/overflow_sum2.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/overflow_sum2.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -30,3 +30,5 @@ 
   return 0;
 
 end;
+
+-- { dg-final { cleanup-packages "Namet" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/overriding_ops.adb
--- a/gcc/testsuite/gnat.dg/overriding_ops.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/overriding_ops.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -13,3 +13,5 @@ 
       end Set_Name;
    end Light;
 end overriding_ops;
+
+-- { dg-final { cleanup-packages "overriding_ops_p" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/pack13.adb
--- a/gcc/testsuite/gnat.dg/pack13.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/pack13.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -8,3 +8,5 @@ 
   end;
 
 end Pack13;
+
+-- { dg-final { cleanup-packages "Pack13_Pkg" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/parent_ltd_with-child_full_view.adb
--- a/gcc/testsuite/gnat.dg/parent_ltd_with-child_full_view.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/parent_ltd_with-child_full_view.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -10,3 +10,5 @@ 
    end New_Child_Symbol;
 
 end Parent_Ltd_With.Child_Full_View;
+
+-- { dg-final { cleanup-packages "Parent_Ltd_With" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/pointer_discr1.adb
--- a/gcc/testsuite/gnat.dg/pointer_discr1.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/pointer_discr1.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -7,3 +7,5 @@ 
 begin
   Pointer_Discr1_Pkg3.Map(Pointer_Discr1_Pkg1.Window(1));
 end;
+
+-- { dg-final { cleanup-packages "Pointer_Discr1_Pkg1" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/pointer_protected.adb
--- a/gcc/testsuite/gnat.dg/pointer_protected.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/pointer_protected.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -8,3 +8,5 @@ 
 begin
    Pointer.all (Data);
 end pointer_protected;
+
+-- { dg-final { cleanup-packages "pointer_protected_p" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/renaming3.adb
--- a/gcc/testsuite/gnat.dg/renaming3.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/renaming3.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -10,3 +10,5 @@ 
       raise Program_Error;
    end if;
 end;
+
+-- { dg-final { cleanup-packages "Renaming4" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/slice6.adb
--- a/gcc/testsuite/gnat.dg/slice6.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/slice6.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -21,3 +21,5 @@ 
 begin
   null;
 end;
+
+-- { dg-final { cleanup-packages "Slice6_Pkg" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/slice8.adb
--- a/gcc/testsuite/gnat.dg/slice8.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/slice8.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -11,3 +11,5 @@ 
 begin
    null;
 end;
+
+-- { dg-final { cleanup-packages "Slice8_Pkg1 Slice8_Pkg2" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/slice8_pkg3.adb
--- a/gcc/testsuite/gnat.dg/slice8_pkg3.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/slice8_pkg3.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -15,3 +15,5 @@ 
    end Get;
 
 end Slice8_Pkg3;
+
+-- { dg-final { cleanup-packages "Slice8_Pkg1 Slice8_Pkg2" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/sort2.adb
--- a/gcc/testsuite/gnat.dg/sort2.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/sort2.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -7,3 +7,5 @@ 
       raise Program_Error;
    end if;
 end sort2;
+
+-- { dg-final { cleanup-packages "sort1" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/specs/root-level_1-level_2.ads
--- a/gcc/testsuite/gnat.dg/specs/root-level_1-level_2.ads	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/specs/root-level_1-level_2.ads	Sat Jan 08 12:29:02 2011 +0100
@@ -5,3 +5,5 @@ 
      Level_1.Level_1_Type (First => First, Second => Second) with null record;
 
 end Root.Level_1.Level_2;
+
+-- { dg-final { cleanup-packages "Root Root.Level_1" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/specs/root-level_1.ads
--- a/gcc/testsuite/gnat.dg/specs/root-level_1.ads	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/specs/root-level_1.ads	Sat Jan 08 12:29:02 2011 +0100
@@ -12,3 +12,5 @@ 
    end record;
 
 end Root.Level_1;
+
+-- { dg-final { cleanup-packages "Root Root.Level_1" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/specs/root-level_2.ads
--- a/gcc/testsuite/gnat.dg/specs/root-level_2.ads	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/specs/root-level_2.ads	Sat Jan 08 12:29:02 2011 +0100
@@ -7,3 +7,5 @@ 
      Level_1.Level_1_Type (First => First, Second => Second) with null record;
 
 end Root.Level_2;
+
+-- { dg-final { cleanup-packages "Root Root.Level_1" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/test_address_null_init.adb
--- a/gcc/testsuite/gnat.dg/test_address_null_init.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/test_address_null_init.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -14,3 +14,5 @@ 
       Put_Line ("ERROR: A was not reinitialized to null!");
    end if;
 end Test_Address_Null_Init;
+
+-- { dg-final { cleanup-packages "Address_Null_Init" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/test_allocator_maxalign2.adb
--- a/gcc/testsuite/gnat.dg/test_allocator_maxalign2.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/test_allocator_maxalign2.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -6,3 +6,5 @@ 
 begin
    Allocator_Maxalign2.Check;
 end;
+
+-- { dg-final { cleanup-packages "Allocator_Maxalign2" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/test_debug1.adb
--- a/gcc/testsuite/gnat.dg/test_debug1.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/test_debug1.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -7,3 +7,5 @@ 
 begin
   null;
 end;
+
+-- { dg-final { cleanup-packages "debug1" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/test_dse_step.adb
--- a/gcc/testsuite/gnat.dg/test_dse_step.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/test_dse_step.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -12,3 +12,5 @@ 
       raise Program_Error;
    end if;
 end;
+
+-- { dg-final { cleanup-packages "Dse_Step" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/test_equal1.adb
--- a/gcc/testsuite/gnat.dg/test_equal1.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/test_equal1.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -11,3 +11,5 @@ 
   Status := equal1.Temporary_Disconnected;
   Result := Status /= equal1.Connected;
 end;
+
+-- { dg-final { cleanup-packages "equal1" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/test_ifaces.adb
--- a/gcc/testsuite/gnat.dg/test_ifaces.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/test_ifaces.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -8,3 +8,5 @@ 
    view2 := Iface_2'Class(obj)'Access;
    view2.all.op2;
 end;
+
+-- { dg-final { cleanup-packages "Ifaces" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/test_nested_subtype_byref.adb
--- a/gcc/testsuite/gnat.dg/test_nested_subtype_byref.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/test_nested_subtype_byref.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -6,3 +6,5 @@ 
 begin
    Nested_Subtype_Byref.Check;
 end;
+
+-- { dg-final { cleanup-packages "Nested_Subtype_Byref" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/test_oalign.adb
--- a/gcc/testsuite/gnat.dg/test_oalign.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/test_oalign.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -12,3 +12,5 @@ 
       raise Program_Error;
    end if;
 end;
+
+-- { dg-final { cleanup-packages "Oalign1 Oalign2" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/test_oconst.adb
--- a/gcc/testsuite/gnat.dg/test_oconst.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/test_oconst.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -11,3 +11,5 @@ 
   OCONST5.check (OCONST5.My_R0, 0);
   OCONST5.check (OCONST5.My_R1, 1);
 end;
+
+-- { dg-final { cleanup-packages "OCONST1 OCONST2 OCONST3 OCONST4 OCONST5" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/test_prefix1.adb
--- a/gcc/testsuite/gnat.dg/test_prefix1.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/test_prefix1.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -13,3 +13,5 @@ 
       end if;
    end loop;
 end test_prefix1;
+
+-- { dg-final { cleanup-packages "prefix1" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/test_raise_from_pure.adb
--- a/gcc/testsuite/gnat.dg/test_raise_from_pure.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/test_raise_from_pure.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -11,3 +11,5 @@ 
 begin
    K := Raise_CE_If_0 (0);
 end;
+
+-- { dg-final { cleanup-packages "Raise_From_Pure" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/test_self.adb
--- a/gcc/testsuite/gnat.dg/test_self.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/test_self.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -10,3 +10,5 @@ 
       Put_Line ("self-referential aggregate incorrectly built");
    end if; 
 end Test_Self;
+
+-- { dg-final { cleanup-packages "Self" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/test_tables.adb
--- a/gcc/testsuite/gnat.dg/test_tables.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/test_tables.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -9,3 +9,5 @@ 
 begin
    null;
 end;
+
+-- { dg-final { cleanup-packages "G_tables" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/test_tamdt.adb
--- a/gcc/testsuite/gnat.dg/test_tamdt.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/test_tamdt.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -6,3 +6,5 @@ 
 begin
    Tamdt.Check;
 end;
+
+-- { dg-final { cleanup-packages "Tamdt Tamdt_Aux" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/tree_static_use.adb
--- a/gcc/testsuite/gnat.dg/tree_static_use.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/tree_static_use.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -9,4 +9,4 @@ 
    check (I, 1);
 end;
 
-
+-- { dg-final { cleanup-packages "TREE_STATIC_Def" } }
diff -r 100d9cbd86d5 gcc/testsuite/gnat.dg/volatile2.adb
--- a/gcc/testsuite/gnat.dg/volatile2.adb	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/gnat.dg/volatile2.adb	Sat Jan 08 12:29:02 2011 +0100
@@ -20,3 +20,4 @@ 
 
 end volatile2;
 
+-- { dg-final { cleanup-packages "volatile1" } }
diff -r 100d9cbd86d5 gcc/testsuite/lib/gcc-dg.exp
--- a/gcc/testsuite/lib/gcc-dg.exp	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/lib/gcc-dg.exp	Sat Jan 08 12:29:02 2011 +0100
@@ -1,5 +1,5 @@ 
 #   Copyright (C) 1997, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-#   2010 Free Software Foundation, Inc.
+#   2010, 2011 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -547,6 +547,19 @@ 
     }
 }
 
+# Remove files for specified Ada packages.
+proc cleanup-packages { pkglist } {
+    foreach pkgname $pkglist {
+	set pkgbase [string tolower $pkgname]
+	# Account for package name mangling.
+	regsub -all "\\." $pkgbase "-" pkgbase
+	# Remove everything also removed by gnat-dg-test.
+	remove-build-file $pkgbase.ali
+	remove-build-file $pkgbase.s
+	remove-build-file $pkgbase.o
+    }
+}
+
 # Scan Fortran modules for a given regexp.
 #
 # Argument 0 is the module name
diff -r 100d9cbd86d5 gcc/testsuite/lib/gnat-dg.exp
--- a/gcc/testsuite/lib/gnat-dg.exp	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/lib/gnat-dg.exp	Sat Jan 08 12:29:02 2011 +0100
@@ -1,4 +1,4 @@ 
-# Copyright (C) 2006, 2007, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2007, 2010, 2011 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -22,7 +22,14 @@ 
   if { $do_what == "compile" } {
     lappend extra_tool_flags "-c"
   }
-  return [gcc-dg-test-1 gnat_target_compile $prog $do_what $extra_tool_flags]
+  set result [gcc-dg-test-1 gnat_target_compile $prog $do_what $extra_tool_flags]
+
+  set output_file [lindex $result 1]
+  set basename [file rootname $output_file]
+  # Remove additional output files apart from $output_file.
+  remote_file build delete $basename.ali $basename.o
+
+  return $result
 }
 
 proc gnat-dg-prune { system text } {
diff -r 100d9cbd86d5 gcc/testsuite/lib/gnat.exp
--- a/gcc/testsuite/lib/gnat.exp	Sat Jan 08 02:18:37 2011 +0100
+++ b/gcc/testsuite/lib/gnat.exp	Sat Jan 08 12:29:02 2011 +0100
@@ -1,4 +1,5 @@ 
-# Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
+# Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -20,10 +21,6 @@ 
 # This file is loaded by the tool init file (eg: unix.exp).  It provides
 # default definitions for gnat_start, etc. and other supporting cast members.
 
-# These globals are used if no compiler arguments are provided.
-# They are also used by the various testsuites to define the environment:
-# where to find stdio.h, libc.a, etc.
-
 load_lib libgloss.exp
 load_lib prune.exp
 load_lib gcc-defs.exp
@@ -54,10 +51,10 @@ 
 
     # verify that the compiler exists
     if { $compiler_name != 0 } then {
-	set tmp [remote_exec host "$compiler -v"]
+	set tmp [remote_exec host "$compiler --version"]
 	set status [lindex $tmp 0]
 	set output [lindex $tmp 1]
-	regexp " version \[^\n\r\]*" $output version
+	regexp "^GNATMAKE (\[^\n\r\]*)" $output verline version
 	if { $status == 0 && [info exists version] } then {
 	    clone_output "$compiler_name $version\n"
 	} else {
@@ -69,11 +66,17 @@ 
     }
 }
 
+#
+# gnat_version -- Call default_gnat_version, so we can override it if needed.
+#
+
+proc gnat_version { } {
+    default_gnat_version
+}
+
+#
 # gnat_init -- called at the start of each .exp script.
 #
-# There currently isn't much to do, but always using it allows us to
-# make some enhancements without having to go back and rewrite the scripts.
-#
 
 set gnat_initialized 0
 
@@ -85,7 +88,6 @@ 
     global gnat_initialized
     global GNAT_UNDER_TEST
     global TOOL_EXECUTABLE
-    global gnat_libgcc_s_path
     global gnat_target_current
 
     set gnat_target_current ""
@@ -103,23 +105,6 @@ 
     if ![info exists tmpdir] then {
 	set tmpdir /tmp
     }
-
-    set gnat_libgcc_s_path "${rootme}"
-    # Leave this here since Ada should support multilibs at some point.
-    set compiler [lindex $GNAT_UNDER_TEST 0]
-#    if { [is_remote host] == 0 && [which $compiler] != 0 } {
-#	foreach i "[exec $compiler --print-multi-lib]" {
-#	    set mldir ""
-#	    regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
-#	    set mldir [string trimright $mldir "\;@"]
-#	    if { "$mldir" == "." } {
-#		continue
-#	    }
-#	    if { [llength [glob -nocomplain ${rootme}/${mldir}/libgcc_s*.so.*]] >= 1 } {
-#		append gnat_libgcc_s_path ":${rootme}/${mldir}"
-#	    }
-#	}
-#    }
 }
 
 proc gnat_target_compile { source dest type options } {
@@ -129,8 +114,6 @@ 
     global srcdir
     global GNAT_UNDER_TEST
     global TOOL_OPTIONS
-    global ld_library_path
-    global gnat_libgcc_s_path
     global gnat_target_current
 
     # dg-require-effective-target tests must be compiled as C.
@@ -158,9 +141,11 @@ 
 	# specify via environment
 	setenv ADA_INCLUDE_PATH "$rtsdir/adainclude"
 	setenv ADA_OBJECTS_PATH "$rtsdir/adainclude"
+	# Always log so compilations can be repeated manually.
+	verbose -log "ADA_INCLUDE_PATH=$rtsdir/adainclude" 1
+	verbose -log "ADA_OBJECTS_PATH=$rtsdir/adainclude" 1
     }
 
-    set ld_library_path ".:${gnat_libgcc_s_path}"
     lappend options "compiler=$GNAT_UNDER_TEST -q -f"
     lappend options "timeout=[timeout_value]"
 
@@ -175,71 +160,9 @@ 
 	set options [concat "additional_flags=$TOOL_OPTIONS" $options]
     }
 
-    # If we have built libada along with the compiler, point the test harness
-    # at it (and associated headers).
-
-#    set sourcename [string range $source 0 [expr [string length $source] - 5]]
-#    set dest ""
-
     return [target_compile $source $dest $type $options]
 }
 
-#
-# gnat_pass -- utility to record a testcase passed
-#
-
-proc gnat_pass { testcase cflags } {
-    if { "$cflags" == "" } {
-	pass "$testcase"
-    } else {
-	pass "$testcase, $cflags"
-    }
-}
-
-#
-# gnat_fail -- utility to record a testcase failed
-#
-
-proc gnat_fail { testcase cflags } {
-    if { "$cflags" == "" } {
-	fail "$testcase"
-    } else {
-	fail "$testcase, $cflags"
-    }
-}
-
-#
-# gnat_finish -- called at the end of every .exp script that calls gnat_init
-#
-# The purpose of this proc is to hide all quirks of the testing environment
-# from the testsuites.  It also exists to undo anything that gnat_init did
-# (that needs undoing).
-#
-
-proc gnat_finish { } {
-    # The testing harness apparently requires this.
-    global errorInfo
-
-    if [info exists errorInfo] then {
-	unset errorInfo
-    }
-
-    # Might as well reset these (keeps our caller from wondering whether
-    # s/he has to or not).
-    global prms_id bug_id
-    set prms_id 0
-    set bug_id 0
-}
-
-proc gnat_exit { } {
-    global gluefile
-
-    if [info exists gluefile] {
-	file_on_build delete $gluefile
-	unset gluefile
-    }
-}
-
 # Prune messages from GNAT that aren't useful.
 
 proc prune_gnat_output { text } {
@@ -272,19 +195,19 @@ 
     if ![is_remote host] {
         set file [lookfor_file $tool_root_dir gnatmake]
         if { $file == "" } {
-    	set file [lookfor_file $tool_root_dir gcc/gnatmake]
+	    set file [lookfor_file $tool_root_dir gcc/gnatmake]
         }
         if { $file != "" } {
-    	set root [file dirname $file]
-	# Need to pass full --GCC, including multilib flags, to gnatlink,
-	# otherwise gcc from PATH is invoked.
-	set dest [target_info name]
-	set gnatlink_gcc "--GCC=$root/xgcc -B$root [board_info $dest multilib_flags]"
-	# Escape blanks to get them through DejaGnu's exec machinery.
-	regsub -all {\s} "$gnatlink_gcc" {\\&} gnatlink_gcc
-    	set CC "$file --GCC=$root/xgcc --GNATBIND=$root/gnatbind --GNATLINK=$root/gnatlink -cargs -B$root -largs $gnatlink_gcc -margs";
+	    set root [file dirname $file]
+	    # Need to pass full --GCC, including multilib flags, to gnatlink,
+	    # otherwise gcc from PATH is invoked.
+	    set dest [target_info name]
+	    set gnatlink_gcc "--GCC=$root/xgcc -B$root [board_info $dest multilib_flags]"
+	    # Escape blanks to get them through DejaGnu's exec machinery.
+	    regsub -all {\s} "$gnatlink_gcc" {\\&} gnatlink_gcc
+	    set CC "$file --GCC=$root/xgcc --GNATBIND=$root/gnatbind --GNATLINK=$root/gnatlink -cargs -B$root -largs $gnatlink_gcc -margs";
         } else {
-    	set CC [transform gnatmake]
+	    set CC [transform gnatmake]
         }
     } else {
         set CC [transform gnatmake]