Home | History | Annotate | Download | only in 003-magic-version-access
      1 #!/bin/bash
      2 #
      3 # Copyright (C) 2007 The Android Open Source Project
      4 #
      5 # Licensed under the Apache License, Version 2.0 (the "License");
      6 # you may not use this file except in compliance with the License.
      7 # You may obtain a copy of the License at
      8 #
      9 #     http://www.apache.org/licenses/LICENSE-2.0
     10 #
     11 # Unless required by applicable law or agreed to in writing, software
     12 # distributed under the License is distributed on an "AS IS" BASIS,
     13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 # See the License for the specific language governing permissions and
     15 # limitations under the License.
     16 
     17 # The tests that don't specify "--debug" are expected to
     18 # throw exceptions.  If --debug is on we'll get a stack
     19 # trace, which is unpredictable and doesn't work well with
     20 # expected.txt vs. out.txt comparisons.
     21 
     22 function check_rejected {
     23   dx --dump --width=100 --strict $1
     24 }
     25 
     26 function check_accepted {
     27   dx --debug --dump --width=100 $1
     28 }
     29 
     30 # Bad magic (throws an expection)
     31 check_rejected class-bad-magic.txt
     32 
     33 # Too small (throws an exception)
     34 check_rejected class-version-44.0.txt
     35 check_rejected class-version-44.65535.txt
     36 
     37 # Just right
     38 check_accepted class-version-45.0.txt
     39 check_accepted class-version-45.65535.txt
     40 check_accepted class-version-48.0.txt
     41 check_accepted class-version-48.65535.txt
     42 check_accepted class-version-49.0.txt
     43 check_accepted class-version-49.1.txt
     44 check_accepted class-version-49.65535.txt
     45 check_accepted class-version-50.0.txt
     46 check_accepted class-version-50.1.txt
     47 check_accepted class-version-50.65535.txt
     48 check_accepted class-version-51.0.txt
     49 check_accepted class-version-51.65535.txt
     50 check_accepted class-version-52.0.txt
     51 
     52 # Too big (throws an exception)
     53 check_rejected class-version-52.1.txt
     54 check_rejected class-version-52.65535.txt
     55 check_rejected class-version-53.0.txt
     56 
     57 # Show that we can dump the access flags even when they
     58 # don't make any sense.
     59 check_accepted small-class.txt
     60