From 82f9578bb38628c207bca6a9ebf9a17897b00697 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Tue, 4 Aug 2015 15:16:23 +0200 Subject: [PATCH] 8085919: OperatingSystemMXBean/TestTotalSwap.java failure : Total Swap Space figures mismatch Reviewed-by: dholmes --- .../OperatingSystemMXBean/TestTotalSwap.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.java b/jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.java index 3bb1c714e60..8d5e7c919ba 100644 --- a/jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.java +++ b/jdk/test/com/sun/management/OperatingSystemMXBean/TestTotalSwap.java @@ -73,6 +73,8 @@ public class TestTotalSwap { private static final long MAX_SIZE_FOR_PASS = Long.MAX_VALUE; public static void main(String args[]) throws Throwable { + // yocto might ignore the request to report swap size in bytes + boolean swapInKB = mbean.getVersion().contains("yocto"); long expected_swap_size = getSwapSizeFromOs(); @@ -87,10 +89,13 @@ public class TestTotalSwap { if (expected_swap_size > -1) { if (size != expected_swap_size) { - throw new RuntimeException("Expected total swap size : " + - expected_swap_size + - " but getTotalSwapSpaceSize returned: " + - size); + // try the expected size in kiloBytes + if (!(swapInKB && expected_swap_size * 1024 == size)) { + throw new RuntimeException("Expected total swap size : " + + expected_swap_size + + " but getTotalSwapSpaceSize returned: " + + size); + } } }