Skip to content

Commit e2c07d5

Browse files
committedAug 5, 2024
8337299: vmTestbase/nsk/jdb/stop_at/stop_at002/stop_at002.java failure goes undetected
Reviewed-by: amenkov, sspitsyn
1 parent 08f697f commit e2c07d5

File tree

2 files changed

+52
-20
lines changed

2 files changed

+52
-20
lines changed
 

‎test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at002/stop_at002.java

+47-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -82,17 +82,10 @@ public static int run(String argv[], PrintStream out) {
8282
static final String DEBUGGEE_CLASS = TEST_CLASS + "a";
8383
static final String FIRST_BREAK = DEBUGGEE_CLASS + ".main";
8484
static final String LAST_BREAK = DEBUGGEE_CLASS + ".lastBreak";
85-
static final String DEBUGGEE_LOCATION1 = DEBUGGEE_CLASS + "$Nested$DeeperNested$DeepestNested:43";
86-
static final String DEBUGGEE_LOCATION2 = DEBUGGEE_CLASS + "$Inner$MoreInner:57";
87-
static final String FAILURE_PATTERN = "Unable to set";
85+
static final String DEBUGGEE_LOCATION1 = DEBUGGEE_CLASS + "$Nested$DeeperNested$DeepestNested:64";
86+
static final String DEBUGGEE_LOCATION2 = DEBUGGEE_CLASS + "$Inner$MoreInner:78";
8887

8988
protected void runCases() {
90-
String[] reply;
91-
Paragrep grep;
92-
int count;
93-
Vector v;
94-
String found;
95-
9689
if (!checkStop(DEBUGGEE_LOCATION1)) {
9790
success = false;
9891
}
@@ -101,25 +94,62 @@ protected void runCases() {
10194
success = false;
10295
}
10396

104-
jdb.contToExit(3);
97+
if (!checkBreakpointHit(DEBUGGEE_LOCATION1)) {
98+
success = false;
99+
}
100+
101+
if (!checkBreakpointHit(DEBUGGEE_LOCATION2)) {
102+
success = false;
103+
}
104+
105+
jdb.contToExit(1);
105106
}
106107

107-
private boolean checkStop (String location) {
108+
private boolean checkStop(String location) {
108109
Paragrep grep;
109110
String[] reply;
110111
String found;
111-
boolean result = true;
112112

113113
log.display("Trying to set breakpoint at line: " + location);
114114
reply = jdb.receiveReplyFor(JdbCommand.stop_at + location);
115115

116116
grep = new Paragrep(reply);
117-
found = grep.findFirst(FAILURE_PATTERN);
117+
found = grep.findFirst("Deferring breakpoint " + location);
118+
if (found.length() == 0) {
119+
log.complain("jdb failed to setup deferred breakpoint at line: " + location);
120+
return false;
121+
}
122+
123+
return true;
124+
}
125+
126+
private boolean checkBreakpointHit(String location) {
127+
Paragrep grep;
128+
String[] reply;
129+
String found;
130+
131+
log.display("continuing to breakpoint at line: " + location);
132+
reply = jdb.receiveReplyFor(JdbCommand.cont);
133+
grep = new Paragrep(reply);
134+
135+
found = grep.findFirst("Unable to set deferred breakpoint");
118136
if (found.length() > 0) {
119-
log.complain("jdb failed to set line breakpoint at line: " + found);
120-
result = false;
137+
log.complain("jdb failed to set deferred breakpoint at line: " + location);
138+
return false;
139+
}
140+
141+
found = grep.findFirst("Set deferred breakpoint " + location);
142+
if (found.length() == 0) {
143+
log.complain("jdb failed to set deferred breakpoint at line: " + location);
144+
return false;
145+
}
146+
147+
found = grep.findFirst("Breakpoint hit: \"thread=main\", ");
148+
if (found.length() == 0) {
149+
log.complain("jdb failed to hit breakpoint at line: " + location);
150+
return false;
121151
}
122152

123-
return result;
153+
return true;
124154
}
125155
}

‎test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at002/stop_at002a.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -21,6 +21,8 @@
2121
* questions.
2222
*/
2323

24+
// THIS TEST IS LINE NUMBER SENSITIVE
25+
2426
package nsk.jdb.stop_at.stop_at002;
2527

2628
import nsk.share.*;
@@ -59,7 +61,7 @@ class Nested {
5961
class DeeperNested {
6062
class DeepestNested {
6163
public void foo(boolean input) {
62-
flag = input; /* <-------- This is line number 43 */
64+
flag = input; /* <-------- This is line number 64 */
6365
}
6466
}
6567
}
@@ -73,7 +75,7 @@ public MoreInner() {
7375
content = "";
7476
}
7577
public void foo(String input) {
76-
content += input; /* <-------- This is line number 57 */
78+
content += input; /* <-------- This is line number 78 */
7779
}
7880
}
7981
}

0 commit comments

Comments
 (0)
Please sign in to comment.