< prev index next >

test/java/lang/invoke/VarHandles/generate-vh-tests.sh

Print this page


   1 #!/bin/bash
   2 
   3 javac -d . ../../../../../make/src/classes/build/tools/spp/Spp.java
   4 
   5 SPP=build.tools.spp.Spp
   6 
   7 # Generates variable handle tests for objects and all primitive types
   8 # This is likely to be a temporary testing approach as it may be more
   9 # desirable to generate code using ASM which will allow more flexibility
  10 # in the kinds of tests that are generated.
  11 
  12 for type in boolean byte short char int long float double String
  13 do
  14   Type="$(tr '[:lower:]' '[:upper:]' <<< ${type:0:1})${type:1}"
  15   args="-K$type -Dtype=$type -DType=$Type"
  16 
  17   case $type in
  18     String|int|long)
  19       args="$args -KCAS"
  20       ;;
  21   esac
  22 
  23   case $type in
  24     int|long)
  25       args="$args -KAtomicAdd"
  26       ;;
  27   esac
  28 
  29   wrong_primitive_type=boolean
  30 
  31   case $type in
  32     boolean)
  33       value1=true
  34       value2=false
  35       value3=false
  36       wrong_primitive_type=int
  37       ;;
  38     byte)
  39       value1=(byte)1
  40       value2=(byte)2
  41       value3=(byte)3
  42       ;;
  43     short)
  44       value1=(short)1
  45       value2=(short)2
  46       value3=(short)3
  47       ;;
  48     char)
  49       value1=\'a\'
  50       value2=\'b\'
  51       value3=\'c\'
  52       ;;
  53     int)
  54       value1=1
  55       value2=2
  56       value3=3
  57       ;;
  58     long)
  59       value1=1L
  60       value2=2L
  61       value3=3L
  62       ;;
  63     float)
  64       value1=1.0f
  65       value2=2.0f
  66       value3=3.0f
  67       ;;
  68     double)
  69       value1=1.0d
  70       value2=2.0d
  71       value3=3.0d
  72       ;;
  73     String)
  74       value1=\"foo\"
  75       value2=\"bar\"
  76       value3=\"baz\"
  77       ;;
  78   esac
  79 
  80   args="$args -Dvalue1=$value1 -Dvalue2=$value2 -Dvalue3=$value3 -Dwrong_primitive_type=$wrong_primitive_type"
  81 


   1 #!/bin/bash
   2 
   3 javac -d . ../../../../../make/src/classes/build/tools/spp/Spp.java
   4 
   5 SPP=build.tools.spp.Spp
   6 
   7 # Generates variable handle tests for objects and all primitive types
   8 # This is likely to be a temporary testing approach as it may be more
   9 # desirable to generate code using ASM which will allow more flexibility
  10 # in the kinds of tests that are generated.
  11 
  12 for type in boolean byte short char int long float double String
  13 do
  14   Type="$(tr '[:lower:]' '[:upper:]' <<< ${type:0:1})${type:1}"
  15   args="-K$type -Dtype=$type -DType=$Type"
  16 
  17   case $type in
  18     String|boolean|byte|short|char|int|long)
  19       args="$args -KCAS"
  20       ;;
  21   esac
  22 
  23   case $type in
  24     byte|short|char|int|long)
  25       args="$args -KAtomicAdd"
  26       ;;
  27   esac
  28 
  29   wrong_primitive_type=boolean
  30 
  31   case $type in
  32     boolean)
  33       value1=true
  34       value2=false
  35       value3=false
  36       wrong_primitive_type=int
  37       ;;
  38     byte)
  39       value1=(byte)0x01
  40       value2=(byte)0x23
  41       value3=(byte)0x45
  42       ;;
  43     short)
  44       value1=(short)0x0123
  45       value2=(short)0x4567
  46       value3=(short)0x89AB
  47       ;;
  48     char)
  49       value1=\'\\\\u0123\'
  50       value2=\'\\\\u4567\'
  51       value3=\'\\\\u89AB\'
  52       ;;
  53     int)
  54       value1=0x01234567
  55       value2=0x89ABCDEF
  56       value3=0xCAFEBABE
  57       ;;
  58     long)
  59       value1=0x0123456789ABCDEFL
  60       value2=0xCAFEBABECAFEBABEL
  61       value3=0xDEADBEEFDEADBEEFL
  62       ;;
  63     float)
  64       value1=1.0f
  65       value2=2.0f
  66       value3=3.0f
  67       ;;
  68     double)
  69       value1=1.0d
  70       value2=2.0d
  71       value3=3.0d
  72       ;;
  73     String)
  74       value1=\"foo\"
  75       value2=\"bar\"
  76       value3=\"baz\"
  77       ;;
  78   esac
  79 
  80   args="$args -Dvalue1=$value1 -Dvalue2=$value2 -Dvalue3=$value3 -Dwrong_primitive_type=$wrong_primitive_type"
  81 


< prev index next >