1#!/bin/bash
2#
3# Copyright (C) 2014 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# ensure flags includes prebuild and relocate. It doesn't make sense unless we
18# have a oat file we want to relocate.
19flags="$@"
20
21# This test is supposed to test with oat files. Make sure that the no-prebuild flag isn't set,
22# or complain.
23# Note: prebuild is the default.
24if [[ "${flags}" == *--no-prebuild* ]] ; then
25  echo "Test 117-nopatchoat is not intended to run in no-prebuild mode."
26  exit 1
27fi
28
29# This test is supposed to test relocation. Make sure that the no-relocate flag isn't set,
30# or complain.
31# Note: relocate is the default.
32if [[ "${flags}" == *--no-relocate* ]] ; then
33  echo "Test 117-nopatchoat is not intended to run in no-relocate mode."
34  exit 1
35fi
36
37# Make sure we can run without relocation
38echo "Run without dex2oat/patchoat"
39${RUN} ${flags} --runtime-option -Xnodex2oat
40return_status1=$?
41
42# Make sure we can run with the oat file.
43echo "Run with dexoat/patchoat"
44${RUN} ${flags} --runtime-option -Xdex2oat
45return_status2=$?
46
47# Make sure we can run with the default settings.
48echo "Run default"
49${RUN} ${flags}
50return_status3=$?
51
52# Make sure we don't silently ignore an early failure.
53(exit $return_status1) && (exit $return_status2) && (exit $return_status3)
54