test/hotspot/jtreg/runtime/SharedArchiveFile/CheckDefaultArchiveFile.java
changeset 57646 26f71e24dd24
parent 52030 57862a02bf4b
equal deleted inserted replaced
57645:152cd40a1d36 57646:26f71e24dd24
     1 /*
     1 /*
     2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    46         WhiteBox wb = WhiteBox.getWhiteBox();
    46         WhiteBox wb = WhiteBox.getWhiteBox();
    47         String osArch = Platform.getOsArch();
    47         String osArch = Platform.getOsArch();
    48         String vmName = System.getProperty("java.vm.name");
    48         String vmName = System.getProperty("java.vm.name");
    49         String vmString = vmName + "(" + osArch + ")";
    49         String vmString = vmName + "(" + osArch + ")";
    50         String jsaString = wb.getDefaultArchivePath();
    50         String jsaString = wb.getDefaultArchivePath();
    51         Path jsa = Paths.get(jsaString);
    51         System.out.println("classes.jsa location:" + jsaString);
    52         if (Platform.isDefaultCDSArchiveSupported()) {
    52         if (jsaString == null) {
    53             if (Files.exists(jsa)) {
    53             if (Platform.isDefaultCDSArchiveSupported()) {
    54                 System.out.println("Passed. " + vmString +
    54                 throw new RuntimeException("default CDS archive supported, but classes.jsa path null");
    55                                    ": has default classes.jsa file");
       
    56             } else {
       
    57                 throw new RuntimeException(vmString + "has no " + jsaString);
       
    58             }
    55             }
    59         } else {
    56         } else {
    60             throw new SkippedException("Default CDS archive is not supported");
    57             Path jsa = Paths.get(jsaString);
       
    58             if (Platform.isDefaultCDSArchiveSupported()) {
       
    59                 if (Files.exists(jsa)) {
       
    60                     System.out.println("Passed. " + vmString +
       
    61                                        ": has default classes.jsa file");
       
    62                 } else {
       
    63                     throw new RuntimeException(vmString + "has no " + jsaString);
       
    64                 }
       
    65             } else {
       
    66                 throw new SkippedException("Default CDS archive is not supported");
       
    67             }
    61         }
    68         }
    62     }
    69     }
    63 }
    70 }