Hi Igor,

after our push I see test/java/io/File/GetXSpace.java failing on our Windows 
test machines. The issue seems to be that the 'df' call produces several lines 
of output on my windows machine and the pattern uses \n as line-ending. 

In a short test I changed the regex to match $ instead of  \n in the end and 
added the MULTILINE flag. 

--------------------------------------------------------------------------
diff -r 16625b2b71f7 test/jdk/java/io/File/GetXSpace.java
--- a/test/jdk/java/io/File/GetXSpace.java      Tue Aug 11 07:29:45 2020 -0400
+++ b/test/jdk/java/io/File/GetXSpace.java      Tue Aug 11 15:35:15 2020 +0200
@@ -55,7 +55,7 @@
     private static final boolean IS_WIN = OS_NAME.startsWith("Windows");

     // FileSystem Total Used Available Use% MountedOn
-    private static final Pattern DF_PATTERN = 
Pattern.compile("([^\\s]+)\\s+(\\d+)\\s+\\d+\\s+(\\d+)\\s+\\d+%\\s+([^\\s].*)\n");
+    private static final Pattern DF_PATTERN = 
Pattern.compile("([^\\s]+)\\s+(\\d+)\\s+\\d+\\s+(\\d+)\\s+\\d+%\\s+([^\\s].*)$",
 Pattern.MULTILINE);

     private static int fail = 0;
     private static int pass = 0;
--------------------------------------------------------------------------

Now the test passes for me and in our infrastructure. I did not completely 
understand why the old pattern did loose the first character in the line - but 
this seems to fix the issue.

Before my change:
----------System.out:(24/869)----------
--- Testing df
C:/cygwin64      998257472 664791328 333466144      67% /
K:               262144000 129993392 132150608      50% /cygdrive/k
O:               734003200 641218112  92785088      88% /cygdrive/o


SecurityManager = null
C:/cygwin64:
  df   total= 1022215651328 free =            0 usable = 341469331456
  getX total= 1022215651328 free = 341469323264 usable = 341469323264
::
  df   total= 268435456000 free =            0 usable = 135322222592
  getX total=            0 free =            0 usable =            0
FAILED


After my change:
--- Testing df
C:/cygwin64      998257472 665305100 332952372      67% /
K:               262144000 129993392 132150608      50% /cygdrive/k
O:               734003200 641211140  92792060      88% /cygdrive/o


SecurityManager = null
C:/cygwin64:
  df   total= 1022215651328 free =            0 usable = 340943228928
  getX total= 1022215651328 free = 340943286272 usable = 340943286272
K::
  df   total= 268435456000 free =            0 usable = 135322222592
  getX total= 268435456000 free = 135322222592 usable = 135322222592
O::
  df   total= 751619276800 free =            0 usable =  95019069440
  getX total= 751619276800 free =  95019069440 usable =  95019069440
...
------------------------------------------


The drives K: and O: are mapped network drives.
Do you see something similar in your landscape? Can you perhaps try to 
reproduce this?

Best regards,
Arno

> -----Original Message-----
> From: core-libs-dev <core-libs-dev-r...@openjdk.java.net> On Behalf Of Igor
> Ignatyev
> Sent: Freitag, 31. Juli 2020 04:45
> To: Brian Burkhalter <brian.burkhal...@oracle.com>
> Cc: core-libs-dev <core-libs-dev@openjdk.java.net>
> Subject: Re: [15] RFR(S) : 6501010 : test/java/io/File/GetXSpace.java fails on
> Windows
> 
> Hi Brian,
> 
> thanks for your review. I've decided to push into jdk/jdk instead of jdk15.
> please let me know if you think this patch needs to be in jdk15, and I'll 
> backport
> it there.
> 
> Cheers,
> -- Igor
> 
> > On Jul 30, 2020, at 2:39 PM, Brian Burkhalter
> <brian.burkhal...@oracle.com> wrote:
> >
> > Hi Igor,
> >
> > This test looks all right to me.
> >
> > Sorry for the late review.
> >
> > Thanks,
> >
> > Brian
> >
> >> On Jul 20, 2020, at 11:28 AM, Igor Ignatyev <igor.ignat...@oracle.com
> <mailto:igor.ignat...@oracle.com>> wrote:
> >>
> >> http://cr.openjdk.java.net/~iignatyev//6501010/webrev.00
> <http://cr.openjdk.java.net/~iignatyev//6501010/webrev.00>
> >>> 98 lines changed: 18 ins; 31 del; 49 mod;
> >>
> >> Hi all,
> >>
> >> could you please review this small fix to make java/io/File/GetXSpace.java
> work again on windows?
> >>
> >> the test has been updated to work under cygwin, which includes the
> following changes:
> >> - GetXSpace.sh accepts CYGWIN_* as known OS and sets windows path to
> TMP var
> >> - uses the same regexp to parse df on windows as on other platforms
> >> - but uses 'FileSystem' field as Space's name, as opposed to 'MountedOn' on
> *nix, as on cygwin, MountedOn is cygwin path, while FileSystem is
> corresponding windows path, and the test expect Space's name to be
> appropriate path
> >

Reply via email to