summaryrefslogtreecommitdiff
path: root/tcwg-lnt/lnt-check.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tcwg-lnt/lnt-check.sh')
-rwxr-xr-xtcwg-lnt/lnt-check.sh73
1 files changed, 73 insertions, 0 deletions
diff --git a/tcwg-lnt/lnt-check.sh b/tcwg-lnt/lnt-check.sh
new file mode 100755
index 00000000..1e35976c
--- /dev/null
+++ b/tcwg-lnt/lnt-check.sh
@@ -0,0 +1,73 @@
+#!/usr/bin/env bash
+
+set -euf -o pipefail
+
+
+# ####################################################################
+
+# run lnt checks - called from an llvm-lnt directory
+
+# usage : check-lnt.sh
+
+
+# ####################################################################
+
+[ -d lnt ]
+
+which sqlite3
+
+which tox
+
+which python
+
+
+# ####################################################################
+
+LLVM_BUILD_DIR="$PWD/llvm-build"
+LLVM_SRC_DIR="$LLVM_BUILD_DIR/llvm-project"
+LLVM_URL=https://github.com/llvm/llvm-project.git
+LLVM_BRANCH=main
+
+# build llvm test tools (llvm-lit, FileCheck, not)
+
+# TODO: find a simpler way to get these tools
+
+if [ ! -f "$LLVM_BUILD_DIR/bin/llvm-lit" ]; then
+
+ [ ! -d "$LLVM_SRC_DIR" ] \
+ && git clone "$LLVM_URL" "$LLVM_SRC_DIR"
+
+ cd "$LLVM_SRC_DIR"
+
+ git fetch origin
+
+ git checkout --force "origin/$LLVM_BRANCH"
+
+ mkdir -p "$LLVM_BUILD_DIR"
+
+ cd "$LLVM_BUILD_DIR"
+
+ cmake \
+ -GNinja \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DLLVM_TARGETS_TO_BUILD=AArch64 \
+ -DLLVM_ENABLE_ASSERTIONS=True \
+ -DLLVM_ENABLE_PROJECTS=clang \
+ "$LLVM_SRC_DIR/llvm"
+
+ ninja FileCheck not split-file
+fi
+
+export PATH="$LLVM_BUILD_DIR/bin/:$PATH"
+
+
+# ####################################################################
+
+# check
+
+tox -e py3,mypy
+
+# TODO: also check flake8 & docs configs
+
+
+# ####################################################################