test/tools/launcher/ChangeDataModel.sh

Print this page




  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 
  24 # @test
  25 # @bug 4894330 4810347 6277269
  26 # @run shell ChangeDataModel.sh
  27 # @summary Verify -d32 and -d64 options are accepted(rejected) on all platforms 
  28 # @author Joseph D. Darcy
  29 
  30 OS=`uname -s`;
  31 



  32 case "$OS" in
  33         Windows* | CYGWIN* )
  34           PATHSEP=";"
  35           ;;
  36 
  37         * )
  38           PATHSEP=":"
  39         ;;
  40 esac
  41 
  42 # Verify directory context variables are set
  43 if [ "${TESTJAVA}" = "" ]
  44 then
  45   echo "TESTJAVA not set.  Test cannot execute.  Failed."
  46   exit 1
  47 fi
  48 
  49 if [ "${TESTSRC}" = "" ]
  50 then
  51   echo "TESTSRC not set.  Test cannot execute.  Failed."


  62 JAVA="$TESTJAVA/bin/java -classpath $TESTCLASSES${PATHSEP}."
  63 JAVAC="$TESTJAVA/bin/javac"
  64 
  65 
  66 # Create our little Java test on the fly
  67 ( printf "public class GetDataModel {"
  68   printf "   public static void main(String argv[]) {"
  69   printf "      System.out.println(System.getProperty(\"sun.arch.data.model\", \"none\"));"
  70   printf "   }"
  71   printf "}"
  72 ) > GetDataModel.java
  73 
  74 $JAVAC GetDataModel.java
  75 
  76 
  77 # All preconditions are met; run the tests.
  78 
  79 
  80 # Verify data model flag for default data model is accepted
  81 
  82 DM=`$JAVA GetDataModel`
  83 case "$DM" in
  84         32 )
  85                 DM2=`${JAVA} -d32 GetDataModel` 
  86                 if [ "${DM2}" != "32" ]
  87                 then
  88                 echo "Data model flag -d32 not accepted or had improper effect."
  89                 exit 1
  90                 fi
  91         ;;
  92 
  93         64 )
  94                 DM2=`${JAVA} -d64 GetDataModel` 
  95                 if [ "${DM2}" != "64" ]
  96                 then
  97                 echo "Data model flag -d64 not accepted or had improper effect."
  98                 exit 1
  99                 fi
 100         ;;
 101 
 102         * )
 103                 echo "Unrecognized data model: $DM"
 104                 exit 1
 105         ;;
 106 esac
 107 
 108 # Determine if platform might be dual-mode capable.
 109 
 110 case "$OS" in
 111         SunOS )
 112                 # ARCH should be sparc or i386
 113                 ARCH=`uname -p`
 114                 case "${ARCH}" in 


 210                 DM2=`${JAVA64} -d64 GetDataModel`
 211                 if [ "${DM2}" != "64" ]
 212                 then
 213                   echo "Data model flag -d64 not accepted or had improper effect."
 214                   exit 1
 215                 fi
 216 
 217                 DM2=`${JAVA64} -d32 GetDataModel`
 218                 if [ "${DM2}" != "32" ]
 219                 then
 220                   echo "Data model flag -d32 not accepted or had improper effect."
 221                   exit 1
 222                 fi
 223 
 224         else
 225           echo "Warning: no 64-bit components found; only one data model tested."
 226         fi
 227 else
 228 # Negative tests for non-dual mode platforms to ensure the other data model is 
 229 # rejected
 230         DM=`$JAVA GetDataModel`
 231         case "$DM" in
 232            32 )
 233                 DM2=`${JAVA} -d64 GetDataModel` 
 234                 if [ "x${DM2}" != "x" ]
 235                 then
 236                    echo "Data model flag -d64 was accepted."
 237                    exit 1
 238                 fi
 239            ;;
 240 
 241            64 )
 242                 DM2=`${JAVA} -d32 GetDataModel` 
 243                 if [ "x${DM2}" != "x" ]
 244                   then
 245                     echo "Data model flag -d32 was accepted."
 246                     exit 1
 247                 fi
 248            ;;
 249 
 250            * )
 251                 echo "Unrecognized data model: $DM"
 252                 exit 1
 253            ;;
 254         esac
 255 fi
 256 
 257 exit 0;


  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 
  24 # @test
  25 # @bug 4894330 4810347 6277269
  26 # @run shell ChangeDataModel.sh
  27 # @summary Verify -d32 and -d64 options are accepted(rejected) on all platforms 
  28 # @author Joseph D. Darcy
  29 
  30 OS=`uname -s`;
  31 
  32 # To remove CR from output, needed for java apps in CYGWIN, harmless otherwise
  33 SED_CR="sed -e 's@\\r@@g'"
  34 
  35 case "$OS" in
  36         Windows* | CYGWIN* )
  37           PATHSEP=";"
  38           ;;
  39 
  40         * )
  41           PATHSEP=":"
  42         ;;
  43 esac
  44 
  45 # Verify directory context variables are set
  46 if [ "${TESTJAVA}" = "" ]
  47 then
  48   echo "TESTJAVA not set.  Test cannot execute.  Failed."
  49   exit 1
  50 fi
  51 
  52 if [ "${TESTSRC}" = "" ]
  53 then
  54   echo "TESTSRC not set.  Test cannot execute.  Failed."


  65 JAVA="$TESTJAVA/bin/java -classpath $TESTCLASSES${PATHSEP}."
  66 JAVAC="$TESTJAVA/bin/javac"
  67 
  68 
  69 # Create our little Java test on the fly
  70 ( printf "public class GetDataModel {"
  71   printf "   public static void main(String argv[]) {"
  72   printf "      System.out.println(System.getProperty(\"sun.arch.data.model\", \"none\"));"
  73   printf "   }"
  74   printf "}"
  75 ) > GetDataModel.java
  76 
  77 $JAVAC GetDataModel.java
  78 
  79 
  80 # All preconditions are met; run the tests.
  81 
  82 
  83 # Verify data model flag for default data model is accepted
  84 
  85 DM=`$JAVA GetDataModel | ${SED_CR}`
  86 case "$DM" in
  87         32 )
  88                 DM2=`${JAVA} -d32 GetDataModel | ${SED_CR}`     
  89                 if [ "${DM2}" != "32" ]
  90                 then
  91                 echo "Data model flag -d32 not accepted or had improper effect."
  92                 exit 1
  93                 fi
  94         ;;
  95 
  96         64 )
  97                 DM2=`${JAVA} -d64 GetDataModel | ${SED_CR}`     
  98                 if [ "${DM2}" != "64" ]
  99                 then
 100                 echo "Data model flag -d64 not accepted or had improper effect."
 101                 exit 1
 102                 fi
 103         ;;
 104 
 105         * )
 106                 echo "Unrecognized data model: $DM"
 107                 exit 1
 108         ;;
 109 esac
 110 
 111 # Determine if platform might be dual-mode capable.
 112 
 113 case "$OS" in
 114         SunOS )
 115                 # ARCH should be sparc or i386
 116                 ARCH=`uname -p`
 117                 case "${ARCH}" in 


 213                 DM2=`${JAVA64} -d64 GetDataModel`
 214                 if [ "${DM2}" != "64" ]
 215                 then
 216                   echo "Data model flag -d64 not accepted or had improper effect."
 217                   exit 1
 218                 fi
 219 
 220                 DM2=`${JAVA64} -d32 GetDataModel`
 221                 if [ "${DM2}" != "32" ]
 222                 then
 223                   echo "Data model flag -d32 not accepted or had improper effect."
 224                   exit 1
 225                 fi
 226 
 227         else
 228           echo "Warning: no 64-bit components found; only one data model tested."
 229         fi
 230 else
 231 # Negative tests for non-dual mode platforms to ensure the other data model is 
 232 # rejected
 233         DM=`$JAVA GetDataModel | ${SED_CR}`
 234         case "$DM" in
 235            32 )
 236                 DM2=`${JAVA} -d64 GetDataModel | ${SED_CR}`     
 237                 if [ "x${DM2}" != "x" ]
 238                 then
 239                    echo "Data model flag -d64 was accepted."
 240                    exit 1
 241                 fi
 242            ;;
 243 
 244            64 )
 245                 DM2=`${JAVA} -d32 GetDataModel | ${SED_CR}`     
 246                 if [ "x${DM2}" != "x" ]
 247                   then
 248                     echo "Data model flag -d32 was accepted."
 249                     exit 1
 250                 fi
 251            ;;
 252 
 253            * )
 254                 echo "Unrecognized data model: $DM"
 255                 exit 1
 256            ;;
 257         esac
 258 fi
 259 
 260 exit 0;