|
1 # |
|
2 # Copyright 2004-2005 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 # CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 # have any questions. |
|
22 # |
|
23 # @test |
|
24 # @bug 4811968 |
|
25 # @summary Serialization compatibility with old versions |
|
26 # @author Weijun Wang |
|
27 # |
|
28 # set a few environment variables so that the shell-script can run stand-alone |
|
29 # in the source directory |
|
30 |
|
31 if [ "${TESTSRC}" = "" ] ; then |
|
32 TESTSRC="." |
|
33 fi |
|
34 if [ "${TESTCLASSES}" = "" ] ; then |
|
35 TESTCLASSES="." |
|
36 fi |
|
37 if [ "${TESTJAVA}" = "" ] ; then |
|
38 echo "TESTJAVA not set. Test cannot execute." |
|
39 echo "FAILED!!!" |
|
40 exit 1 |
|
41 fi |
|
42 |
|
43 # set platform-dependent variables |
|
44 PF="" |
|
45 |
|
46 OS=`uname -s` |
|
47 case "$OS" in |
|
48 SunOS ) |
|
49 FS="/" |
|
50 ARCH=`isainfo` |
|
51 case "$ARCH" in |
|
52 sparc* ) |
|
53 PF="solaris-sparc" |
|
54 ;; |
|
55 i[3-6]86 ) |
|
56 PF="solaris-i586" |
|
57 ;; |
|
58 amd64* ) |
|
59 PF="solaris-amd64" |
|
60 ;; |
|
61 * ) |
|
62 echo "Unsupported System: Solaris ${ARCH}" |
|
63 exit 0; |
|
64 ;; |
|
65 esac |
|
66 ;; |
|
67 Linux ) |
|
68 ARCH=`uname -m` |
|
69 FS="/" |
|
70 case "$ARCH" in |
|
71 i[3-6]86 ) |
|
72 PF="linux-i586" |
|
73 ;; |
|
74 amd64* ) |
|
75 PF="linux-amd64" |
|
76 ;; |
|
77 * ) |
|
78 echo "Unsupported System: Linux ${ARCH}" |
|
79 exit 0; |
|
80 ;; |
|
81 esac |
|
82 ;; |
|
83 Windows* ) |
|
84 FS="\\" |
|
85 PF="windows-i586" |
|
86 |
|
87 # 'uname -m' does not give us enough information - |
|
88 # should rely on $PROCESSOR_IDENTIFIER (as is done in Defs-windows.gmk), |
|
89 # but JTREG does not pass this env variable when executing a shell script. |
|
90 # |
|
91 # execute test program - rely on it to exit if platform unsupported |
|
92 |
|
93 ;; |
|
94 * ) |
|
95 echo "Unsupported System: ${OS}" |
|
96 exit 0; |
|
97 ;; |
|
98 esac |
|
99 |
|
100 # the test code |
|
101 |
|
102 ${TESTJAVA}${FS}bin${FS}javac -source 1.3 -target 1.3 -d . ${TESTSRC}${FS}SerialTest.java || exit 10 |
|
103 |
|
104 OLDJAVA=" |
|
105 /java/re/j2se/1.6.0/latest/binaries/${PF} |
|
106 /java/re/j2se/1.5.0/latest/binaries/${PF} |
|
107 /java/re/j2se/1.4.2/latest/binaries/${PF} |
|
108 " |
|
109 |
|
110 SMALL=" |
|
111 0.0 |
|
112 1.1 |
|
113 2.2 |
|
114 1.2.3456 |
|
115 1.2.2147483647.4 |
|
116 1.2.268435456.4 |
|
117 " |
|
118 |
|
119 HUGE=" |
|
120 2.16.764.1.3101555394.1.0.100.2.1 |
|
121 1.2.2147483648.4 |
|
122 2.3.4444444444444444444444 |
|
123 1.2.888888888888888888.111111111111111.2222222222222.33333333333333333.44444444444444 |
|
124 " |
|
125 |
|
126 for oid in ${SMALL}; do |
|
127 echo ${oid} |
|
128 # new -> |
|
129 ${TESTJAVA}${FS}bin${FS}java SerialTest out ${oid} > tmp.oid.serial || exit 1 |
|
130 # -> new |
|
131 ${TESTJAVA}${FS}bin${FS}java SerialTest in ${oid} < tmp.oid.serial || exit 2 |
|
132 for oldj in ${OLDJAVA}; do |
|
133 if [ -d ${oldj} ]; then |
|
134 echo ${oldj} |
|
135 # -> old |
|
136 ${oldj}${FS}bin${FS}java SerialTest in ${oid} < tmp.oid.serial || exit 3 |
|
137 # old -> |
|
138 ${oldj}${FS}bin${FS}java SerialTest out ${oid} > tmp.oid.serial.old || exit 4 |
|
139 # -> new |
|
140 ${TESTJAVA}${FS}bin${FS}java SerialTest in ${oid} < tmp.oid.serial.old || exit 5 |
|
141 fi |
|
142 done |
|
143 done |
|
144 |
|
145 for oid in ${HUGE}; do |
|
146 echo ${oid} |
|
147 # new -> |
|
148 ${TESTJAVA}${FS}bin${FS}java SerialTest out ${oid} > tmp.oid.serial || exit 1 |
|
149 # -> new |
|
150 ${TESTJAVA}${FS}bin${FS}java SerialTest in ${oid} < tmp.oid.serial || exit 2 |
|
151 for oldj in ${OLDJAVA}; do |
|
152 if [ -d ${oldj} ]; then |
|
153 echo ${oldj} |
|
154 # -> old |
|
155 ${oldj}${FS}bin${FS}java SerialTest badin < tmp.oid.serial || exit 3 |
|
156 fi |
|
157 done |
|
158 done |
|
159 |
|
160 rm -f tmp.oid.serial |
|
161 rm -f tmp.oid.serial.old |
|
162 rm -f SerialTest.class |
|
163 |
|
164 exit 0 |