2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
13 ZIP_PATTERN
= re
.compile('dmprof......\.zip')
15 assert len(sys
.argv
) == 6
16 assert sys
.argv
[1] == 'cp'
17 assert sys
.argv
[2] == '-a'
18 assert sys
.argv
[3] == 'public-read'
19 assert ZIP_PATTERN
.match(os
.path
.basename(sys
.argv
[4]))
20 assert sys
.argv
[5] == 'gs://test-storage/'
22 zip_file
= zipfile
.ZipFile(sys
.argv
[4], 'r')
24 expected_nameset
= set(['heap.01234.0001.heap',
25 'heap.01234.0002.heap',
26 'heap.01234.0001.buckets',
27 'heap.01234.0002.buckets',
28 'heap.01234.symmap/maps',
29 'heap.01234.symmap/chrome.uvwxyz.readelf-e',
30 'heap.01234.symmap/chrome.abcdef.nm',
31 'heap.01234.symmap/files.json'])
32 assert set(zip_file
.namelist()) == expected_nameset
34 heap_1
= zip_file
.getinfo('heap.01234.0001.heap')
35 assert heap_1
.CRC
== 763099253
36 assert heap_1
.file_size
== 1107
38 buckets_1
= zip_file
.getinfo('heap.01234.0001.buckets')
39 assert buckets_1
.CRC
== 2632528901
40 assert buckets_1
.file_size
== 2146
42 nm_chrome
= zip_file
.getinfo('heap.01234.symmap/chrome.abcdef.nm')
43 assert nm_chrome
.CRC
== 2717882373
44 assert nm_chrome
.file_size
== 131049
50 if __name__
== '__main__':