1 #!/bin/sh
   2 #
   3 # Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
   4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5 #
   6 # This code is free software; you can redistribute it and/or modify it
   7 # under the terms of the GNU General Public License version 2 only, as
   8 # published by the Free Software Foundation.
   9 #
  10 # This code is distributed in the hope that it will be useful, but WITHOUT
  11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13 # version 2 for more details (a copy is included in the LICENSE file that
  14 # accompanied this code).
  15 #
  16 # You should have received a copy of the GNU General Public License version
  17 # 2 along with this work; if not, write to the Free Software Foundation,
  18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19 #
  20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21 # or visit www.oracle.com if you need additional information or have any
  22 # questions.
  23 #
  24 
  25 #
  26 # Usage: batch.sh classpath classes...
  27 #
  28 
  29 if [ $# -lt 2 ]
  30 then
  31     echo "Usage: `basename $0` classpath classes..."
  32     exit 1
  33 fi
  34 
  35 if [ "${TESTJAVA}" = "" ]
  36 then
  37     echo "TESTJAVA not set.  Test cannot execute.  Failed."
  38     exit 1
  39 fi
  40 
  41 refv11dir=./ref-v1.1-output
  42 refvcompatdir=./ref-vcompat-output
  43 refv12dir=./ref-v1.2-output
  44 
  45 newv11dir=./new-v1.1-output
  46 newvcompatdir=./new-vcompat-output
  47 newv12dir=./new-v1.2-output
  48 
  49 v11diffs=./diffs-v1.1
  50 vcompatdiffs=./diffs-vcompat
  51 v12diffs=./diffs-v1.2
  52 
  53 difflines=./diff-lines
  54 
  55 rm -rf $refv11dir $refvcompatdir $refv12dir
  56 rm -rf $newv11dir $newvcompatdir $newv12dir
  57 rm -f $v11diffs $vcompatdiffs $v12diffs $difflines
  58 
  59 mkdir $refv11dir $refvcompatdir $refv12dir
  60 mkdir $newv11dir $newvcompatdir $newv12dir
  61 
  62 set -ex
  63 
  64 ${TESTJAVA}/bin/rmic       -keep -nowrite -v1.1 -d $refv11dir -classpath "$@"
  65 ${TESTJAVA}/bin/rmic       -keep -nowrite -vcompat -d $refvcompatdir -classpath "$@"
  66 ${TESTJAVA}/bin/rmic       -keep -nowrite -v1.2 -d $refv12dir -classpath "$@"
  67 
  68 ${TESTJAVA}/bin/rmic -Xnew -keep -nowrite -v1.1 -d $newv11dir -classpath "$@"
  69 ${TESTJAVA}/bin/rmic -Xnew -keep -nowrite -vcompat -d $newvcompatdir -classpath "$@"
  70 ${TESTJAVA}/bin/rmic -Xnew -keep -nowrite -v1.2 -d $newv12dir -classpath "$@"
  71 
  72 set +ex
  73 
  74 diff -r $refv11dir $newv11dir > $v11diffs
  75 diff -r $refvcompatdir $newvcompatdir > $vcompatdiffs
  76 diff -r $refv12dir $newv12dir > $v12diffs
  77 
  78 cat $v11diffs $vcompatdiffs $v12diffs | grep '^[<>O]' | fgrep -v ' server = (' > $difflines
  79 
  80 if [ `cat $difflines | wc -l` -gt 0 ]
  81 then
  82     cat $v11diffs $vcompatdiffs $v12diffs
  83     echo "TEST FAILED: unexpected diffs"
  84     exit 1
  85 fi
  86 
  87 echo "TEST PASSED: new rmic output identical to reference rmic output"
  88 
  89 rm -rf $refv11dir $refvcompatdir $refv12dir
  90 rm -rf $newv11dir $newvcompatdir $newv12dir
  91 rm -f $v11diffs $vcompatdiffs $v12diffs $difflines