From 661a80fcc0f5faaa3b9469e4508e74fd2df2ba47 Mon Sep 17 00:00:00 2001 From: Maxim Kuvyrkov Date: Fri, 9 Feb 2018 13:18:52 +0000 Subject: tcwg-llvmbot: Simple cleanup -- run.sh and start.sh are no longer templates. Change-Id: I6181f9a0ba651280cc794556e5a728fc296b10a6 --- tcwg-base/tcwg-llvmbot/build.sh | 3 +- tcwg-base/tcwg-llvmbot/run.sh | 136 +++++++++++++++++++++++++++++++++++ tcwg-base/tcwg-llvmbot/run.sh.tmpl | 136 ----------------------------------- tcwg-base/tcwg-llvmbot/start.sh | 77 ++++++++++++++++++++ tcwg-base/tcwg-llvmbot/start.sh.tmpl | 77 -------------------- 5 files changed, 214 insertions(+), 215 deletions(-) create mode 100755 tcwg-base/tcwg-llvmbot/run.sh delete mode 100755 tcwg-base/tcwg-llvmbot/run.sh.tmpl create mode 100755 tcwg-base/tcwg-llvmbot/start.sh delete mode 100755 tcwg-base/tcwg-llvmbot/start.sh.tmpl diff --git a/tcwg-base/tcwg-llvmbot/build.sh b/tcwg-base/tcwg-llvmbot/build.sh index 7b03cb27..9181795d 100755 --- a/tcwg-base/tcwg-llvmbot/build.sh +++ b/tcwg-base/tcwg-llvmbot/build.sh @@ -16,8 +16,7 @@ name=$(basename ${PWD} | cut -f3- -d '-') image=linaro/ci-${arch}-${name}-ubuntu:${distro} top=$(git rev-parse --show-toplevel) -cp $top/tcwg-base/$name/start.sh.tmpl start.sh -cp $top/tcwg-base/$name/run.sh.tmpl run.sh +cp $top/tcwg-base/$name/start.sh $top/tcwg-base/$name/run.sh ./ # llvm-config repo is hosted on [secure] dev-private-git.l.o, so we # can't clone it in here or in "RUN" command. The docker image diff --git a/tcwg-base/tcwg-llvmbot/run.sh b/tcwg-base/tcwg-llvmbot/run.sh new file mode 100755 index 00000000..dfb25dbc --- /dev/null +++ b/tcwg-base/tcwg-llvmbot/run.sh @@ -0,0 +1,136 @@ +#!/bin/bash + +set -e + +if [ x"$1" = x"start.sh" ]; then + cat /start.sh + exit 0 +fi + +if ! [ -f ~buildslave/buildslave/buildbot.tac ]; then + # Connect to silent master. + # Reconnecting to main master should be done by hand. + sudo -i -u buildslave buildslave create-slave --umask=022 ~buildslave/buildslave "$@" +fi + +case "$2" in + linaro-apm-*|linaro-tk1-*) + # Download and install clang+llvm into /usr/local for bare-metal + # bots. + case "$2" in + linaro-apm-*) + clang_ver=clang+llvm-5.0.1-aarch64-linux-gnu + ;; + linaro-tk1-*) + clang_ver=clang+llvm-5.0.1-armv7a-linux-gnueabihf + ;; + esac + + ( + cd /usr/local + rm -f $clang_ver.tar.xz + wget http://releases.llvm.org/5.0.1/$clang_ver.tar.xz + tar -x --strip-components=1 -f $clang_ver.tar.xz + ) + ;; +esac + +case "$2" in + *-libcxx|linaro-tk1-01|linaro-apm-03) + # Libcxx bots need to be compiled with clang. + cc=clang + cxx=clang++ + ;; + *-lld|linaro-apm-04) + # LLD bots need to be compiled with clang. + # ??? Adding testStage1=False to LLD bot might enable it to not depend on clang. + cc=clang + cxx=clang++ + ;; + *-arm-quick|linaro-tk1-06) + cc=clang + cxx=clang++ + ;; + *-arm-full-selfhost|linaro-tk1-05) + # ??? *-arm-full-selfhost bot doesn't look like it depends on clang. + cc=clang + cxx=clang++ + ;; + *-arm-full|linaro-tk1-08) + # ??? For now we preserve host compiler configuration from non-docker bots. + cc=clang + cxx=clang++ + ;; + *) + cc=gcc + cxx=g++ + ;; +esac + +# With default PATH /usr/local/bin/cc and /usr/local/bin/c++ are detected as +# system compilers. No danger in ccaching results of system compiler since +# we always start with a clean cache in a new container. +cat > /usr/local/bin/cc < /usr/local/bin/c++ < +EOF + +n_cores=$(nproc --all) +case "$2" in + linaro-apm-*) hw="APM Mustang ${n_cores}-core X-Gene" ;; + linaro-armv8-*) hw="${n_cores}-core ARMv8 provided by Packet.net (Type 2A2)" ;; + linaro-tk1-*) hw="NVIDIA TK1 ${n_cores}-core Cortex-A15" ;; +esac + +if [ -f /sys/fs/cgroup/memory/memory.limit_in_bytes ]; then + mem_limit=$((($(cat /sys/fs/cgroup/memory/memory.limit_in_bytes) + 512*1024*1024) / (1024*1024*1024))) +else + mem_limit=$((($(cat /proc/meminfo | grep MemTotal | sed -e "s/[^0-9]\+\([0-9]\+\)[^0-9]\+/\1/") + 512*1024) / (1024*1024))) +fi +cat < /usr/local/bin/ninja < /usr/local/bin/ninja < /usr/local/bin/cc < /usr/local/bin/c++ < -EOF - -n_cores=$(nproc --all) -case "$2" in - linaro-apm-*) hw="APM Mustang ${n_cores}-core X-Gene" ;; - linaro-armv8-*) hw="${n_cores}-core ARMv8 provided by Packet.net (Type 2A2)" ;; - linaro-tk1-*) hw="NVIDIA TK1 ${n_cores}-core Cortex-A15" ;; -esac - -if [ -f /sys/fs/cgroup/memory/memory.limit_in_bytes ]; then - mem_limit=$((($(cat /sys/fs/cgroup/memory/memory.limit_in_bytes) + 512*1024*1024) / (1024*1024*1024))) -else - mem_limit=$((($(cat /proc/meminfo | grep MemTotal | sed -e "s/[^0-9]\+\([0-9]\+\)[^0-9]\+/\1/") + 512*1024) / (1024*1024))) -fi -cat < /usr/local/bin/ninja < /usr/local/bin/ninja < + E.g., $0 lab.llvm.org:9994 linaro-apm-05 PASSWORD +EOF + exit 1 +} + +if groups 2>/dev/null | grep -q docker; then + # Run docker straight up if $USER is in "docker" group. + DOCKER="docker" +else + # Fallback to sudo otherwise. + DOCKER="sudo docker" +fi + +case "$buildmaster" in + "normal") + mastername="normal" + masterurl="lab.llvm.org:9990" + ;; + "silent") + mastername="silent" + masterurl="lab.llvm.org:9994" + ;; + *) + mastername="custom" + masterurl="$buildmaster" +esac + +# CXX, LLD and LNT bots need additional configuration, and +# are not supported yet. +case "$mastername:$slavename:$(hostname):$image" in + # No restrictions for custom masters: + custom:*:*:*) ;; + # Almost no restrictions for the silent master: + silent:*:linaro-armv8-*:*) ;; + silent:*:r*-a*:*) ;; + # Restrictions for the normal master: + normal:*:linaro-armv8-*:*) ;; + normal:*:r*-a*:*-arm64-*) ;; + *) + usage "ERROR: Wrong mastername:slavename:hostname:image combination: $mastername:$slavename:$(hostname):$image" + ;; +esac + +case "$slavename" in + linaro-armv8-*) + # Use 64G out of 128G. + memlimit="64" + ;; + *) + # Use at most 30G or 90% of all RAM. + memlimit=$(($(free -g | awk '/^Mem/ { print $2 }') * 9 / 10)) + if [ "$memlimit" -gt "30" ]; then + memlimit="30" + fi + ;; +esac + +# IPC_LOCK is required for some implementations of ssh-agent (e.g., MATE's). +# SYS_PTRACE is required for debugger work. +# seccomp:unconfined is required to disable ASLR for sanitizer tests. +caps="--cap-add=IPC_LOCK --cap-add=SYS_PTRACE --security-opt seccomp:unconfined" + +$DOCKER run --name=$mastername-$slavename --hostname=$mastername-$slavename --restart=unless-stopped -dt -p 22 --memory=${memlimit}G --pids-limit=5000 $caps "$image" "$masterurl" "$slavename" "$password" diff --git a/tcwg-base/tcwg-llvmbot/start.sh.tmpl b/tcwg-base/tcwg-llvmbot/start.sh.tmpl deleted file mode 100755 index 5c620ee4..00000000 --- a/tcwg-base/tcwg-llvmbot/start.sh.tmpl +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -set -ex - -image="$1" -buildmaster="$2" -slavename="$3" -password="$4" - -usage () -{ - echo "$@" - cat < - E.g., $0 lab.llvm.org:9994 linaro-apm-05 PASSWORD -EOF - exit 1 -} - -if groups 2>/dev/null | grep -q docker; then - # Run docker straight up if $USER is in "docker" group. - DOCKER="docker" -else - # Fallback to sudo otherwise. - DOCKER="sudo docker" -fi - -case "$buildmaster" in - "normal") - mastername="normal" - masterurl="lab.llvm.org:9990" - ;; - "silent") - mastername="silent" - masterurl="lab.llvm.org:9994" - ;; - *) - mastername="custom" - masterurl="$buildmaster" -esac - -# CXX, LLD and LNT bots need additional configuration, and -# are not supported yet. -case "$mastername:$slavename:$(hostname):$image" in - # No restrictions for custom masters: - custom:*:*:*) ;; - # Almost no restrictions for the silent master: - silent:*:linaro-armv8-*:*) ;; - silent:*:r*-a*:*) ;; - # Restrictions for the normal master: - normal:*:linaro-armv8-*:*) ;; - normal:*:r*-a*:*-arm64-*) ;; - *) - usage "ERROR: Wrong mastername:slavename:hostname:image combination: $mastername:$slavename:$(hostname):$image" - ;; -esac - -case "$slavename" in - linaro-armv8-*) - # Use 64G out of 128G. - memlimit="64" - ;; - *) - # Use at most 30G or 90% of all RAM. - memlimit=$(($(free -g | awk '/^Mem/ { print $2 }') * 9 / 10)) - if [ "$memlimit" -gt "30" ]; then - memlimit="30" - fi - ;; -esac - -# IPC_LOCK is required for some implementations of ssh-agent (e.g., MATE's). -# SYS_PTRACE is required for debugger work. -# seccomp:unconfined is required to disable ASLR for sanitizer tests. -caps="--cap-add=IPC_LOCK --cap-add=SYS_PTRACE --security-opt seccomp:unconfined" - -$DOCKER run --name=$mastername-$slavename --hostname=$mastername-$slavename --restart=unless-stopped -dt -p 22 --memory=${memlimit}G --pids-limit=5000 $caps "$image" "$masterurl" "$slavename" "$password" -- cgit v1.2.3