[PATCH] D34490: [sanitizers] Move building stage1 clang from buildbot_fast to buildbot_functions

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 21 17:49:15 PDT 2017


vitalybuka created this revision.

https://reviews.llvm.org/D34490

Files:
  zorg/buildbot/builders/sanitizers/buildbot_fast.sh
  zorg/buildbot/builders/sanitizers/buildbot_functions.sh


Index: zorg/buildbot/builders/sanitizers/buildbot_functions.sh
===================================================================
--- zorg/buildbot/builders/sanitizers/buildbot_functions.sh
+++ zorg/buildbot/builders/sanitizers/buildbot_functions.sh
@@ -116,6 +116,31 @@
     ninja clang compiler-rt llvm-symbolizer)
 }
 
+function build_stage1_clang_at_revison {
+  HOST_CLANG_REVISION=$1
+  if  [ -r ${STAGE1_DIR}/host_clang_revision ] && \
+      [ "$(cat ${STAGE1_DIR}/host_clang_revision)" == $HOST_CLANG_REVISION ]
+  then
+    echo @@@BUILD_STEP using pre-built stage1 clang at r$HOST_CLANG_REVISION@@@
+  else
+    echo @@@BUILD_STEP sync to r$HOST_CLANG_REVISION@@@
+    real_buildbot_revision=$BUILDBOT_REVISION
+    BUILDBOT_REVISION=$HOST_CLANG_REVISION
+    buildbot_update
+
+    echo @@@BUILD_STEP Clear ${STAGE1_DIR} ${STAGE1_CLOBBER}
+    rm -rf ${STAGE1_DIR} ${STAGE1_CLOBBER}
+
+    echo @@@BUILD_STEP build stage1 clang at r$HOST_CLANG_REVISION@@@
+
+    build_stage1_clang
+
+    echo $HOST_CLANG_REVISION > ${STAGE1_DIR}/host_clang_revision
+
+    BUILDBOT_REVISION=$real_buildbot_revision
+  fi
+}
+
 function common_stage2_variables {
   local stage1_clang_path=$ROOT/${STAGE1_DIR}/bin
   cmake_stage2_common_options="\
Index: zorg/buildbot/builders/sanitizers/buildbot_fast.sh
===================================================================
--- zorg/buildbot/builders/sanitizers/buildbot_fast.sh
+++ zorg/buildbot/builders/sanitizers/buildbot_fast.sh
@@ -20,54 +20,19 @@
 STAGE2_LIBCXX_MSAN_DIR=libcxx_build_msan
 STAGE2_LIBCXX_ASAN_DIR=libcxx_build_asan
 STAGE2_LIBCXX_UBSAN_DIR=libcxx_build_ubsan
-HOST_CLANG_REVISION=303753
+STAGE1_CLOBBER="${STAGE2_LIBCXX_MSAN_DIR} ${STAGE2_LIBCXX_ASAN_DIR} ${STAGE2_LIBCXX_UBSAN_DIR} ${STAGE2_MSAN_DIR} ${STAGE2_ASAN_DIR} ${STAGE2_UBSAN_DIR}"
 LLVM=$ROOT/llvm
 CMAKE_COMMON_OPTIONS="-GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_PARALLEL_LINK_JOBS=20"
 
 if [ "$BUILDBOT_CLOBBER" != "" ]; then
   echo @@@BUILD_STEP clobber@@@
   rm -rf llvm
   rm -rf ${STAGE1_DIR}
-  rm -f host_clang_revision
 fi
 
 # Stage 1
 
-if  [ -r host_clang_revision ] && \
-    [ "$(cat host_clang_revision)" == $HOST_CLANG_REVISION ]
-then
-  # Do nothing.
-  echo @@@BUILD_STEP using pre-built stage1 clang at r$HOST_CLANG_REVISION@@@
-else
-  echo @@@BUILD_STEP sync to r$HOST_CLANG_REVISION@@@
-  real_buildbot_revision=$BUILDBOT_REVISION
-  BUILDBOT_REVISION=$HOST_CLANG_REVISION
-  buildbot_update
-
-  echo @@@BUILD_STEP build stage1 clang at r$HOST_CLANG_REVISION@@@
-
-  rm -rf host_clang_revision
-
-  # CMake does not notice that the compiler itself has changed. Anyway,
-  # incremental builds of stage2 don't make sense if stage1 compiler has
-  # changed. Clobber the build trees.
-  rm -rf ${STAGE2_LIBCXX_MSAN_DIR}
-  rm -rf ${STAGE2_LIBCXX_ASAN_DIR}
-  rm -rf ${STAGE2_LIBCXX_UBSAN_DIR}
-  rm -rf ${STAGE2_MSAN_DIR}
-  rm -rf ${STAGE2_ASAN_DIR}
-  rm -rf ${STAGE2_UBSAN_DIR}
-
-  # Usually it happens rarely and revisions are very different, so incremental
-  # build does not make sense here as well.
-  rm -rf ${STAGE1_DIR}
-
-  build_stage1_clang
-
-  echo $HOST_CLANG_REVISION > host_clang_revision
-
-  BUILDBOT_REVISION=$real_buildbot_revision
-fi
+build_stage1_clang_at_revison 303753
 
 echo @@@BUILD_STEP update@@@
 buildbot_update


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34490.103502.patch
Type: text/x-patch
Size: 3329 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170622/b4d00de7/attachment.bin>


More information about the llvm-commits mailing list