Adds changes to unittest scripts to use ebuild if board is specified

Review URL: http://codereview.chromium.org/614005
This commit is contained in:
Chris Sosa 2010-02-17 16:38:21 -08:00
parent 58966860a3
commit a221aab08c
2 changed files with 41 additions and 19 deletions

View File

@ -12,6 +12,9 @@ assert_inside_chroot
assert_not_root_user
# Flags
DEFINE_string build_root "$DEFAULT_BUILD_ROOT" \
"Root of build output"
DEFINE_string board "" "Target board for which tests are to be built"
# Parse command line
FLAGS "$@" || exit 1
@ -20,16 +23,23 @@ eval set -- "${FLAGS_ARGV}"
# Die on error; print commands
set -e
PLATFORM_DIR="$SRC_ROOT/platform"
PLATFORM_DIRS="pam_google window_manager cryptohome"
TEST_DIRS="pam_google window_manager cryptohome"
# Build tests
for i in $PLATFORM_DIRS
do
echo "building $PLATFORM_DIR/$i"
cd "$PLATFORM_DIR/$i"
./make_tests.sh
cd -
done
if [ -n "$FLAGS_board" ]
then
sudo TEST_DIRS="${TEST_DIRS}" \
emerge-${FLAGS_board} chromeos-base/chromeos-unittests
else
PLATFORM_DIR="$SRC_ROOT/platform"
# Build tests
for i in ${TEST_DIRS}
do
echo "building $PLATFORM_DIR/$i"
cd "$PLATFORM_DIR/$i"
OUT_DIR="${FLAGS_build_root}/x86/tests" ./make_tests.sh
cd -
done
echo "All tests built."
echo "All tests built."
fi

View File

@ -11,6 +11,8 @@
# Flags
DEFINE_string build_root "$DEFAULT_BUILD_ROOT" \
"Root of build output"
DEFINE_string board "" \
"Target board of which tests were built"
# Parse command line
FLAGS "$@" || exit 1
@ -20,11 +22,21 @@ eval set -- "${FLAGS_ARGV}"
set -ex
# Run tests
TESTS_DIR="$FLAGS_build_root/x86/tests"
cd "$TESTS_DIR"
# TODO: standardize test names - should all end in "_test"
for i in *_test *_tests *_unittests; do ./${i}; done
cd -
echo "All tests passed."
if [ -n "$FLAGS_board" ]
then
TESTS_DIR="/build/${FLAGS_board}/tests"
echo "Not implemented" >&2
exit 1
# TODO(sosa@chromium.org) - Call autotest job to run tests from TESTS_DIR
# using run_remote_tests
else
TESTS_DIR="$FLAGS_build_root/x86/tests"
cd "$TESTS_DIR"
# TODO: standardize test names - should all end in "_test"
for i in *_test *_tests *_unittests; do ! ./${i}; done
cd -
echo "All tests passed."
fi