Commit 7076c888 by Jim Stichnoth

Subzero: Move python scripts into a common pydir.

This makes it much easier to run scripts from different working directories, as long as they are run somewhere under the native_client directory. BUG= none R=jvoung@chromium.org Review URL: https://codereview.chromium.org/554013002
parent 3ef786f3
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
set -eux set -eux
# TODO(stichnot): Use FindBaseNaCl so that the script can be run from
# anywhere within the native_client directory.
PATH="../pydir:${PATH}"
OPTLEVELS="m1 2" OPTLEVELS="m1 2"
ATTRIBUTES="sse2 sse4.1" ATTRIBUTES="sse2 sse4.1"
OUTDIR=Output OUTDIR=Output
...@@ -15,7 +18,7 @@ mkdir -p "${OUTDIR}" ...@@ -15,7 +18,7 @@ mkdir -p "${OUTDIR}"
for optlevel in ${OPTLEVELS} ; do for optlevel in ${OPTLEVELS} ; do
for attribute in ${ATTRIBUTES} ; do for attribute in ${ATTRIBUTES} ; do
./crosstest.py -O${optlevel} --mattr ${attribute} \ crosstest.py -O${optlevel} --mattr ${attribute} \
--prefix=Subzero_ \ --prefix=Subzero_ \
--target=x8632 \ --target=x8632 \
--dir="${OUTDIR}" \ --dir="${OUTDIR}" \
...@@ -23,7 +26,7 @@ for optlevel in ${OPTLEVELS} ; do ...@@ -23,7 +26,7 @@ for optlevel in ${OPTLEVELS} ; do
--driver=simple_loop_main.c \ --driver=simple_loop_main.c \
--output=simple_loop_O${optlevel}_${attribute} --output=simple_loop_O${optlevel}_${attribute}
./crosstest.py -O${optlevel} --mattr ${attribute} \ crosstest.py -O${optlevel} --mattr ${attribute} \
--prefix=Subzero_ \ --prefix=Subzero_ \
--target=x8632 \ --target=x8632 \
--dir="${OUTDIR}" \ --dir="${OUTDIR}" \
...@@ -31,7 +34,7 @@ for optlevel in ${OPTLEVELS} ; do ...@@ -31,7 +34,7 @@ for optlevel in ${OPTLEVELS} ; do
--driver=mem_intrin_main.cpp \ --driver=mem_intrin_main.cpp \
--output=mem_intrin_O${optlevel}_${attribute} --output=mem_intrin_O${optlevel}_${attribute}
./crosstest.py -O${optlevel} --mattr ${attribute} \ crosstest.py -O${optlevel} --mattr ${attribute} \
--prefix=Subzero_ \ --prefix=Subzero_ \
--target=x8632 \ --target=x8632 \
--dir="${OUTDIR}" \ --dir="${OUTDIR}" \
...@@ -41,7 +44,7 @@ for optlevel in ${OPTLEVELS} ; do ...@@ -41,7 +44,7 @@ for optlevel in ${OPTLEVELS} ; do
--driver=test_arith_main.cpp \ --driver=test_arith_main.cpp \
--output=test_arith_O${optlevel}_${attribute} --output=test_arith_O${optlevel}_${attribute}
./crosstest.py -O${optlevel} --mattr ${attribute} \ crosstest.py -O${optlevel} --mattr ${attribute} \
--prefix=Subzero_ \ --prefix=Subzero_ \
--target=x8632 \ --target=x8632 \
--dir="${OUTDIR}" \ --dir="${OUTDIR}" \
...@@ -49,14 +52,14 @@ for optlevel in ${OPTLEVELS} ; do ...@@ -49,14 +52,14 @@ for optlevel in ${OPTLEVELS} ; do
--driver=test_bitmanip_main.cpp \ --driver=test_bitmanip_main.cpp \
--output=test_bitmanip_O${optlevel}_${attribute} --output=test_bitmanip_O${optlevel}_${attribute}
./crosstest.py -O${optlevel} --mattr ${attribute} \ crosstest.py -O${optlevel} --mattr ${attribute} \
--prefix=Subzero_ --target=x8632 \ --prefix=Subzero_ --target=x8632 \
--dir="${OUTDIR}" \ --dir="${OUTDIR}" \
--test=test_calling_conv.cpp \ --test=test_calling_conv.cpp \
--driver=test_calling_conv_main.cpp \ --driver=test_calling_conv_main.cpp \
--output=test_calling_conv_O${optlevel}_${attribute} --output=test_calling_conv_O${optlevel}_${attribute}
./crosstest.py -O${optlevel} --mattr ${attribute} \ crosstest.py -O${optlevel} --mattr ${attribute} \
--prefix=Subzero_ \ --prefix=Subzero_ \
--target=x8632 \ --target=x8632 \
--dir="${OUTDIR}" \ --dir="${OUTDIR}" \
...@@ -64,7 +67,7 @@ for optlevel in ${OPTLEVELS} ; do ...@@ -64,7 +67,7 @@ for optlevel in ${OPTLEVELS} ; do
--driver=test_cast_main.cpp \ --driver=test_cast_main.cpp \
--output=test_cast_O${optlevel}_${attribute} --output=test_cast_O${optlevel}_${attribute}
./crosstest.py -O${optlevel} --mattr ${attribute} \ crosstest.py -O${optlevel} --mattr ${attribute} \
--prefix=Subzero_ \ --prefix=Subzero_ \
--target=x8632 \ --target=x8632 \
--dir="${OUTDIR}" \ --dir="${OUTDIR}" \
...@@ -72,7 +75,7 @@ for optlevel in ${OPTLEVELS} ; do ...@@ -72,7 +75,7 @@ for optlevel in ${OPTLEVELS} ; do
--driver=test_fcmp_main.cpp \ --driver=test_fcmp_main.cpp \
--output=test_fcmp_O${optlevel}_${attribute} --output=test_fcmp_O${optlevel}_${attribute}
./crosstest.py -O${optlevel} --mattr ${attribute} \ crosstest.py -O${optlevel} --mattr ${attribute} \
--prefix=Subzero_ \ --prefix=Subzero_ \
--target=x8632 \ --target=x8632 \
--dir="${OUTDIR}" \ --dir="${OUTDIR}" \
...@@ -80,7 +83,7 @@ for optlevel in ${OPTLEVELS} ; do ...@@ -80,7 +83,7 @@ for optlevel in ${OPTLEVELS} ; do
--driver=test_global_main.cpp \ --driver=test_global_main.cpp \
--output=test_global_O${optlevel}_${attribute} --output=test_global_O${optlevel}_${attribute}
./crosstest.py -O${optlevel} --mattr ${attribute} \ crosstest.py -O${optlevel} --mattr ${attribute} \
--prefix=Subzero_ \ --prefix=Subzero_ \
--target=x8632 \ --target=x8632 \
--dir="${OUTDIR}" \ --dir="${OUTDIR}" \
...@@ -88,7 +91,7 @@ for optlevel in ${OPTLEVELS} ; do ...@@ -88,7 +91,7 @@ for optlevel in ${OPTLEVELS} ; do
--driver=test_icmp_main.cpp \ --driver=test_icmp_main.cpp \
--output=test_icmp_O${optlevel}_${attribute} --output=test_icmp_O${optlevel}_${attribute}
./crosstest.py -O${optlevel} --mattr ${attribute} \ crosstest.py -O${optlevel} --mattr ${attribute} \
--prefix=Subzero_ \ --prefix=Subzero_ \
--target=x8632 \ --target=x8632 \
--dir="${OUTDIR}" \ --dir="${OUTDIR}" \
...@@ -96,7 +99,7 @@ for optlevel in ${OPTLEVELS} ; do ...@@ -96,7 +99,7 @@ for optlevel in ${OPTLEVELS} ; do
--driver=test_select_main.cpp \ --driver=test_select_main.cpp \
--output=test_select_O${optlevel}_${attribute} --output=test_select_O${optlevel}_${attribute}
./crosstest.py -O${optlevel} --mattr ${attribute} \ crosstest.py -O${optlevel} --mattr ${attribute} \
--prefix=Subzero_ \ --prefix=Subzero_ \
--target=x8632 \ --target=x8632 \
--dir="${OUTDIR}" \ --dir="${OUTDIR}" \
...@@ -107,7 +110,7 @@ for optlevel in ${OPTLEVELS} ; do ...@@ -107,7 +110,7 @@ for optlevel in ${OPTLEVELS} ; do
# Compile the non-subzero object files straight from source # Compile the non-subzero object files straight from source
# since the native LLVM backend does not understand how to # since the native LLVM backend does not understand how to
# lower NaCl-specific intrinsics. # lower NaCl-specific intrinsics.
./crosstest.py -O${optlevel} --mattr ${attribute} \ crosstest.py -O${optlevel} --mattr ${attribute} \
--prefix=Subzero_ \ --prefix=Subzero_ \
--target=x8632 \ --target=x8632 \
--dir="${OUTDIR}" \ --dir="${OUTDIR}" \
...@@ -116,7 +119,7 @@ for optlevel in ${OPTLEVELS} ; do ...@@ -116,7 +119,7 @@ for optlevel in ${OPTLEVELS} ; do
--driver=test_sync_atomic_main.cpp \ --driver=test_sync_atomic_main.cpp \
--output=test_sync_atomic_O${optlevel}_${attribute} --output=test_sync_atomic_O${optlevel}_${attribute}
./crosstest.py -O${optlevel} --mattr ${attribute} \ crosstest.py -O${optlevel} --mattr ${attribute} \
--prefix=Subzero_ --target=x8632 \ --prefix=Subzero_ --target=x8632 \
--dir="${OUTDIR}" \ --dir="${OUTDIR}" \
--test=test_vector_ops.ll \ --test=test_vector_ops.ll \
......
...@@ -7,7 +7,6 @@ import subprocess ...@@ -7,7 +7,6 @@ import subprocess
import sys import sys
import tempfile import tempfile
sys.path.insert(0, '../pydir')
from utils import shellcmd from utils import shellcmd
from utils import FindBaseNaCl from utils import FindBaseNaCl
......
...@@ -7,8 +7,6 @@ import re ...@@ -7,8 +7,6 @@ import re
import subprocess import subprocess
import sys import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'pydir'))
from utils import shellcmd from utils import shellcmd
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -9,6 +9,9 @@ import sys ...@@ -9,6 +9,9 @@ import sys
import lit.formats import lit.formats
sys.path.insert(0, 'pydir')
from utils import FindBaseNaCl
# name: The name of this test suite. # name: The name of this test suite.
config.name = 'subzero' config.name = 'subzero'
...@@ -23,11 +26,13 @@ config.test_source_root = os.path.dirname(__file__) ...@@ -23,11 +26,13 @@ config.test_source_root = os.path.dirname(__file__)
config.test_exec_root = config.test_source_root config.test_exec_root = config.test_source_root
config.target_triple = '(unused)' config.target_triple = '(unused)'
src_root = os.path.abspath(os.path.join(config.test_source_root, '..')) src_root = os.path.join(FindBaseNaCl(), 'toolchain_build/src/subzero')
bin_root = src_root bin_root = src_root
config.substitutions.append(('%{src_root}', src_root)) config.substitutions.append(('%{src_root}', src_root))
config.substitutions.append(('%{python}', sys.executable)) config.substitutions.append(('%{python}', sys.executable))
pydir = os.path.join(bin_root, 'pydir')
# Finding LLVM binary tools. All tools used in the tests must be listed in # Finding LLVM binary tools. All tools used in the tests must be listed in
# the llvmbintools list. # the llvmbintools list.
llvmbinpath = os.path.abspath(os.environ.get('LLVM_BIN_PATH')) llvmbinpath = os.path.abspath(os.environ.get('LLVM_BIN_PATH'))
...@@ -35,12 +40,12 @@ llvmbinpath = os.path.abspath(os.environ.get('LLVM_BIN_PATH')) ...@@ -35,12 +40,12 @@ llvmbinpath = os.path.abspath(os.environ.get('LLVM_BIN_PATH'))
# Finding Subzero tools # Finding Subzero tools
llvm2icetool = os.path.join(bin_root, 'llvm2ice') llvm2icetool = os.path.join(bin_root, 'llvm2ice')
config.substitutions.append( config.substitutions.append(
('%llvm2iceinsts', ' '.join([os.path.join(bin_root, 'llvm2iceinsts.py'), ('%llvm2iceinsts', ' '.join([os.path.join(pydir, 'llvm2iceinsts.py'),
'--llvm2ice', llvm2icetool, '--llvm2ice', llvm2icetool,
'--llvm-bin-path', llvmbinpath '--llvm-bin-path', llvmbinpath
]))) ])))
config.substitutions.append(('%llvm2ice', llvm2icetool)) config.substitutions.append(('%llvm2ice', llvm2icetool))
config.substitutions.append(('%szdiff', os.path.join(bin_root, 'szdiff.py'))) config.substitutions.append(('%szdiff', os.path.join(pydir, 'szdiff.py')))
llvmbintools = [r"\bFileCheck\b", r"\bllvm-as\b", r"\bllvm-mc\b", llvmbintools = [r"\bFileCheck\b", r"\bllvm-as\b", r"\bllvm-mc\b",
r"\bllvm-objdump\b", r"\bnot\b", r"\bpnacl-freeze\b"] r"\bllvm-objdump\b", r"\bnot\b", r"\bpnacl-freeze\b"]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment