From patchwork Fri Oct 16 08:08:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 55084 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id 54B8E22FFA for ; Fri, 16 Oct 2015 08:11:05 +0000 (UTC) Received: by lbbms9 with SMTP id ms9sf21540843lbb.3 for ; Fri, 16 Oct 2015 01:11:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:mime-version:date:message-id:subject:from:to :content-type:x-original-sender:x-original-authentication-results; bh=3dHi8BLbG2bKG6XbhmWoimUa9Lotx2E6EDXEoFcrpD4=; b=VKoWqNaB9TDVRPgQ8itk4I/+A4cgLrzKofCs5vOcaxSxkyLrY9IOcBfG7fPDt45bG4 fc93rMiK89UN8A6NeGe6s77uK9pKlRXxTynsm8wKpmA/t1jxANBREAy4pP+59WYmRjjG 6olvLXtUVX5RXZzHTBA8Aej+14PKoJsM6tlpo97+NvEPfWG1ZrcYZ3y9dYjYFSWiR8VN TsqQJ9F6mEu3lwLLgL/O1z4HK4dKVyvHc11BXXHFyqdiRY/nDbxoE3nvMb2przqPptrp NlApO+L6kV1v+4WH2Gtl9OhgnvhWlgLsIJlNgv3WkaA+48jPRzG1PAI+ozubaQzZueyp GE8w== X-Gm-Message-State: ALoCoQnohlhwsA3OQJyHPWCWeZUe5ncfu0QzgK2XfiHePmAGT0ihlJ9D8JE0hDgr+VrGS/2vrRdw X-Received: by 10.180.208.7 with SMTP id ma7mr771530wic.5.1444983064108; Fri, 16 Oct 2015 01:11:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.153.65 with SMTP id b62ls258622lfe.57.gmail; Fri, 16 Oct 2015 01:11:03 -0700 (PDT) X-Received: by 10.112.14.9 with SMTP id l9mr7514828lbc.91.1444983063943; Fri, 16 Oct 2015 01:11:03 -0700 (PDT) Received: from mail-lb0-x22f.google.com (mail-lb0-x22f.google.com. [2a00:1450:4010:c04::22f]) by mx.google.com with ESMTPS id qd5si12089776lbb.83.2015.10.16.01.11.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Oct 2015 01:11:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22f as permitted sender) client-ip=2a00:1450:4010:c04::22f; Received: by lbbes7 with SMTP id es7so4399236lbb.2 for ; Fri, 16 Oct 2015 01:11:03 -0700 (PDT) X-Received: by 10.112.17.34 with SMTP id l2mr7490076lbd.117.1444983063759; Fri, 16 Oct 2015 01:11:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1098935lbq; Fri, 16 Oct 2015 01:11:02 -0700 (PDT) X-Received: by 10.66.222.70 with SMTP id qk6mr15105643pac.68.1444983062375; Fri, 16 Oct 2015 01:11:02 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id hm17si28005412pad.218.2015.10.16.01.11.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Oct 2015 01:11:02 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-410319-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 108528 invoked by alias); 16 Oct 2015 08:10:40 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 108512 invoked by uid 89); 16 Oct 2015 08:10:39 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL, BAYES_20 autolearn=ham version=3.3.2 X-HELO: mail-qk0-f176.google.com Received: from Unknown (HELO mail-qk0-f176.google.com) (209.85.220.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 16 Oct 2015 08:08:38 +0000 Received: by qkap81 with SMTP id p81so50984557qka.2 for ; Fri, 16 Oct 2015 01:08:30 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.55.42.73 with SMTP id q70mr17507723qkh.22.1444982910504; Fri, 16 Oct 2015 01:08:30 -0700 (PDT) Received: by 10.140.44.10 with HTTP; Fri, 16 Oct 2015 01:08:30 -0700 (PDT) Date: Fri, 16 Oct 2015 10:08:30 +0200 Message-ID: Subject: [testsuite] Fix potential race conditions in gfortran tests From: Christophe Lyon To: "gcc-patches@gcc.gnu.org" , Maxim Kuvyrkov X-IsSubscribed: yes X-Original-Sender: christophe.lyon@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22f as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 Hi, We have noticed a few random failures in gfortran tests in our validations. Maxim investigated some of them and noticed a possible race condition in the streamio tests, for which he'll post a patch. I looked for other similar cases (checking which files are unlinked several times during 'make check'), and noticed that a few other cases might read/write/delete the same file concurrently. The proposed fix is to use different names for the different testcases. I ran make check -jX on various ARM/AArch64 configuration with no regression. OK? Christophe. 2015-10-16 Christophe Lyon * gfortran.dg/chmod_1.f90: Add suffix to the temporary filename to make it unique per testcase. * gfortran.dg/chmod_2.f90: Likewise. * gfortran.dg/chmod_3.f90: Likewise. * gfortran.dg/direct_io_8.f90: Likewise. * gfortran.dg/f2003_inquire_1.f03: Likewise. * gfortran.dg/f2003_io_1.f03: Likewise. * gfortran.dg/f2003_io_2.f03: Likewise. * gfortran.dg/f2003_io_8.f03: Likewise. * gfortran.dg/inquire_size.f90: Likewise. * gfortran.dg/namelist_66.f90: Likewise. * gfortran.dg/namelist_82.f90: Likewise. * gfortran.dg/namelist_87.f90: Likewise. * gfortran.dg/open_negative_unit_1.f90: Likewise. * gfortran.dg/open_new.f90: Likewise. * gfortran.dg/stat_1.f90: Likewise. * gfortran.dg/stat_2.f90: Likewise. * gfortran.dg/streamio_15.f90: Likewise. * gfortran.dg/unf_read_corrupted_1.f90: Likewise. diff --git a/gcc/testsuite/gfortran.dg/chmod_1.f90 b/gcc/testsuite/gfortran.dg/chmod_1.f90 index 07760cf..452b333 100644 --- a/gcc/testsuite/gfortran.dg/chmod_1.f90 +++ b/gcc/testsuite/gfortran.dg/chmod_1.f90 @@ -2,7 +2,7 @@ ! { dg-options "-std=gnu" } ! See PR38956. Test fails on cygwin when user has Administrator rights implicit none - character(len=*), parameter :: n = "foobar_file" + character(len=*), parameter :: n = "foobar_file_chmod_1" integer :: i open (10,file=n) diff --git a/gcc/testsuite/gfortran.dg/chmod_2.f90 b/gcc/testsuite/gfortran.dg/chmod_2.f90 index 3e5ed61..68ff17d 100644 --- a/gcc/testsuite/gfortran.dg/chmod_2.f90 +++ b/gcc/testsuite/gfortran.dg/chmod_2.f90 @@ -2,7 +2,7 @@ ! { dg-options "-std=gnu" } ! See PR38956. Test fails on cygwin when user has Administrator rights implicit none - character(len=*), parameter :: n = "foobar_file" + character(len=*), parameter :: n = "foobar_file_chmod_2" integer :: i open (10,file=n) diff --git a/gcc/testsuite/gfortran.dg/chmod_3.f90 b/gcc/testsuite/gfortran.dg/chmod_3.f90 index 9e92eca..5df7528 100644 --- a/gcc/testsuite/gfortran.dg/chmod_3.f90 +++ b/gcc/testsuite/gfortran.dg/chmod_3.f90 @@ -2,7 +2,7 @@ ! { dg-options "-std=gnu -fdefault-integer-8" } ! See PR38956. Test fails on cygwin when user has Administrator rights implicit none - character(len=*), parameter :: n = "foobar_file" + character(len=*), parameter :: n = "foobar_file_chmod_3" integer :: i open (10,file=n) diff --git a/gcc/testsuite/gfortran.dg/direct_io_8.f90 b/gcc/testsuite/gfortran.dg/direct_io_8.f90 index 5e384a1..87a8a6b 100644 --- a/gcc/testsuite/gfortran.dg/direct_io_8.f90 +++ b/gcc/testsuite/gfortran.dg/direct_io_8.f90 @@ -7,7 +7,7 @@ program main i=44 ir = -42 - open(11,file="foo.dat") + open(11,file="foo_direct_io_8.dat") ! Try a direct access read on a formatted sequential rile READ (11, REC = I, ERR = 99) TEMP_CHANGES call abort diff --git a/gcc/testsuite/gfortran.dg/f2003_inquire_1.f03 b/gcc/testsuite/gfortran.dg/f2003_inquire_1.f03 index 544a810..87ddf59 100644 --- a/gcc/testsuite/gfortran.dg/f2003_inquire_1.f03 +++ b/gcc/testsuite/gfortran.dg/f2003_inquire_1.f03 @@ -4,7 +4,7 @@ character(25) :: sround, ssign, sasynchronous, sdecimal, sencoding integer :: vsize, vid logical :: vpending -open(10, file='mydata', asynchronous="yes", blank="null", & +open(10, file='mydata_f2003_inquire_1', asynchronous="yes", blank="null", & & decimal="comma", encoding="utf-8", sign="plus") inquire(unit=10, round=sround, sign=ssign, size=vsize, id=vid, & diff --git a/gcc/testsuite/gfortran.dg/f2003_io_1.f03 b/gcc/testsuite/gfortran.dg/f2003_io_1.f03 index f1d67c5..2a2294f 100644 --- a/gcc/testsuite/gfortran.dg/f2003_io_1.f03 +++ b/gcc/testsuite/gfortran.dg/f2003_io_1.f03 @@ -8,7 +8,7 @@ character(25) :: msg a = 23.45 b = 0.0 -open(10, file='mydata', asynchronous="yes", blank="null") +open(10, file='mydata_f2003_io_1', asynchronous="yes", blank="null") write(10,'(10f8.3)', asynchronous="yes", decimal="comma", id=j) a rewind(10) diff --git a/gcc/testsuite/gfortran.dg/f2003_io_2.f03 b/gcc/testsuite/gfortran.dg/f2003_io_2.f03 index 54c0516..599eb5b 100644 --- a/gcc/testsuite/gfortran.dg/f2003_io_2.f03 +++ b/gcc/testsuite/gfortran.dg/f2003_io_2.f03 @@ -7,7 +7,7 @@ character(25) :: msg real, dimension(10) :: a, b a = 43.21 -open(10, file='mydata', asynchronous="yes") +open(10, file='mydata_f2003_io_2', asynchronous="yes") write(10,'(10f8.3)', asynchronous="yes", decimal="comma") a rewind(10) read(10,'(10f8.3)', asynchronous="yes", decimal="comma", id=idvar) b diff --git a/gcc/testsuite/gfortran.dg/f2003_io_8.f03 b/gcc/testsuite/gfortran.dg/f2003_io_8.f03 index 2362697..4d2f002 100644 --- a/gcc/testsuite/gfortran.dg/f2003_io_8.f03 +++ b/gcc/testsuite/gfortran.dg/f2003_io_8.f03 @@ -6,7 +6,7 @@ real :: c integer :: istat, j character(25) :: msg -open(10, file='mydata', asynchronous="yes", blank="null") +open(10, file='mydata_f2003_io_8', asynchronous="yes", blank="null") write(10,'(10f8.3)', asynchronous='no', decimal="comma", id=j) a ! { dg-error "must be with ASYNCHRONOUS=" } read(10,'(10f8.3)', id=j, decimal="comma", blank="zero") b ! { dg-error "must be with ASYNCHRONOUS=" } read(10,'(10f8.3)', asynchronous=msg, decimal="comma", blank="zero") b ! { dg-error "must be an initialization expression" } diff --git a/gcc/testsuite/gfortran.dg/inquire_size.f90 b/gcc/testsuite/gfortran.dg/inquire_size.f90 index 13876cf..ce2db48 100644 --- a/gcc/testsuite/gfortran.dg/inquire_size.f90 +++ b/gcc/testsuite/gfortran.dg/inquire_size.f90 @@ -4,7 +4,7 @@ integer :: i character(30) :: aname = "noname" logical :: is_named -open(25, file="testfile", status="replace", access="stream", form="unformatted") +open(25, file="testfile_inquire_size", status="replace", access="stream", form="unformatted") do i=1,100 write(25) i, "abcdefghijklmnopqrstuvwxyz" enddo @@ -14,16 +14,16 @@ enddo inquire(unit=25, named=is_named, name=aname, size=i) if (.not.is_named) call abort -if (aname /= "testfile") call abort +if (aname /= "testfile_inquire_size") call abort if (i /= 3000) call abort -inquire(file="testfile", size=i) +inquire(file="testfile_inquire_size", size=i) if (.not.is_named) call abort -if (aname /= "testfile") call abort +if (aname /= "testfile_inquire_size") call abort if (i /= 3000) call abort close(25, status="delete") -inquire(file="testfile", size=i) +inquire(file="testfile_inquire_size", size=i) if (i /= -1) call abort end diff --git a/gcc/testsuite/gfortran.dg/namelist_66.f90 b/gcc/testsuite/gfortran.dg/namelist_66.f90 index d779ea7..436304e 100644 --- a/gcc/testsuite/gfortran.dg/namelist_66.f90 +++ b/gcc/testsuite/gfortran.dg/namelist_66.f90 @@ -17,7 +17,7 @@ end type qptracer type(qptracer) , dimension(3) :: qtracer namelist/naml2/ qtracer -open (99, file='nml.dat', status="replace") +open (99, file='nml_66.dat', status="replace") write(99,*) "&naml1" write(99,*) " tracer(1) = 'aa', .true." write(99,*) " tracer(2) = 'bb', .true." diff --git a/gcc/testsuite/gfortran.dg/namelist_82.f90 b/gcc/testsuite/gfortran.dg/namelist_82.f90 index 399d59f..aae700f 100644 --- a/gcc/testsuite/gfortran.dg/namelist_82.f90 +++ b/gcc/testsuite/gfortran.dg/namelist_82.f90 @@ -10,7 +10,7 @@ namelist/naml1/ tracer tracer(:) = ptracer('XXX', .false.) -open (99, file='nml.dat', status="replace") +open (99, file='nml_82.dat', status="replace") write(99,*) "&naml1" !write(99,*) " tracer(2) = 'bb' , .true." write(99,*) " tracer(:) = 'aa' , .true." diff --git a/gcc/testsuite/gfortran.dg/namelist_87.f90 b/gcc/testsuite/gfortran.dg/namelist_87.f90 index 8528a5c..c19d106 100644 --- a/gcc/testsuite/gfortran.dg/namelist_87.f90 +++ b/gcc/testsuite/gfortran.dg/namelist_87.f90 @@ -30,7 +30,7 @@ character(3) :: c2 = 'YYY' character(3) :: c3 = 'ZZZ' namelist /nml/ i, r1,r2,r3,r4,r5,c,ll,c1,c2,c3 -open (99, file='nml.dat', status="replace") +open (99, file='nml_87.dat', status="replace") write(99,*) "&nml" write(99,*) " i=42!11" ! Fixed BUG: wrong result: Unmodified, no error write(99,*) " r1=43!11" ! Fixed BUG: wrong result: Unmodified, no error diff --git a/gcc/testsuite/gfortran.dg/open_negative_unit_1.f90 b/gcc/testsuite/gfortran.dg/open_negative_unit_1.f90 index bbcf46b..93ea1f1 100644 --- a/gcc/testsuite/gfortran.dg/open_negative_unit_1.f90 +++ b/gcc/testsuite/gfortran.dg/open_negative_unit_1.f90 @@ -9,7 +9,7 @@ program nutest logical l integer id, ios - open(newunit=id, file="foo.txt", iostat=ios) + open(newunit=id, file="foo_open_negative_unit_1.txt", iostat=ios) if (ios /= 0) call abort open(id, file="bar.txt", iostat=ios) @@ -17,14 +17,14 @@ program nutest close(id, status="delete") - open(unit=10, file="foo.txt", status="old", iostat=ios) + open(unit=10, file="foo_open_negative_unit_1.txt", status="old", iostat=ios) if (ios /= 0) call abort close(10, status="delete") - open(-10, file="foo.txt", iostat=ios) + open(-10, file="foo_open_negative_unit_1.txt", iostat=ios) if (ios == 0) call abort - inquire(file="foo.txt", exist=l) + inquire(file="foo_open_negative_unit_1.txt", exist=l) if (l) call abort end program nutest diff --git a/gcc/testsuite/gfortran.dg/open_new.f90 b/gcc/testsuite/gfortran.dg/open_new.f90 index 96edd93..6f36ca0 100644 --- a/gcc/testsuite/gfortran.dg/open_new.f90 +++ b/gcc/testsuite/gfortran.dg/open_new.f90 @@ -3,9 +3,9 @@ ! status="new" is an error program main nout = 10 - open(nout, file="foo.dat", status="replace") ! make sure foo.dat exists + open(nout, file="foo_open_new.dat", status="replace") ! make sure foo_open_new.dat exists close(nout) - open(nout, file="foo.dat", status="new",err=100) + open(nout, file="foo_open_new.dat", status="new",err=100) call abort ! This should never happen -100 call unlink ("foo.dat") +100 call unlink ("foo_open_new.dat") end program main diff --git a/gcc/testsuite/gfortran.dg/stat_1.f90 b/gcc/testsuite/gfortran.dg/stat_1.f90 index 95ad66a..ec582f9 100644 --- a/gcc/testsuite/gfortran.dg/stat_1.f90 +++ b/gcc/testsuite/gfortran.dg/stat_1.f90 @@ -1,7 +1,7 @@ ! { dg-do run } ! { dg-skip-if "" { *-*-mingw* spu-*-* } { "*" } { "" } } ! { dg-options "-std=gnu" } - character(len=*), parameter :: f = "testfile" + character(len=*), parameter :: f = "testfile_stat_1" integer :: s1(13), r1, s2(13), r2, s3(13), r3, d(13), rd open (10,file=f) diff --git a/gcc/testsuite/gfortran.dg/stat_2.f90 b/gcc/testsuite/gfortran.dg/stat_2.f90 index a530ec3..a3eb6b2 100644 --- a/gcc/testsuite/gfortran.dg/stat_2.f90 +++ b/gcc/testsuite/gfortran.dg/stat_2.f90 @@ -1,7 +1,7 @@ ! { dg-do run } ! { dg-skip-if "" { *-*-mingw* spu-*-* } { "*" } { "" } } ! { dg-options "-std=gnu" } - character(len=*), parameter :: f = "testfile" + character(len=*), parameter :: f = "testfile_stat_2" integer :: s1(13), r1, s2(13), r2, s3(13), r3, d(13), rd open (10,file=f) diff --git a/gcc/testsuite/gfortran.dg/streamio_15.f90 b/gcc/testsuite/gfortran.dg/streamio_15.f90 index bbe91f1..eee59a4 100644 --- a/gcc/testsuite/gfortran.dg/streamio_15.f90 +++ b/gcc/testsuite/gfortran.dg/streamio_15.f90 @@ -13,7 +13,7 @@ program main if (newline_length < 1 .or. newline_length > 2) call abort close(20) - open(20,file="foo.txt",form="formatted",access="stream") + open(20,file="foo_streamio_15.txt",form="formatted",access="stream") write(20,'(A)') '123456' write(20,'(A)') 'abcdef' write(20,'(A)') 'qwerty' diff --git a/gcc/testsuite/gfortran.dg/unf_read_corrupted_1.f90 b/gcc/testsuite/gfortran.dg/unf_read_corrupted_1.f90 index e7bb441..1cf879b 100644 --- a/gcc/testsuite/gfortran.dg/unf_read_corrupted_1.f90 +++ b/gcc/testsuite/gfortran.dg/unf_read_corrupted_1.f90 @@ -10,13 +10,13 @@ program main ! Write out a truncated unformatted sequential file by ! using unformatted stream. - open (10, form="unformatted", access="stream", file="foo.dat", & + open (10, form="unformatted", access="stream", file="foo_unf_read_corrupted_1.dat", & status="unknown") write (10) 16_4, 1_4 close (10, status="keep") ! Try to read - open (10, file="foo.dat", form="unformatted", access="sequential") + open (10, file="foo_unf_read_corrupted_1.dat", form="unformatted", access="sequential") i1 = 0 i2 = 0 read (10, iostat=ios, iomsg=msg) i1, i2