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 assert_not_root_user
# Flags # 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 # Parse command line
FLAGS "$@" || exit 1 FLAGS "$@" || exit 1
@ -20,16 +23,23 @@ eval set -- "${FLAGS_ARGV}"
# Die on error; print commands # Die on error; print commands
set -e set -e
TEST_DIRS="pam_google window_manager cryptohome"
if [ -n "$FLAGS_board" ]
then
sudo TEST_DIRS="${TEST_DIRS}" \
emerge-${FLAGS_board} chromeos-base/chromeos-unittests
else
PLATFORM_DIR="$SRC_ROOT/platform" PLATFORM_DIR="$SRC_ROOT/platform"
PLATFORM_DIRS="pam_google window_manager cryptohome"
# Build tests # Build tests
for i in $PLATFORM_DIRS for i in ${TEST_DIRS}
do do
echo "building $PLATFORM_DIR/$i" echo "building $PLATFORM_DIR/$i"
cd "$PLATFORM_DIR/$i" cd "$PLATFORM_DIR/$i"
./make_tests.sh OUT_DIR="${FLAGS_build_root}/x86/tests" ./make_tests.sh
cd - cd -
done done
echo "All tests built." echo "All tests built."
fi

View File

@ -11,6 +11,8 @@
# Flags # Flags
DEFINE_string build_root "$DEFAULT_BUILD_ROOT" \ DEFINE_string build_root "$DEFAULT_BUILD_ROOT" \
"Root of build output" "Root of build output"
DEFINE_string board "" \
"Target board of which tests were built"
# Parse command line # Parse command line
FLAGS "$@" || exit 1 FLAGS "$@" || exit 1
@ -20,11 +22,21 @@ eval set -- "${FLAGS_ARGV}"
set -ex set -ex
# Run tests # Run tests
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" TESTS_DIR="$FLAGS_build_root/x86/tests"
cd "$TESTS_DIR" cd "$TESTS_DIR"
# TODO: standardize test names - should all end in "_test" # TODO: standardize test names - should all end in "_test"
for i in *_test *_tests *_unittests; do ./${i}; done for i in *_test *_tests *_unittests; do ! ./${i}; done
cd - cd -
echo "All tests passed." echo "All tests passed."
fi