< prev index next >

test/tools/launcher/TooSmallStackSize.java

Print this page


   1 /*
   2  * Copyright (c) 2014, 2016, 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  */


 138             System.out.println("Test output:");
 139             printTestOutput(tr);
 140             System.out.println("FAILED: VM failed to launch with minimum allowed stack size of " + stackSize);
 141             throw new RuntimeException("test fails");
 142         }
 143     }
 144 
 145     public static void main(String... args) {
 146         /*
 147          * The result of a 16k stack size should be a quick exit with a complaint
 148          * that the stack size is too small. However, for some win32 builds, the
 149          * stack is always at least 64k, and this also sometimes is the minimum
 150          * allowed size, so we won't see an error in this case.
 151          *
 152          * This test case will also produce a crash on some platforms if the fix
 153          * for 6762191 is not yet in place.
 154          */
 155         checkStack("16k");
 156 
 157         /*
 158          * Try with a 32k stack size, which is the size that the launcher will
 159          * set to if you try setting to anything smaller. This should produce the same
 160          * result as setting to 16k if the fix for 6762191 is in place.
 161          */
 162         String min_stack_allowed = checkStack("32k");
 163 
 164         /*
 165          * Try again with a the minimum stack size that was given in the error message
 166          */
 167         checkMinStackAllowed(min_stack_allowed);







 168     }
 169 }
   1 /*
   2  * Copyright (c) 2014, 2017, 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  */


 138             System.out.println("Test output:");
 139             printTestOutput(tr);
 140             System.out.println("FAILED: VM failed to launch with minimum allowed stack size of " + stackSize);
 141             throw new RuntimeException("test fails");
 142         }
 143     }
 144 
 145     public static void main(String... args) {
 146         /*
 147          * The result of a 16k stack size should be a quick exit with a complaint
 148          * that the stack size is too small. However, for some win32 builds, the
 149          * stack is always at least 64k, and this also sometimes is the minimum
 150          * allowed size, so we won't see an error in this case.
 151          *
 152          * This test case will also produce a crash on some platforms if the fix
 153          * for 6762191 is not yet in place.
 154          */
 155         checkStack("16k");
 156 
 157         /*
 158          * Try with a 64k stack size, which is the size that the launcher will
 159          * set to if you try setting to anything smaller. This should produce the same
 160          * result as setting to 16k if the fix for 6762191 is in place.
 161          */
 162         String min_stack_allowed = checkStack("64k");
 163 
 164         /*
 165          * Try again with a the minimum stack size that was given in the error message
 166          */
 167         checkMinStackAllowed(min_stack_allowed);
 168 
 169         /*
 170          * Try again with a the minimum stack size plus a bit more so it is not
 171          * OS page aligned. This is to help test asserts added for 8176768 are
 172          * not triggered.
 173          */
 174         checkMinStackAllowed("513k");
 175     }
 176 }
< prev index next >