Dmitriy Ivanov | 775f1e8 | 2014-04-03 16:51:24 -0700 | [diff] [blame] | 1 | # Copyright (C) 2014 The Android Open Source Project |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the 'License'); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an 'AS IS' BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | root_dir=`realpath \`dirname $0\`/../../` |
| 16 | |
| 17 | if [ -z "$ANDROID_SERIAL" ]; then |
| 18 | echo "Please set up ANDORID_SERAL enviroment variable" |
| 19 | exit -1 |
| 20 | fi |
| 21 | |
Dmitriy Ivanov | c891ee6 | 2014-05-23 18:17:26 -0700 | [diff] [blame^] | 22 | if [ -z "$1" ]; then |
| 23 | echo "Usage runtest.sh test-name" |
| 24 | exit -1; |
| 25 | fi |
| 26 | |
| 27 | test_name=$1 |
Dmitriy Ivanov | 775f1e8 | 2014-04-03 16:51:24 -0700 | [diff] [blame] | 28 | test_local=out/target/product/hammerhead/data/nativetest/$test_name/$test_name |
| 29 | test_target=/data/nativetest/$test_name/$test_name |
| 30 | |
| 31 | cd $root_dir |
| 32 | adb push $test_local $test_target |
| 33 | |
| 34 | logfile_native=$test_name.stdout.log |
| 35 | logfile_valgrind=$test_name.stdout.vlog |
| 36 | |
| 37 | # reference point |
| 38 | echo "Creating reference point log (run without valgrind)..." |
| 39 | adb shell $test_target > $logfile_native |
| 40 | # valgrind run |
| 41 | echo "Running test under valgrind..." |
| 42 | adb shell valgrind $test_target > $logfile_valgrind |
| 43 | |
| 44 | echo "Checking results..." |
| 45 | diff $logfile_native $logfile_valgrind | grep -v "^> ==" | grep -v -e "^[0-9]" > $test_name.diff.log |
| 46 | |
| 47 | if [ -s $test_name.diff.log ]; then |
| 48 | echo "Test $test_name FAILED, please check the diff below" |
| 49 | cat $test_name.diff.log | sed "s/^< /expected: /" | sed "s/^> /actual : /" |
| 50 | exit -2 |
| 51 | fi |
| 52 | |
| 53 | echo "Test $test_name PASSED" |
| 54 | |