From 9ffc3b32a36369bcac654a9dd17b6bc25b258093 Mon Sep 17 00:00:00 2001 From: "Anton (whywhat) Vayvod" Date: Wed, 28 Apr 2010 21:51:16 +0400 Subject: [PATCH] Added --test_args parameter that passes its value as -a flag to autoserv. Review URL: http://codereview.chromium.org/1794004 --- autotest | 11 ++++++++--- run_remote_tests.sh | 10 +++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/autotest b/autotest index 85479ce5cb..ad4f0800f9 100755 --- a/autotest +++ b/autotest @@ -57,6 +57,9 @@ parser.allow_interspersed_args = True DEFAULT_BOARD = os.environ.get('DEFAULT_BOARD', '') +parser.add_option('--args', dest='args', action='store', + default='', + help='The arguments to pass to the test control file.') parser.add_option('--autox', dest='autox', action='store_true', default=True, help='Build autox along with autotest [default].') @@ -188,12 +191,14 @@ def build_autotest(options): return run(emerge_cmd) -def run_autoserv(board, args): +def run_autoserv(options, args): environ = os.environ + + environ['AUTOSERV_TEST_ARGS'] = options.args environ['AUTOSERV_ARGS'] = ' '.join(args) environ['FEATURES'] = ('%s -buildpkg -digest noauto' % environ.get('FEATURES', '')) - ebuild_cmd = ['ebuild-%s' % board, + ebuild_cmd = ['ebuild-%s' % options.board, '../third_party/chromiumos-overlay/chromeos-base/' 'autotest/autotest-0.0.1.ebuild', 'clean', 'unpack', 'test'] @@ -216,7 +221,7 @@ def main(): ssh_key_file = os.path.join(os.path.dirname(me), 'mod_for_test_scripts/ssh_keys/testing_rsa') os.chmod(ssh_key_file, 0400) - run_autoserv(options.board, args) + run_autoserv(options, args) if __name__ == '__main__': diff --git a/run_remote_tests.sh b/run_remote_tests.sh index 35013d63d0..48b497d9fc 100755 --- a/run_remote_tests.sh +++ b/run_remote_tests.sh @@ -14,6 +14,7 @@ get_default_board +DEFINE_string args "" "Command line arguments for test, separated with comma" a DEFINE_string board "$DEFAULT_BOARD" \ "The board for which you are building autotest" DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c @@ -242,6 +243,12 @@ function main() { if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then verbose="--verbose" fi + local args=() + if [[ -n "${FLAGS_args}" ]]; then + local with_spaces="" + with_spaces=${FLAGS_args//,/ } + args=("-a" "${with_spaces}") + fi RAN_ANY_TESTS=${FLAGS_TRUE} @@ -253,7 +260,8 @@ function main() { fi ${enter_chroot} ${autotest} --board "${FLAGS_board}" -m "${FLAGS_remote}" \ - "${option}" "${control_file}" -r "${results_dir}" ${verbose} + "${option}" "${control_file}" -r "${results_dir}" ${verbose} \ + "${args[@]}" results_dir="${TMP}/${results_dir_name}" local test_status="${results_dir}/status.log"