aboutsummaryrefslogtreecommitdiff
path: root/stress/build-llvm-forever.sh
diff options
context:
space:
mode:
authorRenato Golin <rengolin@gmail.com>2016-04-26 11:02:23 +0100
committerRenato Golin <rengolin@gmail.com>2016-04-26 11:02:23 +0100
commit94cc104f044261f74fbff3ff587855df1a05f64d (patch)
tree7c6664fdf7e7fab54fea926b1fc6196a09b6540f /stress/build-llvm-forever.sh
Initial Commit, moving from dev-private and removing private stuff
Diffstat (limited to 'stress/build-llvm-forever.sh')
-rwxr-xr-xstress/build-llvm-forever.sh68
1 files changed, 68 insertions, 0 deletions
diff --git a/stress/build-llvm-forever.sh b/stress/build-llvm-forever.sh
new file mode 100755
index 0000000..465a51f
--- /dev/null
+++ b/stress/build-llvm-forever.sh
@@ -0,0 +1,68 @@
+#!/usr/bin/env bash
+
+# This script prepares and builds LLVM+Clang in a cycle
+# There are two purposes:
+# 1. Make sure the board can cope with sequential builds
+# for as long as you wish (at least 2 days non-stop)
+# 2. Make sure the builds take reasonably the same time
+#
+# That's why the script has the following features:
+#
+# * "set +e" to not fail even if the build fails, as a
+# subsequent commit can fix that, or even if the build
+# fails, we're still stressing the hardware, not the build
+# * `date` before each step, so that you can compare
+# multiple runs without having to find the `time` output
+# * Use -jCPUS, since we're not trying to get it faster, but
+# reliable, and that tells us more than -jCPUS+2, etc.
+# * Time builds and tests separately, since tests tend to be
+# more stable
+# * Don't use CCACHE, since that will defeat the purpose
+
+set +e
+
+ROOT=`pwd`
+CPUS=`grep -c proc /proc/cpuinfo`
+LINK_JOBS=
+NINJA=
+if ninja --version > /dev/null; then
+ LINK=`free -g | awk '/Mem/ {print $2}'`
+ LINK_JOBS="-DLLVM_PARALLEL_LINK_JOBS=$LINK"
+ NINJA="-G Ninja"
+fi
+
+mkdir -p build
+if [ ! -d src ]; then
+ git clone http://llvm.org/git/llvm.git src
+fi
+if [ ! -d src/tools/clang ]; then
+ cd src/tools
+ git clone http://llvm.org/git/clang.git
+fi
+cd $ROOT/build
+if [ ! -f Makefile ]; then
+ cmake ../src $NINJA \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DLLVM_BUILD_TESTS=True \
+ -DLLVM_ENABLE_ASSERTIONS=True \
+ $LINK_JOBS
+fi
+
+while /bin/true; do
+ echo -n "Updating sources at "
+ date
+ cd $ROOT/src
+ git fetch origin; git pull
+ cd tools/clang
+ git fetch origin; git pull
+ cd $ROOT/build
+ echo -n "Cleaning at "
+ date
+ make -j$CPUS clean
+ echo -n "Building at "
+ date
+ make -j$CPUS
+ echo -n "Testing at "
+ date
+ make -j$CPUS check-all
+done