Port gen_run_tests.py to python3
Insignificant changes to make the script runnable on python3.
This commit is contained in:
parent
5884a076fb
commit
9d02bdc883
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from itertools import combinations
|
from itertools import combinations
|
||||||
@ -21,7 +21,7 @@ else:
|
|||||||
|
|
||||||
def powerset(items):
|
def powerset(items):
|
||||||
result = []
|
result = []
|
||||||
for i in xrange(len(items) + 1):
|
for i in range(len(items) + 1):
|
||||||
result += combinations(items, i)
|
result += combinations(items, i)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@ -53,19 +53,20 @@ possible_malloc_conf_opts = [
|
|||||||
'background_thread:true',
|
'background_thread:true',
|
||||||
]
|
]
|
||||||
|
|
||||||
print 'set -e'
|
print('set -e')
|
||||||
print 'if [ -f Makefile ] ; then %(make_cmd)s relclean ; fi' % {'make_cmd': make_cmd}
|
print('if [ -f Makefile ] ; then %(make_cmd)s relclean ; fi' % {'make_cmd':
|
||||||
print 'autoconf'
|
make_cmd})
|
||||||
print 'rm -rf run_tests.out'
|
print('autoconf')
|
||||||
print 'mkdir run_tests.out'
|
print('rm -rf run_tests.out')
|
||||||
print 'cd run_tests.out'
|
print('mkdir run_tests.out')
|
||||||
|
print('cd run_tests.out')
|
||||||
|
|
||||||
ind = 0
|
ind = 0
|
||||||
for cc, cxx in possible_compilers:
|
for cc, cxx in possible_compilers:
|
||||||
for compiler_opts in powerset(possible_compiler_opts):
|
for compiler_opts in powerset(possible_compiler_opts):
|
||||||
for config_opts in powerset(possible_config_opts):
|
for config_opts in powerset(possible_config_opts):
|
||||||
for malloc_conf_opts in powerset(possible_malloc_conf_opts):
|
for malloc_conf_opts in powerset(possible_malloc_conf_opts):
|
||||||
if cc is 'clang' \
|
if cc == 'clang' \
|
||||||
and '-m32' in possible_compiler_opts \
|
and '-m32' in possible_compiler_opts \
|
||||||
and '--enable-prof' in config_opts:
|
and '--enable-prof' in config_opts:
|
||||||
continue
|
continue
|
||||||
@ -80,9 +81,9 @@ for cc, cxx in possible_compilers:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# We don't want to test large vaddr spaces in 32-bit mode.
|
# We don't want to test large vaddr spaces in 32-bit mode.
|
||||||
if ('-m32' in compiler_opts and '--with-lg-vaddr=56' in
|
if ('-m32' in compiler_opts and '--with-lg-vaddr=56' in
|
||||||
config_opts):
|
config_opts):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Per CPU arenas are only supported on Linux.
|
# Per CPU arenas are only supported on Linux.
|
||||||
linux_supported = ('percpu_arena:percpu' in malloc_conf_opts \
|
linux_supported = ('percpu_arena:percpu' in malloc_conf_opts \
|
||||||
@ -93,7 +94,7 @@ for cc, cxx in possible_compilers:
|
|||||||
if (uname == 'Linux' and linux_supported) \
|
if (uname == 'Linux' and linux_supported) \
|
||||||
or (not linux_supported and (uname != 'Darwin' or \
|
or (not linux_supported and (uname != 'Darwin' or \
|
||||||
not darwin_unsupported)):
|
not darwin_unsupported)):
|
||||||
print """cat <<EOF > run_test_%(ind)d.sh
|
print("""cat <<EOF > run_test_%(ind)d.sh
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
@ -121,7 +122,9 @@ run_cmd %(make_cmd)s all tests
|
|||||||
run_cmd %(make_cmd)s check
|
run_cmd %(make_cmd)s check
|
||||||
run_cmd %(make_cmd)s distclean
|
run_cmd %(make_cmd)s distclean
|
||||||
EOF
|
EOF
|
||||||
chmod 755 run_test_%(ind)d.sh""" % {'ind': ind, 'config_line': config_line, 'make_cmd': make_cmd}
|
chmod 755 run_test_%(ind)d.sh""" % {'ind': ind, 'config_line': config_line,
|
||||||
|
'make_cmd': make_cmd})
|
||||||
ind += 1
|
ind += 1
|
||||||
|
|
||||||
print 'for i in `seq 0 %(last_ind)d` ; do echo run_test_${i}.sh ; done | xargs -P %(nparallel)d -n 1 sh' % {'last_ind': ind-1, 'nparallel': nparallel}
|
print('for i in `seq 0 %(last_ind)d` ; do echo run_test_${i}.sh ; done | xargs'
|
||||||
|
' -P %(nparallel)d -n 1 sh' % {'last_ind': ind-1, 'nparallel': nparallel})
|
||||||
|
Loading…
Reference in New Issue
Block a user