blob: 19bbacf64c3105740b3f4ee56e367629082770ef [file] [log] [blame]
Colin Cross2722ebb2016-07-11 16:20:06 -07001#!/bin/bash -e
2
3. $(dirname $0)/../build/run-on-host.sh
4
Dan Albertb9bc5092023-07-19 18:37:43 +00005if [ "$1" = glibc -o "$1" = musl ]; then
6 if [ "$1" = musl ]; then
7 BUILD_ARGS=USE_HOST_MUSL=true
8 else
9 BUILD_ARGS=
10 fi
Elliott Hughes8ceb95c2019-03-26 14:47:08 -070011 shift
Dan Albertb9bc5092023-07-19 18:37:43 +000012 m -j $BUILD_ARGS bionic-unit-tests-glibc
Elliott Hughes8ceb95c2019-03-26 14:47:08 -070013 (
14 cd ${ANDROID_BUILD_TOP}
15 export ANDROID_DATA=${TARGET_OUT_DATA}
16 export ANDROID_ROOT=${TARGET_OUT}
17 ${HOST_OUT}/nativetest64/bionic-unit-tests-glibc/bionic-unit-tests-glibc $@
18 )
19 exit 0
Colin Cross2722ebb2016-07-11 16:20:06 -070020elif [ "$1" != 32 -a "$1" != 64 ]; then
Dan Albertb9bc5092023-07-19 18:37:43 +000021 echo "Usage: $0 [ 32 | 64 | glibc | musl ] [gtest flags]"
Elliott Hughes8ceb95c2019-03-26 14:47:08 -070022 exit 1
Colin Cross2722ebb2016-07-11 16:20:06 -070023fi
24
25if [ ${HOST_OS}-${HOST_ARCH} = linux-x86 -o ${HOST_OS}-${HOST_ARCH} = linux-x86_64 ]; then
26
Elliott Hughes8ceb95c2019-03-26 14:47:08 -070027 prepare $1 bionic-unit-tests
Elliott Hughes4da99ff2019-04-26 15:12:57 -070028 shift
Colin Cross2722ebb2016-07-11 16:20:06 -070029
Elliott Hughes8ceb95c2019-03-26 14:47:08 -070030 if [ ${TARGET_ARCH} = x86 -o ${TARGET_ARCH} = x86_64 ]; then
31 (
32 cd ${ANDROID_BUILD_TOP}
33 export ANDROID_DATA=${TARGET_OUT_DATA}
34 export ANDROID_DNS_MODE=local
35 export ANDROID_ROOT=${TARGET_OUT}
36 ${NATIVETEST}/bionic-unit-tests/bionic-unit-tests $@
37 )
38 else
39 echo "$0 not supported on TARGET_ARCH=$TARGET_ARCH"
40 fi
Colin Cross2722ebb2016-07-11 16:20:06 -070041fi