From c922fc09a5986ec131f087523392f79dd3e88e59 Mon Sep 17 00:00:00 2001 From: Sean O'Connor Date: Wed, 13 Jan 2010 11:07:52 -0800 Subject: [PATCH] Re-work automation setup scripts. Review URL: http://codereview.chromium.org/542058 --- make_autotest.sh | 59 ++++++++++++++++++++++++++++ setup_autotest.sh => run_autotest.sh | 21 ---------- 2 files changed, 59 insertions(+), 21 deletions(-) create mode 100755 make_autotest.sh rename setup_autotest.sh => run_autotest.sh (74%) diff --git a/make_autotest.sh b/make_autotest.sh new file mode 100755 index 0000000000..dca12c731b --- /dev/null +++ b/make_autotest.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# Copyright (c) 2009 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This script makes autotest client tests inside an Ubuntu chroot +# environment. The idea is to compile any platform-dependent autotest +# client tests in the build environment, since client systems under +# test lack the proper toolchain. +# +# The user can enter_chroot later and run autotest against an ssh +# enabled test client system, or install the compiled client tests +# directly onto the rootfs image, using mod_image_for_test. + +. "$(dirname "$0")/common.sh" + +# Script must be run inside the chroot +assert_inside_chroot + +# More useful help +FLAGS_HELP="usage: $0 [flags]" + +# parse the command-line +FLAGS "$@" || exit 1 +eval set -- "${FLAGS_ARGV}" +set -e + +AUTOTEST_SRC="${GCLIENT_ROOT}/src/third_party/autotest/files" +# Destination in chroot to install autotest. +AUTOTEST_DEST="/usr/local/autotest" + +# Copy a local "installation" of autotest into the chroot, to avoid +# polluting the src dir with tmp files, results, etc. +echo -n "Installing Autotest... " +sudo mkdir -p ${AUTOTEST_DEST} +sudo chmod 777 ${AUTOTEST_DEST} +cp -rpf ${CHROOT_TRUNK_DIR}/src/third_party/autotest/files/{client,server,tko,utils,global_config.ini,shadow_config.ini} ${AUTOTEST_DEST} + +# Create python package init files for top level test case dirs. +function touchInitPy() { + local dirs=${1} + for base_dir in $dirs + do + local sub_dirs="$(find ${base_dir} -maxdepth 1 -type d)" + for sub_dir in ${sub_dirs} + do + touch ${sub_dir}/__init__.py + done + touch ${base_dir}/__init__.py + done +} + +cd ${AUTOTEST_DEST} +touchInitPy client/tests client/site_tests +touch __init__.py + +# run the magic test setup script. +client/bin/autotest client/site_tests/setup/control diff --git a/setup_autotest.sh b/run_autotest.sh similarity index 74% rename from setup_autotest.sh rename to run_autotest.sh index 165830957b..da785cdd63 100755 --- a/setup_autotest.sh +++ b/run_autotest.sh @@ -41,27 +41,6 @@ function cleanup { trap cleanup EXIT -# Copy a local "installation" of autotest into the chroot, to avoid -# polluting the src dir with tmp files, results, etc. -# TODO: use rsync to ensure we don't get stuck with an old install. -if [ 1 != ${FLAGS_force} ] || [ ! -f "${AUTOTEST_CHROOT_DEST}/server/autosrv" ] - then - echo -n "Installing Autotest... " - sudo mkdir -p "${AUTOTEST_CHROOT_DEST}" - sudo cp -rp ${AUTOTEST_SRC}/* ${AUTOTEST_CHROOT_DEST} - echo "done." - else - echo "Autotest found in chroot, skipping copy." -fi - -# Add all third_party and system tests to site_tests. -for type in client server -do - echo -n "Adding ${type}_tests into autotest's ${type}/site_tests... " - sudo cp -rp ${GCLIENT_ROOT}/src/platform/testing/${type}_tests/* \ - ${AUTOTEST_CHROOT_DEST}/${type}/site_tests/ -done - # If ssh-agent isn't already running, start one (possibly inside the chroot) if [ ! -n "${SSH_AGENT_PID}" ] then