author | dtitov |
Thu, 28 Feb 2019 13:12:26 -0800 | |
changeset 53960 | 6c3fd94de35a |
parent 50018 | 3ba0d8631f24 |
permissions | -rw-r--r-- |
50018 | 1 |
/* |
53960
6c3fd94de35a
8207367: 10 vmTestbase/nsk/jdi tests timed out when running with jtreg
dtitov
parents:
50018
diff
changeset
|
2 |
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. |
50018 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
package nsk.jdi.EventQueue.remove_l; |
|
25 |
||
53960
6c3fd94de35a
8207367: 10 vmTestbase/nsk/jdi tests timed out when running with jtreg
dtitov
parents:
50018
diff
changeset
|
26 |
import jdk.test.lib.Utils; |
50018 | 27 |
import nsk.share.*; |
28 |
import nsk.share.jpda.*; |
|
29 |
import nsk.share.jdi.*; |
|
30 |
||
31 |
/** |
|
32 |
* This class is used as debuggee application for the remove_l004 JDI test. |
|
33 |
*/ |
|
34 |
||
35 |
public class remove_l004a { |
|
36 |
||
37 |
//----------------------------------------------------- templete section |
|
38 |
||
39 |
static final int PASSED = 0; |
|
40 |
static final int FAILED = 2; |
|
41 |
static final int PASS_BASE = 95; |
|
42 |
||
43 |
static ArgumentHandler argHandler; |
|
44 |
static Log log; |
|
45 |
||
46 |
//-------------------------------------------------- log procedures |
|
47 |
||
48 |
private static void log1(String message) { |
|
49 |
log.display("**> debuggee: " + message); |
|
50 |
} |
|
51 |
||
52 |
private static void logErr(String message) { |
|
53 |
log.complain("**> debuggee: " + message); |
|
54 |
} |
|
55 |
||
56 |
//====================================================== test program |
|
57 |
||
58 |
//------------------------------------------------------ common section |
|
59 |
static int instruction = 1; |
|
60 |
static int end = 0; |
|
61 |
// static int quit = 0; |
|
62 |
// static int continue = 2; |
|
63 |
static int maxInstr = 1; // 2; |
|
64 |
||
65 |
static int lineForComm = 2; |
|
66 |
||
53960
6c3fd94de35a
8207367: 10 vmTestbase/nsk/jdi tests timed out when running with jtreg
dtitov
parents:
50018
diff
changeset
|
67 |
// Used for communication between debugger and debuggee |
6c3fd94de35a
8207367: 10 vmTestbase/nsk/jdi tests timed out when running with jtreg
dtitov
parents:
50018
diff
changeset
|
68 |
static volatile boolean stopSleeping = false; |
6c3fd94de35a
8207367: 10 vmTestbase/nsk/jdi tests timed out when running with jtreg
dtitov
parents:
50018
diff
changeset
|
69 |
|
6c3fd94de35a
8207367: 10 vmTestbase/nsk/jdi tests timed out when running with jtreg
dtitov
parents:
50018
diff
changeset
|
70 |
// Used by debugger to set stopSleeping flag to true |
6c3fd94de35a
8207367: 10 vmTestbase/nsk/jdi tests timed out when running with jtreg
dtitov
parents:
50018
diff
changeset
|
71 |
static final boolean BOOLEAN_TRUE_VALUE = true; |
6c3fd94de35a
8207367: 10 vmTestbase/nsk/jdi tests timed out when running with jtreg
dtitov
parents:
50018
diff
changeset
|
72 |
|
50018 | 73 |
private static void methodForCommunication() { |
74 |
int i1 = instruction; |
|
75 |
int i2 = i1; |
|
76 |
int i3 = i2; |
|
77 |
} |
|
78 |
//---------------------------------------------------- main method |
|
79 |
||
80 |
public static void main (String argv[]) { |
|
81 |
||
82 |
argHandler = new ArgumentHandler(argv); |
|
83 |
log = argHandler.createDebugeeLog(); |
|
84 |
||
85 |
log1("debuggee started!"); |
|
86 |
||
87 |
int exitCode = PASSED; |
|
88 |
||
89 |
||
90 |
label0: |
|
91 |
for (int i = 0; ; i++) { |
|
92 |
||
93 |
if (instruction > maxInstr) { |
|
94 |
logErr("ERROR: unexpected instruction: " + instruction); |
|
95 |
exitCode = FAILED; |
|
96 |
break ; |
|
97 |
} |
|
98 |
||
99 |
switch (i) { |
|
100 |
||
101 |
//------------------------------------------------------ section tested |
|
102 |
||
103 |
case 0: |
|
104 |
log1("before: methodForCommunication();"); |
|
105 |
methodForCommunication(); |
|
106 |
log1("before: Thread.sleep"); |
|
53960
6c3fd94de35a
8207367: 10 vmTestbase/nsk/jdi tests timed out when running with jtreg
dtitov
parents:
50018
diff
changeset
|
107 |
Utils.waitForCondition( |
6c3fd94de35a
8207367: 10 vmTestbase/nsk/jdi tests timed out when running with jtreg
dtitov
parents:
50018
diff
changeset
|
108 |
() -> { |
6c3fd94de35a
8207367: 10 vmTestbase/nsk/jdi tests timed out when running with jtreg
dtitov
parents:
50018
diff
changeset
|
109 |
return stopSleeping; |
6c3fd94de35a
8207367: 10 vmTestbase/nsk/jdi tests timed out when running with jtreg
dtitov
parents:
50018
diff
changeset
|
110 |
}, |
6c3fd94de35a
8207367: 10 vmTestbase/nsk/jdi tests timed out when running with jtreg
dtitov
parents:
50018
diff
changeset
|
111 |
Utils.adjustTimeout(argHandler.getWaitTime() * 10000), |
6c3fd94de35a
8207367: 10 vmTestbase/nsk/jdi tests timed out when running with jtreg
dtitov
parents:
50018
diff
changeset
|
112 |
100); |
50018 | 113 |
log1("after: Thread.sleep"); |
114 |
break ; |
|
115 |
||
116 |
//------------------------------------------------- standard end section |
|
117 |
||
118 |
default: |
|
119 |
instruction = end; |
|
120 |
methodForCommunication(); |
|
121 |
break label0; |
|
122 |
} |
|
123 |
} |
|
124 |
||
125 |
System.exit(exitCode + PASS_BASE); |
|
126 |
} |
|
127 |
} |