Add tools/test_all.sh

We should look into having a `ninja check-npcomp` that runs everything
with lit so that we get decent test multithreading.
We can look to how LLVM does its gtest tests ("unittests") for
inspiration.
pull/1/head
Sean Silva 2020-05-07 20:28:40 -07:00
parent f2985e0901
commit f394e12d86
2 changed files with 33 additions and 0 deletions

View File

@ -31,6 +31,8 @@ export LLVM_SRC_DIR=/path/to/llvm-project
./tools/install_mlir.sh
./tools/cmake_configure.sh
# ./tools/test_all.sh runs all of these commands.
cd build
ninja
ninja check-npcomp-opt

31
tools/test_all.sh 100755
View File

@ -0,0 +1,31 @@
#!/bin/bash
# Runs all the tests we are aware of in mlir-npcomp.
# TODO: This should eventually all be folded into a `ninja check-npcomp`.
# Unfortunately, that seems to be a level of build engineering that we
# haven't had enough bandwidth for.
#
# The basic idea seems to be to teach `lit` how to run our Python tests.
#
# There is precendent for doing this, e.g.
# - For GoogleTest tests (i.e. "unittests"): https://github.com/llvm/llvm-project/blob/c490c5e81ac90cbf079c7cee18cd56171f1e27af/llvm/test/Unit/lit.cfg.py#L25
# - LLDB tests: https://github.com/llvm/llvm-project/blob/eb7d32e46fe184fdfcb52e0a25973e713047e305/lldb/test/API/lldbtest.py#L32
# - libcxx tests: https://github.com/llvm/llvm-project/blob/eb7d32e46fe184fdfcb52e0a25973e713047e305/libcxx/utils/libcxx/test/newformat.py#L192
#
# The `getTestsInDirectory` keyword seems to be what to search for.
set -euo pipefail
td="$(realpath $(dirname $0)/..)"
cd $td/build
ninja
ninja check-npcomp-opt
./python/run_tests.py
echo
echo "========"
echo "ALL PASS"
echo "========"