blob: 362bf4e529f7008775a343061acbabd8ad348506 [file] [log] [blame]
Zdenek Behan12ad1c52010-08-03 16:34:37 -07001# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2# Distributed under the terms of the GNU General Public License v2
3
4#
5# Original Author: The Chromium OS Authors <chromium-os-dev@chromium.org>
6# Purpose: Eclass for handling autotest test packages
7#
8
Zdenek Behan9e98f322010-08-26 18:56:54 -07009RDEPEND="( autotest? ( >=chromeos-base/autotest-0.0.1-r3 ) )"
Zdenek Behan12ad1c52010-08-03 16:34:37 -070010
Zdenek Behan302e7482011-02-01 21:58:52 +010011IUSE="+buildcheck autotest opengles"
Zdenek Behan12ad1c52010-08-03 16:34:37 -070012
13# Ensure the configures run by autotest pick up the right config.site
Zdenek Behan99bf5842010-08-04 17:23:38 -070014export CONFIG_SITE="/usr/share/config.site"
15export AUTOTEST_WORKDIR="${WORKDIR}/autotest-work"
Zdenek Behan12ad1c52010-08-03 16:34:37 -070016
Zdenek Behancd997a32010-08-20 12:55:44 -070017# @ECLASS-VARIABLE: AUTOTEST_CLIENT_*
18# @DESCRIPTION:
19# Location of the appropriate test directory inside ${S}
20: ${AUTOTEST_CLIENT_TESTS:=client/tests}
21: ${AUTOTEST_CLIENT_SITE_TESTS:=client/site_tests}
Zdenek Behan41463c92010-08-23 12:12:31 -070022: ${AUTOTEST_CONFIG:=client/config}
23: ${AUTOTEST_DEPS:=client/deps}
24: ${AUTOTEST_PROFILERS:=client/profilers}
25
26# @ECLASS-VARIABLE: AUTOTEST_*_LIST
27# @DESCRIPTION:
28# The list of deps/configs/profilers provided with this package
Chris Sosa6bde1602012-03-15 23:19:57 -070029: ${AUTOTEST_CONFIG_LIST:=}
30: ${AUTOTEST_DEPS_LIST:=}
31: ${AUTOTEST_PROFILERS_LIST:=}
Zdenek Behancd997a32010-08-20 12:55:44 -070032
Zdenek Behand012b762010-09-01 21:22:26 -070033# @ECLASS-VARIABLE: AUTOTEST_FORCE_LIST
34# @DESCRIPTION:
35# Sometimes we just want to forget about useflags and build what's inside
36: ${AUTOTEST_FORCE_TEST_LIST:=}
37
Zdenek Behanb1f7c892010-09-22 12:25:38 -070038# @ECLASS-VARIABLE: AUTOTEST_FILE_MASK
39# @DESCRIPTION:
40# The list of 'find' expressions to find in the resulting image and delete
41: ${AUTOTEST_FILE_MASK:=}
42
Chris Sosa6bde1602012-03-15 23:19:57 -070043fast_cp() {
Zdenek Behan7922d132010-09-24 14:18:05 -070044 cp -l "$@" || cp "$@"
45}
46
Chris Sosa6bde1602012-03-15 23:19:57 -070047get_test_list() {
Zdenek Behand012b762010-09-01 21:22:26 -070048 if [ -n "${AUTOTEST_FORCE_TEST_LIST}" ]; then
49 # list forced
50 echo "${AUTOTEST_FORCE_TEST_LIST}"
51 return
52 fi
53
54 # we cache the result of this operation in AUTOTEST_TESTS,
55 # because it's expensive and does not change over the course of one ebuild run
Chris Sosa43b6cde2012-03-22 14:32:23 -070056 local result="${IUSE_TESTS[*]//[+-]tests_/}"
Zdenek Behand012b762010-09-01 21:22:26 -070057 result="${result//tests_/}"
58
59 result=$(for test in ${result}; do use tests_${test} && echo -n "${test} "; done)
60 echo "${result}"
61}
62
Chris Sosa6bde1602012-03-15 23:19:57 -070063# Pythonify the list of packages by doing the equivalent of ','.join(args)
64pythonify_test_list() {
65 local result=$(printf '%s,' "$@")
66 echo ${result%,}
Zdenek Behan12ad1c52010-08-03 16:34:37 -070067}
68
69# Create python package init files for top level test case dirs.
Chris Sosa6bde1602012-03-15 23:19:57 -070070touch_init_py() {
Zdenek Behan12ad1c52010-08-03 16:34:37 -070071 local dirs=${1}
72 for base_dir in $dirs
73 do
74 local sub_dirs="$(find ${base_dir} -maxdepth 1 -type d)"
75 for sub_dir in ${sub_dirs}
76 do
77 touch ${sub_dir}/__init__.py
78 done
79 touch ${base_dir}/__init__.py
80 done
81}
82
Zdenek Behan361d8142012-03-19 04:30:45 +010083# Exports a CROS_WORKON_SUBDIRS_TO_COPY variable to ensure that only the
84# necessary files will be copied. This cannot be applied globally, as some
85# ebuilds may not have tests only.
86autotest_restrict_workon_subdirs() {
87 CROS_WORKON_SUBDIRS_TO_COPY=()
88 local var
89 for var in AUTOTEST_{CLIENT,SERVER}_{TESTS,SITE_TESTS} \
90 AUTOTEST_{CONFIG,DEPS,PROFILERS}; do
91 CROS_WORKON_SUBDIRS_TO_COPY+=( ${!var} )
92 done
93}
94
Chris Sosa6bde1602012-03-15 23:19:57 -070095setup_cross_toolchain() {
Mike Frysingerb1eda9e2012-03-08 14:56:18 -050096 tc-export CC CXX AR RANLIB LD NM STRIP PKG_CONFIG
97 export CCFLAGS="$CFLAGS"
Zdenek Behan12ad1c52010-08-03 16:34:37 -070098
99 # TODO(fes): Check for /etc/hardened for now instead of the hardened
100 # use flag because we aren't enabling hardened on the target board.
101 # Rather, right now we're using hardened only during toolchain compile.
102 # Various tests/etc. use %ebx in here, so we have to turn off PIE when
103 # using the hardened compiler
104 if use x86 ; then
105 if use hardened ; then
106 #CC="${CC} -nopie"
107 append-flags -nopie
108 fi
109 fi
110}
111
Chris Sosa6bde1602012-03-15 23:19:57 -0700112create_autotest_workdir() {
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700113 local dst=${1}
114
115 # create a working enviroment for pre-building
Chris Masone21512432010-11-15 16:18:57 -0800116 ln -sf "${SYSROOT}"/usr/local/autotest/{conmux,tko,global_config.ini,shadow_config.ini} "${dst}"/
Zdenek Behan99bf5842010-08-04 17:23:38 -0700117
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700118 # NOTE: in order to make autotest not notice it's running from /usr/local/, we need
119 # to make sure the binaries are real, because they do the path magic
120 local root_path base_path
Chris Masone21512432010-11-15 16:18:57 -0800121 for base_path in utils server; do
122 root_path="${SYSROOT}/usr/local/autotest/${base_path}"
123 mkdir -p "${dst}/${base_path}"
124 for entry in $(ls "${root_path}"); do
Zdenek Behan7e9e32f2012-02-28 03:15:46 +0100125 # Take all important binaries from SYSROOT install, make a copy.
126 if [ -d "${root_path}/${entry}" ]; then
127 # Ignore anything that has already been put in place by
128 # something else. This will typically be server/{site_tests,tests}.
129 if ! [ -e "${dst}/${base_path}/${entry}" ]; then
130 ln -sf "${root_path}/${entry}" "${dst}/${base_path}/"
131 fi
Chris Masone21512432010-11-15 16:18:57 -0800132 else
133 cp -f ${root_path}/${entry} ${dst}/${base_path}/
134 fi
135 done
136 done
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700137 for base_path in client client/bin; do
138 root_path="${SYSROOT}/usr/local/autotest/${base_path}"
139 mkdir -p "${dst}/${base_path}"
140
Zdenek Behan451e07f2010-08-06 11:25:37 -0700141 # Skip bin, because it is processed separately, and test-provided dirs
142 # Also don't symlink to packages, because that kills the build
Zdenek Behan41463c92010-08-23 12:12:31 -0700143 for entry in $(ls "${root_path}" | \
144 grep -v "\(bin\|tests\|site_tests\|config\|deps\|profilers\|packages\)$"); do
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700145 ln -sf "${root_path}/${entry}" "${dst}/${base_path}/"
146 done
147 done
148 # replace the important binaries with real copies
149 for base_path in autotest autotest_client; do
150 root_path="${SYSROOT}/usr/local/autotest/client/bin/${base_path}"
151 rm "${dst}/client/bin/${base_path}"
152 cp -f ${root_path} "${dst}/client/bin/${base_path}"
153 done
Zdenek Behan448ddaa2010-08-24 11:18:50 -0700154
155 # Selectively pull in deps that are not provided by the current test package
156 for base_path in config deps profilers; do
157 for dir in "${SYSROOT}/usr/local/autotest/client/${base_path}"/*; do
158 if [ -d "${dir}" ] && \
159 ! [ -d "${AUTOTEST_WORKDIR}/client/${base_path}/$(basename ${dir})" ]; then
160 # directory does not exist, create a symlink
161 ln -sf "${dir}" "${AUTOTEST_WORKDIR}/client/${base_path}/$(basename ${dir})"
162 fi
163 done
164 done
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700165}
166
Chris Sosa6bde1602012-03-15 23:19:57 -0700167print_test_dirs() {
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700168 local testroot="${1}"
Chris Sosa6bde1602012-03-15 23:19:57 -0700169 local ignore_test_contents="${2}"
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700170
171 pushd "${testroot}" 1> /dev/null
172 for test in *; do
Chris Sosa6bde1602012-03-15 23:19:57 -0700173 if [ -d "${test}" ] && [ -n "${ignore_test_contents}" -o \
174 -f "${test}/${test}".py ]; then
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700175 echo "${test}"
176 fi
177 done
178 popd 1> /dev/null
179}
180
Zdenek Behaneee7bc22010-08-20 18:33:13 -0700181# checks IUSE_TESTS and sees if at least one of these is enabled
Chris Sosa6bde1602012-03-15 23:19:57 -0700182are_we_used() {
Zdenek Behan14ae4892010-08-26 15:25:30 -0700183 if ! use autotest; then
184 # unused
185 return 1
186 fi
187
Zdenek Behand012b762010-09-01 21:22:26 -0700188 [ -n "$(get_test_list)" ] && return 0
Zdenek Behaneee7bc22010-08-20 18:33:13 -0700189
190 # unused
191 return 1
192}
193
Chris Sosa6bde1602012-03-15 23:19:57 -0700194autotest_src_prepare() {
Zdenek Behaneee7bc22010-08-20 18:33:13 -0700195 are_we_used || return 0
196 einfo "Preparing tests"
197
198 # FIXME: These directories are needed, autotest quietly dies if
199 # they don't even exist. They may, however, stay empty.
Zdenek Behanc02fc472010-08-13 12:55:07 -0700200 mkdir -p "${AUTOTEST_WORKDIR}"/client/tests
201 mkdir -p "${AUTOTEST_WORKDIR}"/client/site_tests
Zdenek Behan41463c92010-08-23 12:12:31 -0700202 mkdir -p "${AUTOTEST_WORKDIR}"/client/config
203 mkdir -p "${AUTOTEST_WORKDIR}"/client/deps
204 mkdir -p "${AUTOTEST_WORKDIR}"/client/profilers
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700205
Zdenek Behand012b762010-09-01 21:22:26 -0700206 TEST_LIST=$(get_test_list)
207
Zdenek Behan448ddaa2010-08-24 11:18:50 -0700208 # Pull in the individual test cases.
Zdenek Behan31315b32010-08-05 16:34:39 -0700209 for l1 in client server; do
210 for l2 in site_tests tests; do
Zdenek Behancd997a32010-08-20 12:55:44 -0700211 # pick up the indicated location of test sources
212 eval srcdir=${WORKDIR}/${P}/\${AUTOTEST_${l1^^*}_${l2^^*}}
213
Zdenek Behand012b762010-09-01 21:22:26 -0700214 # test does have this directory
215 for test in ${TEST_LIST}; do
216 if [ -d "${srcdir}/${test}" ]; then
Zdenek Behan7922d132010-09-24 14:18:05 -0700217 fast_cp -fpr "${srcdir}/${test}" "${AUTOTEST_WORKDIR}/${l1}/${l2}"/ || die
Zdenek Behand012b762010-09-01 21:22:26 -0700218 fi
219 done
Zdenek Behan31315b32010-08-05 16:34:39 -0700220 done
221 done
Zdenek Behan99bf5842010-08-04 17:23:38 -0700222
Zdenek Behan448ddaa2010-08-24 11:18:50 -0700223 # Pull in all the deps provided by this package, selectively.
Zdenek Behan41463c92010-08-23 12:12:31 -0700224 for l2 in config deps profilers; do
225 # pick up the indicated location of test sources
226 eval srcdir=${WORKDIR}/${P}/\${AUTOTEST_${l2^^*}}
227
228 if [ -d "${srcdir}" ]; then # test does have this directory
229 pushd "${srcdir}" 1> /dev/null
230 eval deplist=\${AUTOTEST_${l2^^*}_LIST}
231
232 if [ "${deplist}" = "*" ]; then
Zdenek Behan7922d132010-09-24 14:18:05 -0700233 fast_cp -fpr * "${AUTOTEST_WORKDIR}/client/${l2}"
Zdenek Behan41463c92010-08-23 12:12:31 -0700234 else
235 for dir in ${deplist}; do
Zdenek Behan7922d132010-09-24 14:18:05 -0700236 fast_cp -fpr "${dir}" "${AUTOTEST_WORKDIR}/client/${l2}"/ || die
Zdenek Behan41463c92010-08-23 12:12:31 -0700237 done
238 fi
239 popd 1> /dev/null
240 fi
241 done
242
Zdenek Behan474fbae2010-08-20 21:13:22 -0700243 # FIXME: We'd like if this were not necessary, and autotest supported out-of-tree build
Zdenek Behan99bf5842010-08-04 17:23:38 -0700244 create_autotest_workdir "${AUTOTEST_WORKDIR}"
Zdenek Behaneee7bc22010-08-20 18:33:13 -0700245
Zdenek Behanf93c208a2010-09-21 18:53:58 -0700246 # Each test directory needs to be visited and have an __init__.py created.
247 # However, that only applies to the directories which have a main .py file.
Zdenek Behanedb527a2010-09-22 12:24:14 -0700248 pushd "${AUTOTEST_WORKDIR}" > /dev/null || die "AUTOTEST_WORKDIR does not exist?!"
Chris Sosa1767b532012-11-09 15:13:15 -0800249 for dir in client/tests client/site_tests; do
Zdenek Behanedb527a2010-09-22 12:24:14 -0700250 pushd "${dir}" > /dev/null || continue
Zdenek Behanf93c208a2010-09-21 18:53:58 -0700251 for sub in *; do
252 [ -f "${sub}/${sub}.py" ] || continue
Zdenek Behan1ec164a2010-08-17 19:06:31 -0700253
Zdenek Behanf93c208a2010-09-21 18:53:58 -0700254 touch_init_py ${sub}
255 done
Zdenek Behanedb527a2010-09-22 12:24:14 -0700256 popd > /dev/null
Zdenek Behan1ec164a2010-08-17 19:06:31 -0700257 done
Zdenek Behanedb527a2010-09-22 12:24:14 -0700258 popd > /dev/null
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700259
260 # Cleanup checked-in binaries that don't support the target architecture
261 [[ ${E_MACHINE} == "" ]] && return 0;
Zdenek Behan092f4632010-09-21 19:34:01 -0700262 rm -fv $( scanelf -RmyBF%a "${AUTOTEST_WORKDIR}" | grep -v -e ^${E_MACHINE} )
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700263}
264
Chris Sosa6bde1602012-03-15 23:19:57 -0700265autotest_src_compile() {
Zdenek Behan48096a82010-09-23 19:39:26 -0700266 if ! are_we_used; then
267 ewarn "***************************************************************"
268 ewarn "* Not building any tests, because the requested list is empty *"
269 ewarn "***************************************************************"
270 return 0
271 fi
Zdenek Behaneee7bc22010-08-20 18:33:13 -0700272 einfo "Compiling tests"
273
Zdenek Behan31315b32010-08-05 16:34:39 -0700274 pushd "${AUTOTEST_WORKDIR}" 1> /dev/null
Zdenek Behan99bf5842010-08-04 17:23:38 -0700275
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700276 setup_cross_toolchain
277
278 if use opengles ; then
279 graphics_backend=OPENGLES
280 else
281 graphics_backend=OPENGL
282 fi
283
Zdenek Behan9e979bb2010-09-23 17:32:05 -0700284 # HACK: Some of the autotests depend on SYSROOT being defined, and die
285 # a gruesome death if it isn't. But SYSROOT does not need to exist, for
286 # example on the host, it doesn't. Let's define a compatible variable
287 # here in case we have none.
288 export SYSROOT=${SYSROOT:-"/"}
289
Zdenek Behan8ad65252010-09-07 12:35:19 -0700290 # This only prints the tests that have the associated .py
291 # (and therefore a setup function)
292 local prebuild_test_dirs="
Chris Sosa1767b532012-11-09 15:13:15 -0800293 client/tests client/site_tests"
Zdenek Behan8ad65252010-09-07 12:35:19 -0700294 TESTS=$(\
295 for dir in ${prebuild_test_dirs}; do
296 print_test_dirs "${AUTOTEST_WORKDIR}/${dir}"
Chris Sosa6bde1602012-03-15 23:19:57 -0700297 done | sort -u)
Zdenek Behan9afd0a32011-01-21 01:47:02 +0100298 NR_TESTS=$(echo ${TESTS}|wc -w)
299 if ! [ "${NR_TESTS}" = "0" ]; then
300 einfo "Building tests (${NR_TESTS}):"
301 einfo "${TESTS}"
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700302
Zdenek Behan9afd0a32011-01-21 01:47:02 +0100303 NORMAL=$(echo -e "\e[0m")
304 GREEN=$(echo -e "\e[1;32m")
305 RED=$(echo -e "\e[1;31m")
Zdenek Behan402fea02010-09-14 13:50:09 -0700306
Zdenek Behan9afd0a32011-01-21 01:47:02 +0100307 # Call autotest to prebuild all test cases.
308 # Parse output through a colorifying sed script
309 ( GRAPHICS_BACKEND="$graphics_backend" LOGNAME=${SUDO_USER} \
310 client/bin/autotest_client --quiet \
311 --client_test_setup=$(pythonify_test_list ${TESTS}) \
312 || ! use buildcheck || die "Tests failed to build."
313 ) | sed -e "s/\(INFO:root:setup\)/${GREEN}* \1${NORMAL}/" \
314 -e "s/\(ERROR:root:\[.*\]\)/${RED}\1${NORMAL}/"
315 else
316 einfo "No tests to prebuild, skipping"
317 fi
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700318
319 # Cleanup some temp files after compiling
Zdenek Behan7c162bb2012-05-14 18:42:15 +0200320 for mask in '*.[do]' '*.pyc' ${AUTOTEST_FILE_MASK}; do
Zdenek Behanb1f7c892010-09-22 12:25:38 -0700321 einfo "Purging ${mask}"
322 find . -name "${mask}" -delete
323 done
Zdenek Behan31315b32010-08-05 16:34:39 -0700324
325 popd 1> /dev/null
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700326}
327
Chris Sosa6bde1602012-03-15 23:19:57 -0700328autotest_src_install() {
Zdenek Behaneee7bc22010-08-20 18:33:13 -0700329 are_we_used || return 0
330 einfo "Installing tests"
331
Zdenek Behan448ddaa2010-08-24 11:18:50 -0700332 # Install all test cases, after setup has been called on them.
333 # We install everything, because nothing else is copied into the
334 # testcase directories besides what this package provides.
Zdenek Behan1ec164a2010-08-17 19:06:31 -0700335 local instdirs="
336 client/tests
Chris Sosa1767b532012-11-09 15:13:15 -0800337 client/site_tests"
Zdenek Behan1ec164a2010-08-17 19:06:31 -0700338
339 for dir in ${instdirs}; do
Zdenek Behancd997a32010-08-20 12:55:44 -0700340 [ -d "${AUTOTEST_WORKDIR}/${dir}" ] || continue
Zdenek Behan1ec164a2010-08-17 19:06:31 -0700341
342 insinto /usr/local/autotest/$(dirname ${dir})
343 doins -r "${AUTOTEST_WORKDIR}/${dir}"
344 done
345
Zdenek Behan448ddaa2010-08-24 11:18:50 -0700346 # Install the deps, configs, profilers.
347 # Difference from above is, we don't install the whole thing, just
348 # the stuff provided by this package, by looking at AUTOTEST_*_LIST.
349 instdirs="
350 config
351 deps
352 profilers"
353
354 for dir in ${instdirs}; do
355 [ -d "${AUTOTEST_WORKDIR}/client/${dir}" ] || continue
356
357 insinto /usr/local/autotest/client/${dir}
358
359 eval provided=\${AUTOTEST_${dir^^*}_LIST}
360 # * means provided all, figure out the list from ${S}
361 if [ "${provided}" = "*" ]; then
362 if eval pushd "${WORKDIR}/${P}/\${AUTOTEST_${dir^^*}}" &> /dev/null; then
363 provided=$(ls)
364 popd 1> /dev/null
365 else
366 provided=""
367 fi
368 fi
369
370 for item in ${provided}; do
371 doins -r "${AUTOTEST_WORKDIR}/client/${dir}/${item}"
372 done
373 done
374
Zdenek Behan1ec164a2010-08-17 19:06:31 -0700375 # TODO: Not all needs to be executable, but it's hard to pick selectively.
376 # The source repo should already contain stuff with the right permissions.
377 chmod -R a+x "${D}"/usr/local/autotest/*
Zdenek Behan12ad1c52010-08-03 16:34:37 -0700378}
379
Chris Sosa6bde1602012-03-15 23:19:57 -0700380autotest_pkg_postinst() {
Mandeep Singh Baines060c2db2012-12-07 17:12:31 -0800381 are_we_used || return 0
Chris Sosa6bde1602012-03-15 23:19:57 -0700382 local root_autotest_dir="${ROOT}/usr/local/autotest"
383 local path_to_image="${D}/usr/local/autotest"
384 # Should only happen when running emerge on a DUT.
385 if [ ! -d "${root_autotest_dir}" ]; then
386 einfo "Skipping packaging as no autotest installation detected."
387 return 0
388 fi
Chris Masone21512432010-11-15 16:18:57 -0800389
Chris Sosa6bde1602012-03-15 23:19:57 -0700390 # Gather the artifacts we want autotest to package.
391 local test_opt dep_opt prof_opt
Chris Sosaccb6c8b2012-03-09 10:47:32 -0800392
Chris Sosa6bde1602012-03-15 23:19:57 -0700393 # Only client tests can be packaged.
394 local tests_to_package_dirs="client/tests client/site_tests"
395 local client_tests=$(\
396 for dir in ${tests_to_package_dirs}; do
397 print_test_dirs "${path_to_image}/${dir}" yes
398 done | sort -u)
399
400 if [ -n "${client_tests}" ] && [ "${client_tests}" != "myfaketest" ]; then
Aviv Keshet28ecfa62013-09-03 17:42:16 -0700401 test_opt="--test=$(pythonify_test_list ${client_tests})"
Chris Sosa6bde1602012-03-15 23:19:57 -0700402 fi
403
404 if [ "{test_opt}" != "--all" ]; then
405 if [ -n "${AUTOTEST_DEPS_LIST}" ]; then
406 dep_opt="--dep=$(pythonify_test_list ${AUTOTEST_DEPS_LIST})"
407 fi
408
409 # For *, we must generate the list of profilers.
410 if [ "${AUTOTEST_PROFILERS_LIST}" = "*" ]; then
411 AUTOTEST_PROFILERS_LIST=$(\
412 print_test_dirs "${path_to_image}/client/profilers" yes | sort -u)
413 prof_opt="--profiler=$(pythonify_test_list ${AUTOTEST_PROFILERS_LIST})"
414 fi
415 fi
416
417 if [ -n "${test_opt}" -o -n "${dep_opt}" -o -n "${prof_opt}" ]; then
418 einfo "Running packager with options ${test_opt} ${dep_opt} ${prof_opt}"
419 flock "${root_autotest_dir}/packages" \
Zdenek Behan7c162bb2012-05-14 18:42:15 +0200420 -c "python -B ${root_autotest_dir}/utils/packager.py \
Chris Sosa6bde1602012-03-15 23:19:57 -0700421 -r ${root_autotest_dir}/packages \
422 ${test_opt} ${dep_opt} ${prof_opt} upload"
423 else
424 einfo "Packager not run as nothing was found to package."
425 fi
Chris Masone21512432010-11-15 16:18:57 -0800426}
427
Zdenek Behan361d8142012-03-19 04:30:45 +0100428if [[ "${CROS_WORKON_PROJECT}" == "chromiumos/third_party/autotest" ]]; then
429 # Using main autotest repo. Automatically restricting checkout.
430 # Note that this does not happen if the inherit is done prior to setting
431 # CROS_WORKON_* variables.
432 autotest_restrict_workon_subdirs
433fi
434
Chris Sosaccb6c8b2012-03-09 10:47:32 -0800435EXPORT_FUNCTIONS src_compile src_prepare src_install pkg_postinst