mirror of https://github.com/llvm/torch-mlir
Add a helper run_lit.sh for interactive debugging.
parent
953ef89a30
commit
f514bd533d
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
# Runs lit-based tests by properly translating paths to the build directory.
|
||||
# Example:
|
||||
# ./tools/run_lit.sh test/Dialect -v
|
||||
set -e
|
||||
|
||||
td="$(realpath $(dirname $0)/..)"
|
||||
build_dir="$td/build"
|
||||
install_mlir="$td/install-mlir"
|
||||
build_mlir="$td/build-mlir"
|
||||
|
||||
lit_exe="$build_mlir/bin/llvm-lit"
|
||||
if ! [ -f "$lit_exe" ]; then
|
||||
echo "Could not find lit: $lit_exe"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -a lit_args
|
||||
for i in "$@"; do
|
||||
if [[ ${i:0:1} = "-" ]] || [[ ${i:0:1} = "/" ]]; then
|
||||
lit_args+=("$i")
|
||||
else
|
||||
if ! [ -e "$i" ]; then
|
||||
echo "Specified lit input does not exist: $i"
|
||||
exit 1
|
||||
fi
|
||||
test_local_path="$(realpath $i)"
|
||||
# Replace the src prefix with the build dir.
|
||||
test_build_path="$build_dir/${test_local_path##$td/}"
|
||||
lit_args+=("$test_build_path")
|
||||
fi
|
||||
done
|
||||
|
||||
set -x
|
||||
cd $build_dir/test && python3 "$lit_exe" ${lit_args[@]}
|
Loading…
Reference in New Issue