OLD | NEW |
---|---|
(Empty) | |
1 # Copyright 2017 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 """Generates the data file directory to run validation tests. | |
5 | |
6 This script finds all of the files in the resources/data/validaiton folder | |
yzshen1
2017/03/23 17:46:20
A few ideas:
- This script could be a generic tool
damargulis
2017/03/24 19:44:48
I moved this file into mojo/public/tools/bindings,
| |
7 and generates a file listing all of those files. That file is then consumed | |
8 by the validation test so that it can locate and fetch all data files. | |
9 """ | |
10 | |
11 from os import listdir, makedirs, path | |
12 from shutil import copy | |
13 import sys | |
14 | |
15 def gen_files(): | |
16 files = [ f[:-5] for f in listdir(sys.argv[1]) if f.endswith('.data') ] | |
yzshen1
2017/03/23 17:46:20
Does listdir() return absolute path or relative pa
damargulis
2017/03/24 19:44:48
listdir() takes in a relative path, and returns on
| |
17 out = file(sys.argv[2], 'w') | |
18 output_dir = sys.argv[2].rsplit('/', 1)[0] + '/data' | |
19 if not path.exists(output_dir): | |
20 makedirs(output_dir) | |
21 with out: | |
22 for f in files: | |
23 copy(sys.argv[1] + '/' + f + '.data', output_dir) | |
24 copy(sys.argv[1] + '/' + f + '.expected', output_dir) | |
25 out.write(f + '\n') | |
26 | |
27 gen_files() | |
OLD | NEW |