cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / sandbox / linux / bpf_dsl / golden / generate.py
blobc3ed1d9a744a89c422a39909ce46c2f5bd590a1e
1 # Copyright 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.
5 import os
6 import sys
8 arches = ['i386', 'x86-64']
10 goldens = {}
12 for fn in sys.argv[2:]:
13 dir, name = fn.split('/')[-2:]
14 name = name.rstrip('.txt')
15 golden = goldens.setdefault(name, [None] * len(arches))
16 idx = arches.index(dir)
17 golden[idx] = open(fn).read()
19 with open(sys.argv[1], 'w') as f:
20 f.write("""// Generated by sandbox/linux/bpf_dsl/golden/generate.py
22 #ifndef SANDBOX_LINUX_BPF_DSL_GOLDEN_GOLDEN_FILES_H_
23 #define SANDBOX_LINUX_BPF_DSL_GOLDEN_GOLDEN_FILES_H_
25 namespace sandbox {
26 namespace bpf_dsl {
27 namespace golden {
29 struct Golden {
30 const char* i386_dump;
31 const char* x86_64_dump;
34 """)
36 for name, datas in sorted(goldens.items()):
37 f.write("const Golden k%s = {\n" % name)
38 for data in datas:
39 if data is None:
40 f.write(" nullptr,\n")
41 else:
42 f.write(" \"%s\",\n" % data.replace("\n", "\\n\\\n"))
43 f.write("};\n\n")
45 f.write("""\
46 } // namespace golden
47 } // namespace bpf_dsl
48 } // namespace sandbox
50 #endif // SANDBOX_LINUX_BPF_DSL_GOLDEN_GOLDEN_FILES_H_
51 """)