< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance002.java

Print this page




 129 
 130         debuggee.redirectStderr(out);
 131         log2("newinstance002a debuggee launched");
 132         debuggee.resume();
 133 
 134         String line = pipe.readln();
 135         if ((line == null) || !line.equals("ready")) {
 136             log3("signal received is not 'ready' but: " + line);
 137             return FAILED;
 138         } else {
 139             log2("'ready' recieved");
 140         }
 141 
 142         VirtualMachine vm = debuggee.VM();
 143 
 144     //------------------------------------------------------  testing section
 145         log1("      TESTING BEGINS");
 146 
 147         for (int i = 0; ; i++) {
 148         pipe.println("newcheck");











 149             line = pipe.readln();
 150 



 151             if (line.equals("checkend")) {
 152                 log2("     : returned string is 'checkend'");
 153                 break ;
 154             } else if (!line.equals("checkready")) {
 155                 log3("ERROR: returned string is not 'checkready'");
 156                 testExitCode = FAILED;
 157                 break ;
 158             }
 159 
 160             log1("new check: #" + i);
 161 
 162             //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part
 163 
 164             List listOftestedClasses = vm.classesByName(mName + ".newinstance002aTestClass");
 165             if (listOftestedClasses.size() != 1) {
 166                 log3("ERROR: listOftestedClasses.size() != 1");
 167                 testExitCode = FAILED;
 168                 continue;
 169             }
 170             ReferenceType testedClass =


 215                 continue;
 216             }
 217             log2("5555555555");
 218 
 219             if (newarrayArray.getValue(0) != null ||
 220                            newarrayArray.getValue(1) != null) {
 221                 log3("ERROR: newarrayArray.getValue() != null  ");
 222                 testExitCode = FAILED;
 223                 continue;
 224             }
 225 
 226             log2("6666666666");
 227 
 228             //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 229         }
 230         log1("      TESTING ENDS");
 231 
 232     //--------------------------------------------------   test summary section
 233     //-------------------------------------------------    standard end section
 234 

 235         pipe.println("quit");
 236         log2("waiting for the debuggee to finish ...");
 237         debuggee.waitFor();
 238 
 239         int status = debuggee.getStatus();
 240         if (status != PASSED + PASS_BASE) {
 241             log3("debuggee returned UNEXPECTED exit status: " +
 242                     status + " != PASS_BASE");
 243             testExitCode = FAILED;
 244         } else {
 245             log2("debuggee returned expected exit status: " +
 246                     status + " == PASS_BASE");
 247         }
 248 
 249         if (testExitCode != PASSED) {
 250             System.out.println("TEST FAILED");
 251         }
 252         return testExitCode;
 253     }
 254 }


 129 
 130         debuggee.redirectStderr(out);
 131         log2("newinstance002a debuggee launched");
 132         debuggee.resume();
 133 
 134         String line = pipe.readln();
 135         if ((line == null) || !line.equals("ready")) {
 136             log3("signal received is not 'ready' but: " + line);
 137             return FAILED;
 138         } else {
 139             log2("'ready' recieved");
 140         }
 141 
 142         VirtualMachine vm = debuggee.VM();
 143 
 144     //------------------------------------------------------  testing section
 145         log1("      TESTING BEGINS");
 146 
 147         for (int i = 0; ; i++) {
 148             pipe.println("newcheck");
 149 
 150             // There are potentially other non-test Java threads allocating objects and triggering
 151             // GC's so we need to suspend the target VM to avoid the objects created in the test
 152             // from being accidentally GC'ed. However, we need the target VM temporary resumed
 153             // while reading its response. Below we resume the target VM (if required) and suspend
 154             // it only after pipe.readln() returns.
 155 
 156             // On the first iteration the target VM is not suspended yet.
 157             if (i > 0) {
 158                 debuggee.resume();
 159             }
 160             line = pipe.readln();
 161 
 162             // Suspending target VM to prevent other non-test Java threads from triggering GCs.
 163             debuggee.suspend();
 164 
 165             if (line.equals("checkend")) {
 166                 log2("     : returned string is 'checkend'");
 167                 break ;
 168             } else if (!line.equals("checkready")) {
 169                 log3("ERROR: returned string is not 'checkready'");
 170                 testExitCode = FAILED;
 171                 break ;
 172             }
 173 
 174             log1("new check: #" + i);
 175 
 176             //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ variable part
 177 
 178             List listOftestedClasses = vm.classesByName(mName + ".newinstance002aTestClass");
 179             if (listOftestedClasses.size() != 1) {
 180                 log3("ERROR: listOftestedClasses.size() != 1");
 181                 testExitCode = FAILED;
 182                 continue;
 183             }
 184             ReferenceType testedClass =


 229                 continue;
 230             }
 231             log2("5555555555");
 232 
 233             if (newarrayArray.getValue(0) != null ||
 234                            newarrayArray.getValue(1) != null) {
 235                 log3("ERROR: newarrayArray.getValue() != null  ");
 236                 testExitCode = FAILED;
 237                 continue;
 238             }
 239 
 240             log2("6666666666");
 241 
 242             //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 243         }
 244         log1("      TESTING ENDS");
 245 
 246     //--------------------------------------------------   test summary section
 247     //-------------------------------------------------    standard end section
 248 
 249         debuggee.resume();
 250         pipe.println("quit");
 251         log2("waiting for the debuggee to finish ...");
 252         debuggee.waitFor();
 253 
 254         int status = debuggee.getStatus();
 255         if (status != PASSED + PASS_BASE) {
 256             log3("debuggee returned UNEXPECTED exit status: " +
 257                     status + " != PASS_BASE");
 258             testExitCode = FAILED;
 259         } else {
 260             log2("debuggee returned expected exit status: " +
 261                     status + " == PASS_BASE");
 262         }
 263 
 264         if (testExitCode != PASSED) {
 265             System.out.println("TEST FAILED");
 266         }
 267         return testExitCode;
 268     }
 269 }
< prev index next >