1#!/bin/bash -e
2
3readonly UNAME="$(uname)"
4case "$UNAME" in
5Linux)
6    readonly OS='linux'
7    ;;
8Darwin)
9    readonly OS='darwin'
10    ;;
11*)
12    echo "Unsupported OS '$UNAME'"
13    exit 1
14    ;;
15esac
16
17readonly ANDROID_TOP="$(cd $(dirname $0)/../../..; pwd)"
18cd "$ANDROID_TOP"
19
20export OUT_DIR="${OUT_DIR:-out}"
21readonly SOONG_OUT="${OUT_DIR}/soong"
22
23build/soong/soong_ui.bash --make-mode "${SOONG_OUT}/host/${OS}-x86/bin/cuj_tests"
24
25"${SOONG_OUT}/host/${OS}-x86/bin/cuj_tests" || true
26
27if [ -n "${DIST_DIR}" ]; then
28  cp -r "${OUT_DIR}/cuj_tests/logs" "${DIST_DIR}"
29fi
30