OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Distributed under the terms of the GNU General Public License v2 | 2 # Distributed under the terms of the GNU General Public License v2 |
3 | 3 |
4 EAPI=2 | 4 EAPI=2 |
5 | 5 |
6 inherit toolchain-funcs | 6 inherit toolchain-funcs |
7 | 7 |
8 DESCRIPTION="Autotest build_autotest wrapper" | 8 DESCRIPTION="Autotest build_autotest wrapper" |
9 HOMEPAGE="http://src.chromium.org" | 9 HOMEPAGE="http://src.chromium.org" |
10 SRC_URI="" | 10 SRC_URI="" |
11 LICENSE="GPL-2" | 11 LICENSE="GPL-2" |
12 SLOT="0" | 12 SLOT="0" |
13 KEYWORDS="x86 arm" | 13 KEYWORDS="x86 arm" |
14 IUSE="+autox buildcheck +xset" | 14 IUSE="+autox buildcheck +xset" |
15 | 15 |
16 # TODO(snanda): Remove xset dependence once power_LoadTest is switched over | 16 # TODO(snanda): Remove xset dependence once power_LoadTest is switched over |
17 # to use power manager | 17 # to use power manager |
18 RDEPEND=" | 18 RDEPEND=" |
19 dev-lang/python | 19 dev-lang/python |
20 autox? ( chromeos-base/autox ) | 20 autox? ( chromeos-base/autox ) |
21 xset? ( x11-apps/xset ) | 21 xset? ( x11-apps/xset ) |
22 " | 22 " |
23 | 23 |
24 DEPEND=" | 24 DEPEND=" |
25 ${RDEPEND}" | 25 ${RDEPEND}" |
26 | 26 |
| 27 export PORTAGE_QUIET=1 |
| 28 |
| 29 # Ensure the configures run by autotest pick up the right config.site |
| 30 export CONFIG_SITE=/usr/share/config.site |
| 31 |
27 # Create python package init files for top level test case dirs. | 32 # Create python package init files for top level test case dirs. |
28 function touchInitPy() { | 33 function touch_init_py() { |
29 local dirs=${1} | 34 local dirs=${1} |
30 for base_dir in $dirs | 35 for base_dir in $dirs |
31 do | 36 do |
32 local sub_dirs="$(find ${base_dir} -maxdepth 1 -type d)" | 37 local sub_dirs="$(find ${base_dir} -maxdepth 1 -type d)" |
33 for sub_dir in ${sub_dirs} | 38 for sub_dir in ${sub_dirs} |
34 do | 39 do |
35 touch ${sub_dir}/__init__.py | 40 touch ${sub_dir}/__init__.py |
36 done | 41 done |
37 touch ${base_dir}/__init__.py | 42 touch ${base_dir}/__init__.py |
38 done | 43 done |
39 } | 44 } |
40 | 45 |
41 src_unpack() { | 46 function setup_ssh() { |
42 » local third_party="${CHROMEOS_ROOT}/src/third_party" | 47 » eval $(ssh-agent) > /dev/null |
43 » elog "Using third_party: $third_party" | 48 » ssh-add \ |
44 » mkdir -p "${S}" | 49 » » ${CHROMEOS_ROOT}/src/scripts/mod_for_test_scripts/ssh_keys/testi
ng_rsa |
45 » cp -fpru ${third_party}/autotest/files/{client,conmux,server,tko,utils,g
lobal_config.ini,shadow_config.ini} ${S} || die | |
46 } | 50 } |
47 | 51 |
48 src_configure() { | 52 function teardown_ssh() { |
49 » cd ${S} | 53 » ssh-agent -k > /dev/null |
50 » touchInitPy client/tests client/site_tests | |
51 » touch __init__.py | |
52 » # Cleanup checked-in binaries that don't support the target architecture | |
53 » [[ ${E_MACHINE} == "" ]] && return 0; | |
54 » rm -fv $( scanelf -RmyBF%a . | grep -v -e ^${E_MACHINE} ) | |
55 } | 54 } |
56 | 55 |
57 src_compile() { | 56 function setup_cross_toolchain() { |
58 if tc-is-cross-compiler ; then | 57 if tc-is-cross-compiler ; then |
59 tc-getCC | 58 tc-getCC |
60 tc-getCXX | 59 tc-getCXX |
61 tc-getAR | 60 tc-getAR |
62 tc-getRANLIB | 61 tc-getRANLIB |
63 tc-getLD | 62 tc-getLD |
64 tc-getNM | 63 tc-getNM |
65 tc-getSTRIP | 64 tc-getSTRIP |
66 export PKG_CONFIG_PATH="${ROOT}/usr/lib/pkgconfig/" | 65 export PKG_CONFIG_PATH="${ROOT}/usr/lib/pkgconfig/" |
67 export CCFLAGS="$CFLAGS" | 66 export CCFLAGS="$CFLAGS" |
68 fi | 67 fi |
| 68 } |
69 | 69 |
70 » # Ensure the configures run by autotest pick up the right config.site | 70 function copy_src() { |
71 » export CONFIG_SITE=/usr/share/config.site | 71 » local dst=$1 |
| 72 » local autotest_files="${CHROMEOS_ROOT}/src/third_party/autotest/files" |
| 73 » mkdir -p "${dst}" |
| 74 » cp -fpru "${autotest_files}"/{client,conmux,server,tko,utils} ${dst} ||
die |
| 75 » cp -fpru "${autotest_files}"/{global_config.ini,shadow_config.ini} ${dst
} \ |
| 76 » » || die |
| 77 } |
| 78 |
| 79 src_configure() { |
| 80 » copy_src "${S}" |
| 81 » cd "${S}" |
| 82 » touch_init_py client/tests client/site_tests |
| 83 » touch __init__.py |
| 84 » # Cleanup checked-in binaries that don't support the target architecture |
| 85 » [[ ${E_MACHINE} == "" ]] && return 0; |
| 86 » rm -fv $( scanelf -RmyBF%a . | grep -v -e ^${E_MACHINE} ) |
| 87 } |
| 88 |
| 89 src_compile() { |
| 90 » setup_cross_toolchain |
72 | 91 |
73 # Do not use sudo, it'll unset all your environment | 92 # Do not use sudo, it'll unset all your environment |
74 LOGNAME=${SUDO_USER} \ | 93 LOGNAME=${SUDO_USER} \ |
75 client/bin/autotest_client --quiet --client_test_setup=${TEST_LIST} \ | 94 » » client/bin/autotest_client --quiet --client_test_setup=${TEST_LI
ST} \ |
76 || ! use buildcheck || die "Tests failed to build." | 95 » » || ! use buildcheck || die "Tests failed to build." |
77 # Cleanup some temp files after compiling | 96 » # Cleanup some temp files after compiling |
78 find . -name '*.[ado]' -delete | 97 » find . -name '*.[ado]' -delete |
79 } | 98 } |
80 | 99 |
81 src_install() { | 100 src_install() { |
82 insinto "/usr/local/autotest" | 101 insinto "/usr/local/autotest" |
83 doins -r "${S}"/* | 102 doins -r "${S}"/* |
84 } | 103 } |
85 | 104 |
86 pkg_postinst() { | 105 pkg_postinst() { |
87 chown -R ${SUDO_UID}:${SUDO_GID} "${SYSROOT}/usr/local/autotest" | 106 » chown -R ${SUDO_UID}:${SUDO_GID} "${SYSROOT}/usr/local/autotest" |
88 chmod -R 755 "${SYSROOT}/usr/local/autotest" | 107 » chmod -R 755 "${SYSROOT}/usr/local/autotest" |
89 } | 108 } |
90 | 109 |
| 110 # Define a directory which will not be cleaned by portage automatically. So we |
| 111 # could achieve incremental build between two autoserv runs. |
| 112 BUILD_STAGE=${PORTAGE_BUILDDIR}/staging |
| 113 |
| 114 src_test() { |
| 115 local third_party="${CHROMEOS_ROOT}/src/third_party" |
| 116 copy_src "${BUILD_STAGE}" |
| 117 |
| 118 setup_ssh |
| 119 cd "${BUILD_STAGE}" |
| 120 |
| 121 setup_cross_toolchain |
| 122 |
| 123 local timestamp=$(date +%Y-%m-%d-%H.%M.%S) |
| 124 # Do not use sudo, it'll unset all your environment |
| 125 LOGNAME=${SUDO_USER} ./server/autoserv -r /tmp/results.${timestamp} \ |
| 126 ${AUTOSERV_ARGS} |
| 127 teardown_ssh |
| 128 } |
| 129 |
OLD | NEW |