This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Removing an output file when test case has terminate


On 03/29/2015 04:50 AM, Janne Blomqvist wrote:
On Sun, Mar 29, 2015 at 2:28 PM, Thomas Koenig <tkoenig@netcologne.de> wrote:
I want to add a test case to the gfortran testsuite for PR 65563.
If all goes right, running the test case will

a) terminate the program with an error message (to be checked for)

b) create a file, which needs to be cleaned up after the test case
    is run.

a) is clear, but how do I do b)?  I haven't found anything in the
list of dg-final actions for this.  (Due to the specifics of the test
case, I also cannot name my file "foo.mod" and let the automatic module
cleanup do the job for me :-)

Any ideas?

What I did for PR 64770, were the testcase created a file
"pr64770test.dat", was to add a line

! { dg-final { remote_file build delete "pr64770test.dat" } }

to the end of the testcase. See gfortran.dg/open_new_segv.f90 for the
whole testcase.

Don't know if this is the correct way to do it, but it seems to work.



You can also try:

open(10, status="scratch")

It will be deleted when closed. Also on failed test, instead of calling abort, use STOP 500 or similar. STOP will close files.

Jerry


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]