Index: pydir/crosstest.py |
diff --git a/pydir/crosstest.py b/pydir/crosstest.py |
index 55a79df589b5299e0327b833c668c34e70beef6a..5ab221c0afbde0bc7a17edb6018a0bf2799b26f5 100755 |
--- a/pydir/crosstest.py |
+++ b/pydir/crosstest.py |
@@ -76,24 +76,35 @@ def main(): |
bindir = ('{root}/toolchain/linux_x86/pnacl_newlib/bin' |
.format(root=nacl_root)) |
triple = arch_map[args.target] + ('-nacl' if args.sandbox else '') |
+ mypath = os.path.abspath(os.path.dirname(sys.argv[0])) |
objs = [] |
for arg in args.test: |
+ # Construct a "unique key" for each test so that tests can be run in |
+ # parallel without race conditions on temporary file creation. |
+ key = '{target}.{sb}.O{opt}.{attr}'.format( |
+ target=args.target, sb='sb' if args.sandbox else 'nat', |
+ opt=args.optlevel, attr=args.attr) |
base, ext = os.path.splitext(arg) |
if ext == '.ll': |
bitcode = arg |
else: |
- bitcode = os.path.join(args.dir, base + '.pnacl.ll') |
- shellcmd(['../pydir/build-pnacl-ir.py', '--disable-verify', |
jvoung (off chromium)
2015/03/09 17:34:21
Is build-pnacl-ir still useful after this change?
Jim Stichnoth
2015/03/09 18:16:16
It isn't used by our scripts, but it's still kind
jvoung (off chromium)
2015/03/09 20:34:59
Hmm, up to you. I guess it could be a useful short
Jim Stichnoth
2015/03/09 20:37:48
Heh, that's where all those .pnacl.ll lit tests (a
|
- '--dir', args.dir, arg]) |
+ # Use pnacl-clang and pnacl-opt to produce PNaCl bitcode. |
+ bitcode_nonfinal = os.path.join(args.dir, base + '.' + key + '.bc') |
+ bitcode = os.path.join(args.dir, base + '.' + key + '.pnacl.ll') |
+ shellcmd(['{bin}/pnacl-clang'.format(bin=bindir), |
+ '-O2', '-c', arg, '-o', bitcode_nonfinal]) |
+ shellcmd(['{bin}/pnacl-opt'.format(bin=bindir), |
+ '-pnacl-abi-simplify-preopt', |
+ '-pnacl-abi-simplify-postopt', |
+ '-pnaclabi-allow-debug-metadata', |
+ bitcode_nonfinal, '-S', '-o', bitcode]) |
- base_sz = '{base}.{sb}.O{opt}.{attr}.{target}'.format( |
- base=base, sb='sb' if args.sandbox else 'nat', opt=args.optlevel, |
- attr=args.attr, target=args.target) |
+ base_sz = '{base}.{key}'.format(base=base, key=key) |
asm_sz = os.path.join(args.dir, base_sz + '.sz.s') |
obj_sz = os.path.join(args.dir, base_sz + '.sz.o') |
obj_llc = os.path.join(args.dir, base_sz + '.llc.o') |
- shellcmd(['../pnacl-sz', |
+ shellcmd(['{path}/pnacl-sz'.format(path=os.path.dirname(mypath)), |
'-O' + args.optlevel, |
'-mattr=' + args.attr, |
'--target=' + args.target, |