1e5c31af7Sopenharmony_ci#!/usr/bin/env bash
2e5c31af7Sopenharmony_ci
3e5c31af7Sopenharmony_ci# Copyright 2019 The Amber Authors.
4e5c31af7Sopenharmony_ci#
5e5c31af7Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
6e5c31af7Sopenharmony_ci# you may not use this file except in compliance with the License.
7e5c31af7Sopenharmony_ci# You may obtain a copy of the License at
8e5c31af7Sopenharmony_ci#
9e5c31af7Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
10e5c31af7Sopenharmony_ci#
11e5c31af7Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
12e5c31af7Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
13e5c31af7Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14e5c31af7Sopenharmony_ci# See the License for the specific language governing permissions and
15e5c31af7Sopenharmony_ci# limitations under the License.
16e5c31af7Sopenharmony_ci
17e5c31af7Sopenharmony_ciargs=()
18e5c31af7Sopenharmony_ciindex=1
19e5c31af7Sopenharmony_ci
20e5c31af7Sopenharmony_ci# The @Q expansion operator requires Bash 4.4.
21e5c31af7Sopenharmony_ci
22e5c31af7Sopenharmony_cifor arg in "$@"
23e5c31af7Sopenharmony_cido
24e5c31af7Sopenharmony_ciargs+=("-e")
25e5c31af7Sopenharmony_ciargs+=("arg${index}")
26e5c31af7Sopenharmony_ciargs+=("${arg}")
27e5c31af7Sopenharmony_ciindex=$((index+1))
28e5c31af7Sopenharmony_cidone
29e5c31af7Sopenharmony_ci
30e5c31af7Sopenharmony_ciadb shell rm -f /sdcard/Android/data/com.google.amber/cache/amber_stdout.txt
31e5c31af7Sopenharmony_ciadb shell rm -f /sdcard/Android/data/com.google.amber/cache/amber_stderr.txt
32e5c31af7Sopenharmony_ciadb shell am instrument -w \
33e5c31af7Sopenharmony_ci  -e stdout /sdcard/Android/data/com.google.amber/cache/amber_stdout.txt \
34e5c31af7Sopenharmony_ci  -e stderr /sdcard/Android/data/com.google.amber/cache/amber_stderr.txt \
35e5c31af7Sopenharmony_ci  "${args[@]@Q}" \
36e5c31af7Sopenharmony_ci  com.google.amber.test/androidx.test.runner.AndroidJUnitRunner
37e5c31af7Sopenharmony_ciadb shell cat /sdcard/Android/data/com.google.amber/cache/amber_stdout.txt
38e5c31af7Sopenharmony_ciadb shell cat /sdcard/Android/data/com.google.amber/cache/amber_stderr.txt
39