summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAlex Lapenkou <lapenkov@fb.com>2021-08-12 19:21:56 -0700
committerAlexander Lapenkov <lapenkov.a@yandex.ru>2021-08-13 10:59:32 -0700
commit9d02bdc8838d03b043de5017eaaa837f21dbc4c0 (patch)
treeee1e630961cbd342c0717b3138ae47cc9dff2127 /scripts
parent5884a076fb858320e7bcf86b961dd1555a81a75e (diff)
downloadjemalloc-9d02bdc8838d03b043de5017eaaa837f21dbc4c0.tar.gz
Port gen_run_tests.py to python3
Insignificant changes to make the script runnable on python3.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gen_run_tests.py33
1 files changed, 18 insertions, 15 deletions
diff --git a/scripts/gen_run_tests.py b/scripts/gen_run_tests.py
index 77c2ce53..7c3075f9 100755
--- a/scripts/gen_run_tests.py
+++ b/scripts/gen_run_tests.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys
from itertools import combinations
@@ -21,7 +21,7 @@ else:
def powerset(items):
result = []
- for i in xrange(len(items) + 1):
+ for i in range(len(items) + 1):
result += combinations(items, i)
return result
@@ -53,19 +53,20 @@ possible_malloc_conf_opts = [
'background_thread:true',
]
-print 'set -e'
-print 'if [ -f Makefile ] ; then %(make_cmd)s relclean ; fi' % {'make_cmd': make_cmd}
-print 'autoconf'
-print 'rm -rf run_tests.out'
-print 'mkdir run_tests.out'
-print 'cd run_tests.out'
+print('set -e')
+print('if [ -f Makefile ] ; then %(make_cmd)s relclean ; fi' % {'make_cmd':
+ make_cmd})
+print('autoconf')
+print('rm -rf run_tests.out')
+print('mkdir run_tests.out')
+print('cd run_tests.out')
ind = 0
for cc, cxx in possible_compilers:
for compiler_opts in powerset(possible_compiler_opts):
for config_opts in powerset(possible_config_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 '--enable-prof' in config_opts:
continue
@@ -80,9 +81,9 @@ for cc, cxx in possible_compilers:
)
# We don't want to test large vaddr spaces in 32-bit mode.
- if ('-m32' in compiler_opts and '--with-lg-vaddr=56' in
- config_opts):
- continue
+ if ('-m32' in compiler_opts and '--with-lg-vaddr=56' in
+ config_opts):
+ continue
# Per CPU arenas are only supported on Linux.
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) \
or (not linux_supported and (uname != 'Darwin' or \
not darwin_unsupported)):
- print """cat <<EOF > run_test_%(ind)d.sh
+ print("""cat <<EOF > run_test_%(ind)d.sh
#!/bin/sh
set -e
@@ -121,7 +122,9 @@ run_cmd %(make_cmd)s all tests
run_cmd %(make_cmd)s check
run_cmd %(make_cmd)s distclean
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
-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})