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

Side by Side Diff: testing/chromoting/download_test_files.py

Issue 1231663003: Add functionality to download files from GCS, and include them in the Chromoting isolate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add copyright header. Created 5 years, 5 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 | « testing/chromoting/chromoting_test_files.txt ('k') | testing/chromoting/integration_tests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """A script to download files required for Remoting integration tests from GCS.
6
7 The script expects 2 parameters:
8
9 input_files: a file containing the full path in GCS to each file that is to
10 be downloaded.
11 output_folder: the folder to which the specified files should be downloaded.
12
13 This scripts expects that its execution is done on a machine where the
14 credentials are correctly setup to obtain the required permissions for
15 downloading files from the specified GCS buckets.
16 """
17
18 import argparse
19 import ntpath
20 import os
21 import subprocess
22 import sys
23
24
25 def main():
26
27 parser = argparse.ArgumentParser()
28 parser.add_argument('-f', '--files',
29 help='File specifying files to be downloaded .')
30 parser.add_argument(
31 '-o', '--output_folder',
32 help='Folder where specified files should be downloaded .')
33
34 if len(sys.argv) < 3:
35 parser.print_help()
36 sys.exit(1)
37
38 args = parser.parse_args()
39 if not args.files or not args.output_folder:
40 parser.print_help()
41 sys.exit(1)
42
43 # Loop through lines in input file specifying source file locations.
44 with open(args.files) as f:
45 for line in f:
46 # Copy the file to the output folder, with same name as source file.
47 output_file = os.path.join(args.output_folder, ntpath.basename(line))
48 # Download specified file from GCS.
49 cp_cmd = ['gsutil cp %s %s' % (line, output_file)]
luqui 2015/07/15 18:00:51 1. this should be gsutil.py. 2. the arguments sho
luqui 2015/07/15 18:02:07 Oh I see, you have shell=True, so (2) isn't necess
50 try:
51 subprocess.check_output(cp_cmd, stderr=subprocess.STDOUT,
52 shell=True)
53 except subprocess.CalledProcessError, e:
54 print e.output
55 sys.exit(1)
56
57 if __name__ == '__main__':
58 main()
OLDNEW
« no previous file with comments | « testing/chromoting/chromoting_test_files.txt ('k') | testing/chromoting/integration_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698