1
1
/*
2
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
30
30
*/
31
31
32
32
import java .util .List ;
33
+ import jdk .test .lib .Utils ;
33
34
import jdk .test .lib .process .ProcessTools ;
34
35
import jdk .test .lib .process .OutputAnalyzer ;
35
36
@@ -154,6 +155,7 @@ private native void initMethodIds(String callableMethodName,
154
155
155
156
// Check warnings appear where they should, with start/end statements in output...
156
157
static void checkOuputForCorrectWarnings (OutputAnalyzer oa ) throws RuntimeException {
158
+ oa .shouldHaveExitValue (0 );
157
159
List <String > lines = oa .asLines ();
158
160
int expectedWarnings = 0 ;
159
161
int warningCount = 0 ;
@@ -175,12 +177,10 @@ static void checkOuputForCorrectWarnings(OutputAnalyzer oa) throws RuntimeExcept
175
177
oa .reportDiagnosticSummary ();
176
178
throw new RuntimeException ("Unexpected warning at line " + lineNo );
177
179
}
178
- }
179
- else if (line .startsWith (EXPECT_WARNING_START )) {
180
+ } else if (line .startsWith (EXPECT_WARNING_START )) {
180
181
String countStr = line .substring (EXPECT_WARNING_START .length () + 1 );
181
182
expectedWarnings = Integer .parseInt (countStr );
182
- }
183
- else if (line .startsWith (EXPECT_WARNING_END )) {
183
+ } else if (line .startsWith (EXPECT_WARNING_END )) {
184
184
if (warningCount != expectedWarnings ) {
185
185
oa .reportDiagnosticSummary ();
186
186
throw new RuntimeException ("Missing warning at line " + lineNo );
@@ -189,6 +189,9 @@ else if (line.startsWith(EXPECT_WARNING_END)) {
189
189
expectedWarnings = 0 ;
190
190
}
191
191
}
192
+ if (!testStartLine ) {
193
+ throw new RuntimeException ("Missing test start line after " + lineNo + " lines" );
194
+ }
192
195
/*
193
196
System.out.println("Output looks good...");
194
197
oa.reportDiagnosticSummary();
@@ -203,7 +206,8 @@ public static void main(String[] args) throws Throwable {
203
206
204
207
// launch and check output
205
208
checkOuputForCorrectWarnings (ProcessTools .executeTestJvm ("-Xcheck:jni" ,
206
- "TestCheckedJniExceptionCheck" ));
209
+ "-Djava.library.path=" + Utils .TEST_NATIVE_PATH ,
210
+ "TestCheckedJniExceptionCheck" ));
207
211
}
208
212
209
213
}
0 commit comments