test/java/rmi/testlibrary/JavaVM.java

Print this page
rev 9344 : 8036095: RMI tests using testlibrary.RMID and testlibrary.JavaVM do not pass through vmoptions
Reviewed-by: XXX
   1 /*
   2  * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
   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  */


 107     protected static String getCodeCoverageOptions() {
 108         return TestLibrary.getExtraProperty("jcov.options","");
 109     }
 110 
 111     /**
 112      * Exec the VM as specified in this object's constructor.
 113      */
 114     public void start() throws IOException {
 115 
 116         if (vm != null)
 117             throw new IllegalStateException("JavaVM already started");
 118 
 119         /*
 120          * If specified, add option for policy file
 121          */
 122         if (policyFileName != null) {
 123             String option = "-Djava.security.policy=" + policyFileName;
 124             addOptions(new String[] { option });
 125         }
 126 
 127         addOptions(new String[] { getCodeCoverageOptions() });




 128 
 129         StringTokenizer optionsTokenizer = new StringTokenizer(options);
 130         StringTokenizer argsTokenizer = new StringTokenizer(args);
 131         int optionsCount = optionsTokenizer.countTokens();
 132         int argsCount = argsTokenizer.countTokens();
 133 
 134         String javaCommand[] = new String[optionsCount + argsCount + 2];
 135         int count = 0;
 136 
 137         javaCommand[count++] = JavaVM.javaProgram;
 138         while (optionsTokenizer.hasMoreTokens()) {
 139             javaCommand[count++] = optionsTokenizer.nextToken();
 140         }
 141         javaCommand[count++] = classname;
 142         while (argsTokenizer.hasMoreTokens()) {
 143             javaCommand[count++] = argsTokenizer.nextToken();
 144         }
 145 
 146         mesg("command = " + Arrays.asList(javaCommand).toString());
 147 


   1 /*
   2  * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
   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  */


 107     protected static String getCodeCoverageOptions() {
 108         return TestLibrary.getExtraProperty("jcov.options","");
 109     }
 110 
 111     /**
 112      * Exec the VM as specified in this object's constructor.
 113      */
 114     public void start() throws IOException {
 115 
 116         if (vm != null)
 117             throw new IllegalStateException("JavaVM already started");
 118 
 119         /*
 120          * If specified, add option for policy file
 121          */
 122         if (policyFileName != null) {
 123             String option = "-Djava.security.policy=" + policyFileName;
 124             addOptions(new String[] { option });
 125         }
 126 
 127         addOptions(new String[] {
 128             getCodeCoverageOptions(),
 129             TestParams.testJavaOpts,
 130             TestParams.testVmOpts
 131         });
 132 
 133         StringTokenizer optionsTokenizer = new StringTokenizer(options);
 134         StringTokenizer argsTokenizer = new StringTokenizer(args);
 135         int optionsCount = optionsTokenizer.countTokens();
 136         int argsCount = argsTokenizer.countTokens();
 137 
 138         String javaCommand[] = new String[optionsCount + argsCount + 2];
 139         int count = 0;
 140 
 141         javaCommand[count++] = JavaVM.javaProgram;
 142         while (optionsTokenizer.hasMoreTokens()) {
 143             javaCommand[count++] = optionsTokenizer.nextToken();
 144         }
 145         javaCommand[count++] = classname;
 146         while (argsTokenizer.hasMoreTokens()) {
 147             javaCommand[count++] = argsTokenizer.nextToken();
 148         }
 149 
 150         mesg("command = " + Arrays.asList(javaCommand).toString());
 151