Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: src/scripts/build_autotest.sh

Issue 633001: fixup autoupdate for new build system (Closed)
Patch Set: per review comments Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/platform/memento_softwareupdate/ping_omaha.sh ('k') | src/scripts/get_latest_image.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # This script makes autotest client tests inside a chroot environment. The idea 7 # This script makes autotest client tests inside an Ubuntu chroot
8 # is to compile any platform-dependent autotest client tests in the build 8 # environment. The idea is to compile any platform-dependent autotest
9 # environment, since client systems under test lack the proper toolchain. 9 # client tests in the build environment, since client systems under
10 # test lack the proper toolchain.
10 # 11 #
11 # The user can later run autotest against an ssh enabled test client system, or 12 # The user can later run autotest against an ssh enabled test client system, or
12 # install the compiled client tests directly onto the rootfs image. 13 # install the compiled client tests directly onto the rootfs image, using
14 # mod_image_for_test.sh.
13 15
14 . "$(dirname "$0")/common.sh" 16 . "$(dirname "$0")/common.sh"
15 . "$(dirname $0)/autotest_lib.sh" 17 . "$(dirname "$0")/autotest_lib.sh"
16 18
17 # Script must be run inside the chroot 19 # Script must be run inside the chroot
18 assert_inside_chroot 20 assert_inside_chroot
19 21
20 DEFAULT_TESTS_LIST="all" 22 DEFAULT_CONTROL=client/site_tests/setup/control
21 23
22 DEFINE_string build "${DEFAULT_TESTS_LIST}" \ 24 DEFINE_string control "${DEFAULT_CONTROL}" \
23 "a comma seperated list of autotest client tests to be prebuilt." b 25 "Setup control file -- path relative to the destination autotest directory" c
24 DEFINE_boolean prompt $FLAGS_TRUE "Prompt user when building all tests" 26 DEFINE_string board "" \
27 "Board name for the target you are building if using portage build system"
28
29 DEFINE_string board "" \
30 "The board for which you are building autotest"
25 31
26 # More useful help 32 # More useful help
27 FLAGS_HELP="usage: $0 [flags]" 33 FLAGS_HELP="usage: $0 [flags]"
28 34
29 # parse the command-line 35 # parse the command-line
30 FLAGS "$@" || exit 1 36 FLAGS "$@" || exit 1
31 eval set -- "${FLAGS_ARGV}" 37 eval set -- "${FLAGS_ARGV}"
32 set -e 38 set -e
33 39
34 check_board 40 AUTOTEST_SRC="${GCLIENT_ROOT}/src/third_party/autotest/files"
41 # Destination in chroot to install autotest.
42 AUTOTEST_DEST="/usr/local/autotest/${FLAGS_board}"
35 43
36 # build default pre-compile client tests list. 44 # If new build system flag passed, use ebuild and exit
37 ALL_TESTS="compilebench,dbench,disktest,ltp,unixbench" 45 if [ -n "${FLAGS_board}" ]; then
38 for SITE_TEST in ../third_party/autotest/files/client/site_tests/* 46 sudo GCLIENT_ROOT="${GCLIENT_ROOT}" FLAGS_control=${FLAGS_control} \
39 do 47 "emerge-${FLAGS_board}" -a chromeos-base/autotest
40 if [ -d ${SITE_TEST} ] 48 exit 0
41 then
42 ALL_TESTS="${ALL_TESTS},${SITE_TEST:48}"
43 fi
44 done
45
46 if [ ${FLAGS_build} == ${DEFAULT_TESTS_LIST} ]
47 then
48 if [ ${FLAGS_prompt} -eq ${FLAGS_TRUE} ]
49 then
50 echo -n "You want to pre-build all client tests and it may take a long time"
51 echo " to finish. "
52 read -p "Are you sure you want to continue?(N/y)" answer
53 answer=${answer:0:1}
54 if [ "${answer}" != "Y" ] && [ "${answer}" != "y" ]
55 then
56 echo "Use --build to specify tests you like to pre-compile."
57 echo -n "E.g.: ./enter_chroot.sh \"./build_autotest.sh "
58 echo "--build=system_SAT\""
59 exit 0
60 fi
61 fi
62 TEST_LIST=${ALL_TESTS}
63 else
64 TEST_LIST=${FLAGS_build}
65 fi 49 fi
66 50
67 GCLIENT_ROOT="${GCLIENT_ROOT}" TEST_LIST=${TEST_LIST} \ 51 # Copy a local "installation" of autotest into the chroot, to avoid
68 "emerge-${FLAGS_board}" chromeos-base/autotest 52 # polluting the src dir with tmp files, results, etc.
53 update_chroot_autotest "${CHROOT_TRUNK_DIR}/src/third_party/autotest/files" \
54 "${AUTOTEST_DEST}"
55
56 # Create python package init files for top level test case dirs.
57 function touchInitPy() {
58 local dirs=${1}
59 for base_dir in $dirs
60 do
61 local sub_dirs="$(find ${base_dir} -maxdepth 1 -type d)"
62 for sub_dir in ${sub_dirs}
63 do
64 touch ${sub_dir}/__init__.py
65 done
66 touch ${base_dir}/__init__.py
67 done
68 }
69
70 cd ${AUTOTEST_DEST}
71 touchInitPy client/tests client/site_tests
72 touch __init__.py
73
74 # Export GCLIENT_ROOT so that tests have access to the source and build trees
75 export GCLIENT_ROOT
76
77 # run the magic test setup script.
78 echo "Building tests using ${FLAGS_control}..."
79 client/bin/autotest ${FLAGS_control}
OLDNEW
« no previous file with comments | « src/platform/memento_softwareupdate/ping_omaha.sh ('k') | src/scripts/get_latest_image.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698