Hash :
bda2205d
Author :
Date :
2020-09-17T14:37:25
Traces: Move up from tests/perf_tests/ to tests/. The trace tests aren't strictly for performance. Since we'll be using them for correctenss testing as well it makes sense to move them out of the perf_tests/ folder. Also renames RestrictedTraceTests.md to README.md so it'll load automatically in gitiles. Bug: angleproject:4090 Bug: b/168049670 Change-Id: I8be9f1d831489a9abf534d049a93441687850142 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2416913 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
#!/usr/bin/python3
#
# Copyright 2020 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# download_restricted_traces.py:
# download restricted traces and update their timestamp for build
import fnmatch
import json
import os
import sys
def reject_duplicate_keys(pairs):
found_keys = {}
for key, value in pairs:
if key in found_keys:
raise ValueError("duplicate key: %r" % (key,))
else:
found_keys[key] = value
return found_keys
def read_json(json_file):
with open(json_file) as map_file:
return json.loads(map_file.read(), object_pairs_hook=reject_duplicate_keys)
def main():
if (len(sys.argv) != 2):
print('Missing restricted traces directory')
return 1
trace_dir = sys.argv[1]
# issue download command
cmd = [
'download_from_google_storage',
'--directory',
'--recursive',
'--extract',
'--bucket',
'chrome-angle-capture-binaries',
trace_dir,
]
os.system(" ".join(cmd))
json_file = os.path.join(trace_dir, 'restricted_traces.json')
json_data = read_json(json_file)
if 'traces' not in json_data:
print('Trace data missing traces key.')
return 1
traces = json_data['traces']
for trace in traces:
for dirname, dirnames, filenames in os.walk(os.path.join(trace_dir, trace)):
# update timestamp on directory
os.utime(dirname, None)
# update timestamp on the files
for filename in filenames:
target = os.path.join(trace_dir, trace, filename)
os.utime(target, None)
return 0
if __name__ == '__main__':
sys.exit(main())