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

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

Issue 646057: This commit reverts accidental change to build_autotest.sh (Closed)
Patch Set: 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 | « no previous file | no next file » | 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 an Ubuntu chroot 7 # This script makes autotest client tests inside a chroot environment. The idea
8 # environment. The idea is to compile any platform-dependent autotest 8 # is to compile any platform-dependent autotest client tests in the build
9 # client tests in the build environment, since client systems under 9 # environment, since client systems under test lack the proper toolchain.
10 # test lack the proper toolchain.
11 # 10 #
12 # The user can later run autotest against an ssh enabled test client system, or 11 # The user can later run autotest against an ssh enabled test client system, or
13 # install the compiled client tests directly onto the rootfs image, using 12 # install the compiled client tests directly onto the rootfs image.
14 # mod_image_for_test.sh.
15 13
16 . "$(dirname "$0")/common.sh" 14 . "$(dirname "$0")/common.sh"
17 . "$(dirname "$0")/autotest_lib.sh" 15 . "$(dirname $0)/autotest_lib.sh"
18 16
19 # Script must be run inside the chroot 17 # Script must be run inside the chroot
20 assert_inside_chroot 18 assert_inside_chroot
21 19
22 DEFAULT_CONTROL=client/site_tests/setup/control 20 DEFAULT_TESTS_LIST="all"
23 21
24 DEFINE_string control "${DEFAULT_CONTROL}" \ 22 DEFINE_string build "${DEFAULT_TESTS_LIST}" \
25 "Setup control file -- path relative to the destination autotest directory" c 23 "a comma seperated list of autotest client tests to be prebuilt." b
26 DEFINE_string board "" \ 24 DEFINE_boolean prompt $FLAGS_TRUE "Prompt user when building all tests"
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"
31 25
32 # More useful help 26 # More useful help
33 FLAGS_HELP="usage: $0 [flags]" 27 FLAGS_HELP="usage: $0 [flags]"
34 28
35 # parse the command-line 29 # parse the command-line
36 FLAGS "$@" || exit 1 30 FLAGS "$@" || exit 1
37 eval set -- "${FLAGS_ARGV}" 31 eval set -- "${FLAGS_ARGV}"
38 set -e 32 set -e
39 33
40 AUTOTEST_SRC="${GCLIENT_ROOT}/src/third_party/autotest/files" 34 check_board
41 # Destination in chroot to install autotest.
42 AUTOTEST_DEST="/usr/local/autotest/${FLAGS_board}"
43 35
44 # If new build system flag passed, use ebuild and exit 36 # build default pre-compile client tests list.
45 if [ -n "${FLAGS_board}" ]; then 37 ALL_TESTS="compilebench,dbench,disktest,ltp,unixbench"
46 sudo GCLIENT_ROOT="${GCLIENT_ROOT}" FLAGS_control=${FLAGS_control} \ 38 for SITE_TEST in ../third_party/autotest/files/client/site_tests/*
47 "emerge-${FLAGS_board}" -a chromeos-base/autotest 39 do
48 exit 0 40 if [ -d ${SITE_TEST} ]
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}
49 fi 65 fi
50 66
51 # Copy a local "installation" of autotest into the chroot, to avoid 67 GCLIENT_ROOT="${GCLIENT_ROOT}" TEST_LIST=${TEST_LIST} \
52 # polluting the src dir with tmp files, results, etc. 68 "emerge-${FLAGS_board}" chromeos-base/autotest
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 | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698