Skip to content

Commit

Permalink
8289584: (fs) Print size values in java/nio/file/FileStore/Basic.java…
Browse files Browse the repository at this point in the history
… when they differ by > 1GiB

Backport-of: e291a67e96970d80a9915f8a23afffed6e0b8ded
  • Loading branch information
Sonia Zaldana Calles authored and GoeLin committed Nov 9, 2023
1 parent 623fd8e commit 6038e04
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/jdk/java/nio/file/FileStore/Basic.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -57,10 +57,13 @@ static void assertTrue(boolean okay) {
throw new RuntimeException("Assertion failed");
}

static void checkWithin1GB(long value1, long value2) {
long diff = Math.abs(value1 - value2);
if (diff > G)
throw new RuntimeException("values differ by more than 1GB");
static void checkWithin1GB(long expected, long actual) {
long diff = Math.abs(actual - expected);
if (diff > G) {
String msg = String.format("|actual %d - expected %d| = %d (%f G)",
actual, expected, diff, (float)diff/G);
throw new RuntimeException(msg);
}
}

static void doTests(Path dir) throws IOException {
Expand Down

1 comment on commit 6038e04

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.