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

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

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