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 System.out.println("on macOS 10.15 /cores is usually not writable, skipping test.");
125 return;
126 } else {
127 throw new Error("cores does not have write permissions");
128 }
129 }
130 } else if (Platform.isLinux()) {
131 // Check if a crash report tool is installed.
132 File corePatternFile = new File(CORE_PATTERN_FILE_NAME);
133 Scanner scanner = new Scanner(corePatternFile);
134 while (scanner.hasNextLine()) {
135 String line = scanner.nextLine();
136 line = line.trim();
137 System.out.println(line);
138 if (line.startsWith("|")) {
139 System.out.println(
140 "\nThis system uses a crash report tool ($cat /proc/sys/kernel/core_pattern).\n" +
141 "Core files might not be generated. Please reset /proc/sys/kernel/core_pattern\n" +
142 "to enable core generation. Skipping this test.");
143 cleanup();
144 throw new SkippedException("This system uses a crash report tool");
145 }
146 }
147 }
148 throw new Error("Couldn't find core file location in: '" + crashOutputString + "'");
|