1#!/bin/bash 2 3# Quit if any command produces an error. 4set -e 5 6BUILD_ONLY="false" 7while getopts "b" opt; do 8 case ${opt} in 9 b) 10 BUILD_ONLY="true" 11 ;; 12 esac 13done 14 15# Build and run the CHRE unit test binary. 16JOB_COUNT=$((`grep -c ^processor /proc/cpuinfo`)) 17 18# Export the variant Makefile. 19export CHRE_VARIANT_MK_INCLUDES="$CHRE_VARIANT_MK_INCLUDES \ 20 variant/googletest/variant.mk" 21 22export RUN_PAL_IMPL_TESTS=true 23 24make clean 25make google_x86_googletest_debug -j$JOB_COUNT 26 27if [ "$BUILD_ONLY" = "false" ]; then 28./out/google_x86_googletest_debug/libchre ${@:1} 29else 30 if [ ! -f ./out/google_x86_googletest_debug/libchre ]; then 31 echo "./out/google_x86_googletest_debug/libchre does not exist." 32 echo "run_pal_impl_test.sh failed to build the binary." 33 exit 1 34 fi 35fi