< prev index next >

test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java

Print this page
rev 57062 : 8234625: hs test serviceability/sa/ClhsdbCDSCore.java fails on macOS 10.15


  94             };
  95 
  96             OutputAnalyzer crashOut;
  97             try {
  98                List<String> options = new ArrayList<>();
  99                options.addAll(Arrays.asList(jArgs));
 100                crashOut =
 101                    ProcessTools.executeProcess(getTestJavaCommandlineWithPrefix(
 102                    RUN_SHELL_NO_LIMIT, options.toArray(new String[0])));
 103             } catch (Throwable t) {
 104                throw new Error("Can't execute the java cds process.", t);
 105             }
 106 
 107             System.out.println(crashOut.getOutput());
 108             String crashOutputString = crashOut.getOutput();
 109             SATestUtils.unzipCores(new File("."));
 110             String coreFileLocation = getCoreFileLocation(crashOutputString);
 111             if (coreFileLocation == null) {
 112                 if (Platform.isOSX()) {
 113                     File coresDir = new File("/cores");
 114                     if (!coresDir.isDirectory() || !coresDir.canWrite()) {
 115                         throw new Error("cores is not a directory or does not have write permissions");












 116                     }
 117                 } else if (Platform.isLinux()) {
 118                     // Check if a crash report tool is installed.
 119                     File corePatternFile = new File(CORE_PATTERN_FILE_NAME);
 120                     Scanner scanner = new Scanner(corePatternFile);
 121                     while (scanner.hasNextLine()) {
 122                         String line = scanner.nextLine();
 123                         line = line.trim();
 124                         System.out.println(line);
 125                         if (line.startsWith("|")) {
 126                             System.out.println(
 127                                 "\nThis system uses a crash report tool ($cat /proc/sys/kernel/core_pattern).\n" +
 128                                 "Core files might not be generated. Please reset /proc/sys/kernel/core_pattern\n" +
 129                                 "to enable core generation. Skipping this test.");
 130                             cleanup();
 131                             throw new SkippedException("This system uses a crash report tool");
 132                         }
 133                     }
 134                 }
 135                 throw new Error("Couldn't find core file location in: '" + crashOutputString + "'");




  94             };
  95 
  96             OutputAnalyzer crashOut;
  97             try {
  98                List<String> options = new ArrayList<>();
  99                options.addAll(Arrays.asList(jArgs));
 100                crashOut =
 101                    ProcessTools.executeProcess(getTestJavaCommandlineWithPrefix(
 102                    RUN_SHELL_NO_LIMIT, options.toArray(new String[0])));
 103             } catch (Throwable t) {
 104                throw new Error("Can't execute the java cds process.", t);
 105             }
 106 
 107             System.out.println(crashOut.getOutput());
 108             String crashOutputString = crashOut.getOutput();
 109             SATestUtils.unzipCores(new File("."));
 110             String coreFileLocation = getCoreFileLocation(crashOutputString);
 111             if (coreFileLocation == null) {
 112                 if (Platform.isOSX()) {
 113                     File coresDir = new File("/cores");
 114                     if (!coresDir.isDirectory()) {
 115                         throw new Error("cores is not a directory");
 116                     }
 117                     // the /cores directory is usually not writable on macOS 10.15
 118                     final String osVersion = System.getProperty("os.version");
 119                     if (osVersion == null) {
 120                         throw new Error("Cannot query the 'os.version' property!");
 121                     }
 122                     if (!coresDir.canWrite()) {
 123                         if (osVersion.startsWith("10.15")) {
 124                             throw new SkippedException("/cores is not writable");
 125                         } else {
 126                             throw new Error("cores does not have write permissions");
 127                         }
 128                     }
 129                 } else if (Platform.isLinux()) {
 130                     // Check if a crash report tool is installed.
 131                     File corePatternFile = new File(CORE_PATTERN_FILE_NAME);
 132                     Scanner scanner = new Scanner(corePatternFile);
 133                     while (scanner.hasNextLine()) {
 134                         String line = scanner.nextLine();
 135                         line = line.trim();
 136                         System.out.println(line);
 137                         if (line.startsWith("|")) {
 138                             System.out.println(
 139                                 "\nThis system uses a crash report tool ($cat /proc/sys/kernel/core_pattern).\n" +
 140                                 "Core files might not be generated. Please reset /proc/sys/kernel/core_pattern\n" +
 141                                 "to enable core generation. Skipping this test.");
 142                             cleanup();
 143                             throw new SkippedException("This system uses a crash report tool");
 144                         }
 145                     }
 146                 }
 147                 throw new Error("Couldn't find core file location in: '" + crashOutputString + "'");


< prev index next >