source: trunk/openjdk/jdk/test/tools/launcher/versionOpt.sh

Last change on this file was 278, checked in by dmik, 14 years ago

trunk: Merged in openjdk6 b22 from branches/vendor/oracle.

File size: 2.8 KB
Line 
1#!/bin/sh
2
3#
4# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
5# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6#
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
9# published by the Free Software Foundation.
10#
11# This code is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14# version 2 for more details (a copy is included in the LICENSE file that
15# accompanied this code).
16#
17# You should have received a copy of the GNU General Public License version
18# 2 along with this work; if not, write to the Free Software Foundation,
19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20#
21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22# or visit www.oracle.com if you need additional information or have any
23# questions.
24#
25
26
27# @test
28# @bug 6545058
29# @summary test -version and -fullversion and compare with -J option
30# @run shell versionOpt.sh
31
32if [ "${TESTJAVA}" = "" ]; then
33 echo "TESTJAVA not set. Test cannot execute. Failed."
34 exit 1
35fi
36echo "TESTJAVA=${TESTJAVA}"
37
38# set platform-dependent variables
39OS=`uname -s`
40case "$OS" in
41 SunOS | Linux )
42 NULL=/dev/null
43 PS=":"
44 FS="/"
45 ;;
46 Windows*|CYGWIN* )
47 NULL=NUL
48 PS=";"
49 FS="\\"
50 ;;
51 * )
52 echo "Unrecognized system!"
53 exit 1;
54 ;;
55esac
56
57# create reference files based on java values
58${TESTJAVA}${FS}bin${FS}java -version 2>&1 | \
59 grep -v HotSpot > version.ref.out
60
61${TESTJAVA}${FS}bin${FS}java -fullversion > fullversion.ref.out 2>&1
62
63
64# A list of all the known (common to Unix and Windows) programs in the bin
65# directory, which accept -J argument and outputs the version strings to stderr.
66PLIST="\
67appletviewer \
68apt \
69extcheck \
70idlj \
71jar \
72jarsigner \
73javac \
74javadoc \
75javah \
76javap \
77jconsole \
78jdb \
79jhat \
80jinfo \
81jmap \
82jps \
83jstack \
84jstat \
85jstatd \
86keytool \
87native2ascii \
88orbd \
89pack200 \
90policytool \
91rmic \
92rmid \
93rmiregistry \
94schemagen \
95serialver \
96servertool \
97tnameserv \
98wsgen \
99wsimport \
100xjc"
101
102
103for prog in $PLIST; do
104 versionOut="$prog.version.out"
105 fversionOut="$prog.full.version.out"
106
107 ${TESTJAVA}${FS}bin${FS}${prog} -J-version 2>&1 | \
108 grep -v HotSpot > $versionOut
109
110 cat $versionOut
111 diff -c version.ref.out $versionOut
112 version_result=$?
113
114 ${TESTJAVA}${FS}bin${FS}${prog} -J-fullversion > $fversionOut 2>&1
115
116 cat $fversionOut
117 diff -c fullversion.ref.out $fversionOut
118 fullversion_result=$?
119
120 if [ $version_result -eq 0 -a $fullversion_result -eq 0 ]; then
121 printf "%s:Pass\n" $prog
122 else
123 printf "%s:Fail\n" $prog
124 exit 1
125 fi
126done
127exit 0
Note: See TracBrowser for help on using the repository browser.