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

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

Issue 542068: Enhance autotest run inside chroot. (Closed)
Patch Set: format changes only. Created 10 years, 11 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/scripts/make_autotest.sh ('k') | 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 # Script to install and launch autotest. 7 # Script to install and launch autotest.
8 8
9 . "$(dirname "$0")/common.sh" 9 . "$(dirname "$0")/common.sh"
10 10
11 # Script must be run inside the chroot 11 # Script must be run inside the chroot
12 assert_inside_chroot 12 assert_inside_chroot
13 13
14 DEFINE_string client_control "" "client test case to execute" "c" 14 DEFINE_string client_control "" "client test case to execute" "c"
15 DEFINE_boolean force false "force reinstallation of autotest" "f" 15 DEFINE_boolean force false "force reinstallation of autotest" "f"
16 DEFINE_string machine "" "if present, execute autotest on this host." "m" 16 DEFINE_string machine "" "if present, execute autotest on this host." "m"
17 DEFINE_string test_key "${GCLIENT_ROOT}/src/platform/testing/testing_rsa" \ 17 DEFINE_string test_key "${GCLIENT_ROOT}/src/platform/testing/testing_rsa" \
18 "rsa key to use for autoserv" "k" 18 "rsa key to use for autoserv" "k"
19 19
20 # More useful help 20 # More useful help
21 FLAGS_HELP="usage: $0 [flags]" 21 FLAGS_HELP="usage: $0 [flags]"
22 22
23 # parse the command-line 23 # parse the command-line
24 FLAGS "$@" || exit 1 24 FLAGS "$@" || exit 1
25 eval set -- "${FLAGS_ARGV}" 25 eval set -- "${FLAGS_ARGV}"
26 set -e 26 set -e
27 27
28 AUTOTEST_CHROOT_DEST="/usr/local/autotest" 28 AUTOTEST_CHROOT_DEST="/usr/local/autotest"
29 AUTOTEST_SRC="${GCLIENT_ROOT}/src/third_party/autotest/files" 29 AUTOTEST_SRC="${GCLIENT_ROOT}/src/third_party/autotest/files"
30 echo $AUTOTEST_SRC
31 30
32 CHROOT_AUTHSOCK_PREFIX="/tmp/chromiumos_test_agent" 31 CHROOT_AUTHSOCK_PREFIX="/tmp/chromiumos_test_agent"
33 32
34 function cleanup { 33 function cleanup {
35 if [ "${TEST_AUTH_SOCKET:0:26}" == ${CHROOT_AUTHSOCK_PREFIX} ] 34 if [ "${TEST_AUTH_SOCKET:0:26}" == ${CHROOT_AUTHSOCK_PREFIX} ]
36 then 35 then
37 echo "cleaning up chrooted ssh-agent." 36 echo "cleaning up chrooted ssh-agent."
38 kill ${SSH_AGENT_PID} 37 kill ${SSH_AGENT_PID}
39 fi 38 fi
40 } 39 }
41 40
42 trap cleanup EXIT 41 trap cleanup EXIT
43 42
44 # If ssh-agent isn't already running, start one (possibly inside the chroot) 43 # If ssh-agent isn't already running, start one (possibly inside the chroot)
45 if [ ! -n "${SSH_AGENT_PID}" ] 44 if [ ! -n "${SSH_AGENT_PID}" ]
46 then 45 then
47 echo "Setting up ssh-agent in chroot for testing." 46 echo "Setting up ssh-agent in chroot for testing."
48 TEST_AUTH_SOCKET=$(mktemp -u ${CHROOT_AUTHSOCK_PREFIX}.XXXX) 47 TEST_AUTH_SOCKET=$(mktemp -u ${CHROOT_AUTHSOCK_PREFIX}.XXXX)
49 eval $(/usr/bin/ssh-agent -a ${TEST_AUTH_SOCKET}) 48 eval $(/usr/bin/ssh-agent -a ${TEST_AUTH_SOCKET})
50 fi 49 fi
51 50
52 # Install authkey for testing 51 # Install authkey for testing
53
54 chmod 400 $FLAGS_test_key 52 chmod 400 $FLAGS_test_key
55 /usr/bin/ssh-add $FLAGS_test_key 2> /dev/null 53 /usr/bin/ssh-add $FLAGS_test_key
56 54
57 if [ -n "${FLAGS_machine}" ] 55 if [ -n "${FLAGS_machine}" ]
58 then 56 then
59 CLIENT_CONTROL_FILE=${FLAGS_client_control}
60 # run only a specific test/suite if requested 57 # run only a specific test/suite if requested
61 if [ ! -n "${CLIENT_CONTROL_FILE}" ] 58 if [ ! -n "${FLAGS_client_control}" ]
62 then 59 then
63 # Generate meta-control file to run all existing site tests. 60 # Generate meta-control file to run all existing site tests.
64 CLIENT_CONTROL_FILE=\ 61 CLIENT_CONTROL_FILE=\
65 "${AUTOTEST_CHROOT_DEST}/client/site_tests/AllTests/control" 62 "${AUTOTEST_CHROOT_DEST}/client/site_tests/accept_Suite/control"
66 echo "No control file specified. Running all tests." 63 echo "No control file specified. Running all tests."
64 else
65 CLIENT_CONTROL_FILE=${AUTOTEST_CHROOT_DEST}/${FLAGS_client_control}
67 fi 66 fi
68 # Kick off autosrv for specified test 67 # Kick off autosrv for specified test
69 autoserv_cmd="${AUTOTEST_CHROOT_DEST}/server/autoserv \ 68 autoserv_cmd="${AUTOTEST_CHROOT_DEST}/server/autoserv \
70 -m ${FLAGS_machine} \ 69 -m ${FLAGS_machine} \
71 -c ${CLIENT_CONTROL_FILE}" 70 -c ${CLIENT_CONTROL_FILE}"
72 echo "running autoserv: " ${autoserv_cmd} 71 echo "running autoserv: " ${autoserv_cmd}
72 pushd ${AUTOTEST_CHROOT_DEST} 1> /dev/null
73 ${autoserv_cmd} 73 ${autoserv_cmd}
74 popd 1> /dev/null
74 else 75 else
75 echo "To execute autotest manually: 76 echo "To execute autotest manually:
76 eval \$(ssh-agent) # start ssh-agent 77 eval \$(ssh-agent) # start ssh-agent
77 ssh-add $FLAGS_test_key # add test key to agent 78 ssh-add $FLAGS_test_key # add test key to agent
78 # Then execute autoserv: 79 # Then execute autoserv:
79 $autoserv_cmd" 80 $autoserv_cmd"
80 fi 81 fi
81 82
OLDNEW
« no previous file with comments | « src/scripts/make_autotest.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698