############################################################################# # Copyright (c) 2013 Linaro # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html # # Contributors: # Linaro ############################################################################# usage() { echo "" echo "Usage: $0 [-h] [-t testnames]" echo "" echo "Runs all tests if no arguments are given." echo "" echo "-h prints this help mesage." echo "-t testnames, run specified tests." echo " currently supported:" echo " ashmem" echo " ashmem_expanded" echo " binder" echo " sync" echo " vfat" echo " swp-swpb" echo "" echo "example:" echo "$ linaro-android-kernel-tests -t \"logger binder\"" } run_ashmemtest() { echo "Running basic ashmemtest." ashmemtest } run_ashmemtest_expanded() { echo "Running expanded ashmemtest." DIR=/data/linaro-android-kernel-test/ashmemtest-expanded OUT_DIR=/data/local/tmp/linaro-android-kernel-test/ mkdir $OUT_DIR FILES=$DIR/*.txt for f in $FILES do BASENAME=${f##*/} TESTNAME="${BASENAME%.*}" echo "running $TESTNAME" ashmemtest-expanded $f &> $OUT_DIR/tmp.out diff $OUT_DIR/tmp.out $DIR/$TESTNAME.out > /dev/null if [ $? -eq 0 ]; then cat $OUT_DIR/tmp.out echo "[ashmem_expanded_$TESTNAME]: test passed" else cat $OUT_DIR/tmp.out echo "[ashmem_expanded_$TESTNAME]: test failed" fi rm $OUT_DIR/tmp.out done } run_binder_test() { echo "Running binder test." bindertest.sh } run_sync_test() { echo "Running sync test." sync-basic } run_vfat_test() { echo "Running vfat test." vfat-volid-test.sh } run_swp_swpb_test(){ echo "Running swp-swpb test." swp-test-static } run_all() { echo "Running all tests" TESTS="ashmem ashmem_expanded binder sync vfat swp-swpb" run_tests } run_tests() { for TEST in $TESTS; do case $TEST in ashmem) run_ashmemtest ;; ashmem_expanded) run_ashmemtest_expanded ;; binder) run_binder_test ;; sync) run_sync_test ;; vfat) run_vfat_test ;; swp-swpb) run_swp_swpb_test ;; *) echo "" echo "Unrecognized test $TEST." usage exit ;; esac done } TESTS= # no input argument # run all tests if [ $# -eq 0 ]; then run_all exit fi while getopts "ht:" OPT do case $OPT in h) usage exit 1 ;; t) TESTS=$OPTARG ;; *) usage exit esac done run_tests