1 #!/bin/ksh -p |
1 #!/bin/ksh -p |
2 |
2 |
3 # |
3 # |
4 # Copyright (c) 20015, Oracle and/or its affiliates. All rights reserved. |
4 # Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6 # |
6 # |
7 # This code is free software; you can redistribute it and/or modify it |
7 # This code is free software; you can redistribute it and/or modify it |
8 # under the terms of the GNU General Public License version 2 only, as |
8 # under the terms of the GNU General Public License version 2 only, as |
9 # published by the Free Software Foundation. |
9 # published by the Free Software Foundation. |
37 # Beginning of subroutines: |
37 # Beginning of subroutines: |
38 status=1 |
38 status=1 |
39 |
39 |
40 #Call this from anywhere to fail the test with an error message |
40 #Call this from anywhere to fail the test with an error message |
41 # usage: fail "reason why the test failed" |
41 # usage: fail "reason why the test failed" |
42 fail() |
42 fail() |
43 { echo "The test failed :-(" |
43 { echo "The test failed :-(" |
44 echo "$*" 1>&2 |
44 echo "$*" 1>&2 |
45 echo "exit status was $status" |
45 echo "exit status was $status" |
46 exit $status |
46 exit $status |
47 } #end of fail() |
47 } #end of fail() |
48 |
48 |
49 #Call this from anywhere to pass the test with a message |
49 #Call this from anywhere to pass the test with a message |
50 # usage: pass "reason why the test passed if applicable" |
50 # usage: pass "reason why the test passed if applicable" |
51 pass() |
51 pass() |
52 { echo "The test passed!!!" |
52 { echo "The test passed!!!" |
53 echo "$*" 1>&2 |
53 echo "$*" 1>&2 |
54 exit 0 |
54 exit 0 |
55 } #end of pass() |
55 } #end of pass() |
56 |
56 |
74 fail "Unrecognized system! $OS" |
74 fail "Unrecognized system! $OS" |
75 ;; |
75 ;; |
76 esac |
76 esac |
77 |
77 |
78 |
78 |
79 # Want this test to run standalone as well as in the harness, so do the |
79 # Want this test to run standalone as well as in the harness, so do the |
80 # following to copy the test's directory into the harness's scratch directory |
80 # following to copy the test's directory into the harness's scratch directory |
81 # and set all appropriate variables: |
81 # and set all appropriate variables: |
82 |
82 |
83 if [ -z "${TESTJAVA}" ] ; then |
83 if [ -z "${TESTJAVA}" ] ; then |
84 # TESTJAVA is not set, so the test is running stand-alone. |
84 # TESTJAVA is not set, so the test is running stand-alone. |
85 # TESTJAVA holds the path to the root directory of the build of the JDK |
85 # TESTJAVA holds the path to the root directory of the build of the JDK |
98 STANDALONE=1; |
98 STANDALONE=1; |
99 fi |
99 fi |
100 echo "JDK under test is: $TESTJAVA" |
100 echo "JDK under test is: $TESTJAVA" |
101 |
101 |
102 #Deal with .class files: |
102 #Deal with .class files: |
103 if [ -n "${STANDALONE}" ] ; |
103 if [ -n "${STANDALONE}" ] ; |
104 then |
104 then |
105 #if standalone, remind user to cd to dir. containing test before running it |
105 #if standalone, remind user to cd to dir. containing test before running it |
106 echo "Just a reminder: cd to the dir containing this test when running it" |
106 echo "Just a reminder: cd to the dir containing this test when running it" |
107 # then compile all .java files (if there are any) into .class files |
107 # then compile all .java files (if there are any) into .class files |
108 if [ -a *.java ] ; |
108 if [ -a *.java ] ; |
109 then echo "Reminder, this test should be in its own directory with all" |
109 then echo "Reminder, this test should be in its own directory with all" |
110 echo "supporting files it needs in the directory with it." |
110 echo "supporting files it needs in the directory with it." |
111 ${TESTJAVA}/bin/javac ./*.java ; |
111 ${TESTJAVA}/bin/javac ./*.java ; |
112 fi |
112 fi |
113 # else in harness so copy all the class files from where jtreg put them |
113 # else in harness so copy all the class files from where jtreg put them |
114 # over to the scratch directory this test is running in. |
114 # over to the scratch directory this test is running in. |
115 else cp ${TESTCLASSES}/*.class . ; |
115 else cp ${TESTCLASSES}/*.class . ; |
116 fi |
116 fi |
117 |
117 |
118 #if in test harness, then copy the entire directory that the test is in over |
118 #if in test harness, then copy the entire directory that the test is in over |
119 # to the scratch directory. This catches any support files needed by the test. |
119 # to the scratch directory. This catches any support files needed by the test. |
120 if [ -z "${STANDALONE}" ] ; |
120 if [ -z "${STANDALONE}" ] ; |
121 then cp ${TESTSRC}/* . |
121 then cp ${TESTSRC}/* . |
122 fi |
122 fi |
123 |
123 |
124 #Just before executing anything, make sure it has executable permission! |
124 #Just before executing anything, make sure it has executable permission! |
125 chmod 777 ./* |
125 chmod 777 ./* |
126 |
126 |