1 /* 2 * Copyright (c) 2008, 2018, 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 */ 23 24 /* 25 * @test 26 * 27 * @summary converted from VM Testbase jit/t/t087. 28 * VM Testbase keywords: [jit, quick, jdk, javac] 29 * 30 * @library /vmTestbase 31 * /test/lib 32 * @run driver jdk.test.lib.FileInstaller . . 33 * @build ExecDriver 34 * 35 * @comment build all dependencies 36 * @build jit.t.t087.t087 37 * 38 * @comment make sure foo.class is only in the current directory 39 * @clean jit.t.t087.foo 40 * @run driver PropertyResolvingWrapper ExecDriver --cmd 41 * ${compile.jdk}/bin/javac 42 * -d . 43 * -cp ${test.class.path} 44 * ${test.src}/t087.java 45 * 46 * @comment run the test 47 * @run driver PropertyResolvingWrapper ExecDriver --java 48 * -cp .${path.separator}${test.class.path} 49 * jit.t.t087.t087 50 * -WorkDir ./jit/t/t087 51 */ 52 53 package jit.t.t087; 54 55 import java.io.File; 56 import nsk.share.TestFailure; 57 import nsk.share.GoldChecker; 58 59 class foo 60 { bar()61 static void bar() 62 { 63 t087.goldChecker.println("You shouldn't see this."); 64 } 65 } 66 67 class t087 68 { 69 public static final GoldChecker goldChecker = new GoldChecker( "t087" ); 70 main(String[] argv)71 public static void main(String[] argv) 72 { 73 File f; 74 if (argv.length < 2 || !argv[0].equals("-WorkDir")) 75 f = new File(".", "foo.class"); 76 else 77 f = new File(argv[1], "foo.class"); 78 if(f.isFile()) 79 { 80 81 f.delete(); 82 83 for(int i = 1; i <= 2; i += 1) 84 { 85 try 86 { 87 foo.bar(); 88 } 89 catch(Throwable t) 90 { 91 t087.goldChecker.println("Exception on try" + i); 92 } 93 } 94 95 } 96 else 97 t087.goldChecker.println("No foo.class in cwd"); 98 t087.goldChecker.check(); 99 } 100 } 101