Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / native_client / buildbot / buildbot_pnacl_toolchain_tests.sh
index 4106914..b067fbf 100755 (executable)
@@ -14,23 +14,12 @@ set -o xtrace
 set -o nounset
 set -o errexit
 
-# NOTE:
-# The pexes which are referred to below, and the pexes generated by the
-# archived frontend below will be translated with translators from DEPS.
-# The motivation is to ensure that newer translators can still handle
-# older pexes.
-
-# The frontend from this rev will generate pexes for the archived frontend
-# test. The toolchain downloader expects this information in a specially
-# formatted file. We generate that file in this script from this information,
-# to keep all our versions in one place
-ARCHIVED_TOOLCHAIN_REV=12922
-
 readonly PNACL_BUILD="pnacl/build.sh"
 readonly TOOLCHAIN_BUILD="toolchain_build/toolchain_build_pnacl.py"
 readonly UP_DOWN_LOAD="buildbot/file_up_down_load.sh"
 readonly TORTURE_TEST="tools/toolchain_tester/torture_test.py"
 readonly LLVM_TEST="pnacl/scripts/llvm-test.py"
+readonly CLANG_UPDATE="../tools/clang/scripts/update.py"
 
 # build.sh, llvm test suite and torture tests all use this value
 export PNACL_CONCURRENCY=${PNACL_CONCURRENCY:-4}
@@ -45,41 +34,6 @@ export PNACL_BUILDBOT=true
 # by long periods without console output.
 export PNACL_VERBOSE=true
 
-# For now this script runs on linux x86-64.
-# It is possible to force the PNACL_BUILD to build host binaries with "-m32",
-# by uncommenting below:
-# export BUILD_ARCH="x86_32"
-# export HOST_ARCH="x86_32"
-# TODO(pnacl-team): Figure out what to do about this.
-# Export this so that the test scripts know where to find the toolchain.
-export TOOLCHAIN_BASE_DIR=linux_x86
-export PNACL_TOOLCHAIN_DIR=${TOOLCHAIN_BASE_DIR}/pnacl_newlib
-export PNACL_TOOLCHAIN_LABEL=pnacl_linux_x86
-# This picks the TC which we just built, even if scons doesn't know
-# how to find a 64-bit host toolchain.
-readonly SCONS_PICK_TC="pnacl_newlib_dir=toolchain/${PNACL_TOOLCHAIN_DIR}"
-
-# download-old-tc -
-# Download the archived frontend toolchain, if we haven't already
-download-old-tc() {
-  local dst=$1
-
-  if [[ -f "${dst}/${ARCHIVED_TOOLCHAIN_REV}.stamp" ]]; then
-    echo "Using existing tarball for archived frontend"
-  else
-    mkdir -p "${dst}"
-    rm -rf "${dst}/*"
-    ${UP_DOWN_LOAD} DownloadPnaclToolchains ${ARCHIVED_TOOLCHAIN_REV} \
-      ${PNACL_TOOLCHAIN_LABEL} \
-      ${dst}/${PNACL_TOOLCHAIN_LABEL}.tgz
-    mkdir -p ${dst}/${PNACL_TOOLCHAIN_LABEL}
-    tar xz -C ${dst}/${PNACL_TOOLCHAIN_LABEL} \
-      -f ${dst}/${PNACL_TOOLCHAIN_LABEL}.tgz
-    touch "${dst}/${ARCHIVED_TOOLCHAIN_REV}.stamp"
-  fi
-}
-
-
 clobber() {
   echo @@@BUILD_STEP clobber@@@
   rm -rf scons-out
@@ -106,7 +60,7 @@ readonly SCONS_COMMON_SLOW="./scons --verbose bitcode=1 -j2"
 
 build-run-prerequisites() {
   local platform=$1
-  ${SCONS_COMMON} ${SCONS_PICK_TC} platform=${platform} \
+  ${SCONS_COMMON} platform=${platform} \
     sel_ldr sel_universal irt_core
 }
 
@@ -114,13 +68,13 @@ build-run-prerequisites() {
 scons-tests-translator() {
   local platform=$1
   local flags="--mode=opt-host,nacl use_sandboxed_translator=1 \
-               platform=${platform} -k"
+               platform=${platform} -k skip_trusted_tests=1"
   local targets="small_tests medium_tests large_tests"
 
   # ROUND 1: regular builds
   # generate pexes with full parallelism
   echo "@@@BUILD_STEP scons-sb-trans-pexe [${platform}] [${targets}]@@@"
-  ${SCONS_COMMON} ${SCONS_PICK_TC} ${flags} ${targets} \
+  ${SCONS_COMMON} ${flags} ${targets} \
       translate_in_build_step=0 do_not_run_tests=1 || handle-error
 
   # translate pexes
@@ -132,25 +86,25 @@ scons-tests-translator() {
       # Run sb translation twice in case we failed to translate some of the
       # pexes.  If there was an error in the first run this shouldn't
       # trigger a buildbot error.  Only the second run can make the bot red.
-      ${SCONS_COMMON_SLOW} ${SCONS_PICK_TC} ${flags} ${targets} \
+      ${SCONS_COMMON_SLOW} ${flags} ${targets} \
           do_not_run_tests=1 || ignore-error
-      ${SCONS_COMMON_SLOW} ${SCONS_PICK_TC} ${flags} ${targets} \
+      ${SCONS_COMMON_SLOW} ${flags} ${targets} \
           do_not_run_tests=1 || handle-error
       # Do not use the prefix hook for running actual tests as
       # it will break some of them due to exit code sign inversion.
       unset QEMU_PREFIX_HOOK
   else
-      ${SCONS_COMMON} ${SCONS_PICK_TC} ${flags} ${targets} \
+      ${SCONS_COMMON} ${flags} ${targets} \
           do_not_run_tests=1 || handle-error
   fi
   # finally run the tests
   echo "@@@BUILD_STEP scons-sb-trans-run [${platform}] [${targets}]@@@"
-  ${SCONS_COMMON_SLOW} ${SCONS_PICK_TC} ${flags} ${targets} || handle-error
+  ${SCONS_COMMON_SLOW} ${flags} ${targets} || handle-error
 
   # ROUND 2: builds with "fast translation"
   flags="${flags} translate_fast=1"
   echo "@@@BUILD_STEP scons-sb-trans-pexe [fast] [${platform}] [${targets}]@@@"
-  ${SCONS_COMMON} ${SCONS_PICK_TC} ${flags} ${targets} \
+  ${SCONS_COMMON} ${flags} ${targets} \
       translate_in_build_step=0 do_not_run_tests=1 || handle-error
 
   echo "@@@BUILD_STEP scons-sb-trans-trans [fast] [${platform}] [${targets}]@@@"
@@ -161,115 +115,26 @@ scons-tests-translator() {
       # Run sb translation twice in case we failed to translate some of the
       # pexes.  If there was an error in the first run this shouldn't
       # trigger a buildbot error.  Only the second run can make the bot red.
-      ${SCONS_COMMON_SLOW} ${SCONS_PICK_TC} ${flags} ${targets} \
+      ${SCONS_COMMON_SLOW} ${flags} ${targets} \
           do_not_run_tests=1 || ignore-error
-      ${SCONS_COMMON_SLOW} ${SCONS_PICK_TC} ${flags} ${targets} \
+      ${SCONS_COMMON_SLOW} ${flags} ${targets} \
           do_not_run_tests=1 || handle-error
       # Do not use the prefix hook for running actual tests as
       # it will break some of them due to exit code sign inversion.
       unset QEMU_PREFIX_HOOK
   else
-      ${SCONS_COMMON} ${SCONS_PICK_TC} ${flags} ${targets} \
+      ${SCONS_COMMON} ${flags} ${targets} \
           do_not_run_tests=1 || handle-error
   fi
   echo "@@@BUILD_STEP scons-sb-trans-run [fast] [${platform}] [${targets}]@@@"
-  ${SCONS_COMMON_SLOW} ${SCONS_PICK_TC} ${flags} ${targets} || handle-error
+  ${SCONS_COMMON_SLOW} ${flags} ${targets} || handle-error
 }
 
 scons-tests-x86-64-zero-based-sandbox() {
   echo "@@@BUILD_STEP hello_world (x86-64 zero-based sandbox)@@@"
   local flags="--mode=opt-host,nacl platform=x86-64 \
                x86_64_zero_based_sandbox=1"
-  ${SCONS_COMMON} ${SCONS_PICK_TC} ${flags} "run_hello_world_test"
-}
-
-# This test is a bitcode stability test, which builds pexes for all the tests
-# using an old version of the toolchain frontend, and then translates those
-# pexes using the current version of the translator. It's simpler than using
-# archived pexes, because archived pexes for old scons tests may not match the
-# current scons tests (e.g. if the expected output changes or if a new test
-# is added). The only thing that would break this approach is if a new test
-# is added that is incompatible with the old frontend. For this case there
-# simply needs to be a mechanism to disable that test (which could be as simple
-# as using disable_tests here on the scons command line).
-# Note: If this test is manually interrupted or killed during the run, the
-# toolchain install might end up missing or replaced with the old one.
-# To fix, copy the current one from toolchains/current_tc or blow it away
-# and re-run gclient runhooks.
-archived-frontend-test() {
-  local arch=$1
-  # Build the IRT with the latest toolchain before building user
-  # pexes with the archived toolchain.
-  echo "@@@BUILD_STEP archived_frontend [${arch}]\
-        rev ${ARCHIVED_TOOLCHAIN_REV} BUILD IRT@@@"
-  ${SCONS_COMMON} ${SCONS_PICK_TC} --mode=opt-host,nacl platform=${arch} \
-    irt_core || handle-error
-
-
-  echo "@@@BUILD_STEP archived_frontend [${arch}]\
-        rev ${ARCHIVED_TOOLCHAIN_REV} BUILD@@@"
-  local targets="small_tests medium_tests large_tests"
-  local flags="--mode=opt-host,nacl platform=${arch} \
-               translate_in_build_step=0 skip_trusted_tests=1 \
-               skip_nonstable_bitcode=1"
-
-  rm -rf scons-out/nacl-${arch}*
-
-  # Get the archived frontend.
-  # If the correct cached frontend is in place, the hash will match and the
-  # download will be a no-op. Otherwise the downloader will fix it.
-  download-old-tc toolchain/${TOOLCHAIN_BASE_DIR}/archived_tc
-
-  # Save the current toolchain.
-  mkdir -p toolchain/${TOOLCHAIN_BASE_DIR}/current_tc
-  rm -rf toolchain/${TOOLCHAIN_BASE_DIR}/current_tc/*
-  mv toolchain/${PNACL_TOOLCHAIN_DIR} \
-    toolchain/${TOOLCHAIN_BASE_DIR}/current_tc/${PNACL_TOOLCHAIN_LABEL}
-
-  # Link the old frontend into place. If we select a different toolchain,
-  # SCons will attempt to rebuild the IRT.
-  ln -s archived_tc/${PNACL_TOOLCHAIN_LABEL} toolchain/${PNACL_TOOLCHAIN_DIR}
-
-  # Build the pexes with the old frontend.
-  ${SCONS_COMMON} ${SCONS_PICK_TC} \
-    do_not_run_tests=1 ${flags} ${targets} || handle-error
-
-  # Put the current toolchain back in place.
-  rm toolchain/${PNACL_TOOLCHAIN_DIR}
-  mv toolchain/${TOOLCHAIN_BASE_DIR}/current_tc/${PNACL_TOOLCHAIN_LABEL} \
-    toolchain/${PNACL_TOOLCHAIN_DIR}
-
-  # Translate them with the new translator, and run the tests.
-  # Use the sandboxed translator, which runs the newer ABI verifier
-  # (building w/ the old frontend only runs the old ABI verifier).
-  flags="${flags} use_sandboxed_translator=1"
-  # The pexes for sandboxed and fast translation tests are identical but scons
-  # uses a different directory.
-  local pexe_dir="scons-out/nacl-${arch}-pnacl-pexe-clang"
-  cp -a ${pexe_dir} "scons-out/nacl-${arch}-pnacl-sbtc-pexe-clang"
-  cp -a ${pexe_dir} "scons-out/nacl-${arch}-pnacl-fast-sbtc-pexe-clang"
-
-  echo "@@@BUILD_STEP archived_frontend [${arch}]\
-        rev ${ARCHIVED_TOOLCHAIN_REV} RUN@@@"
-  local archived_flags="${flags} built_elsewhere=1 toolchain_feature_version=0"
-  # For QEMU limit parallelism to avoid flake.
-  if [[ ${arch} = arm ]] ; then
-    ${SCONS_COMMON_SLOW} ${SCONS_PICK_TC} \
-      ${archived_flags} ${targets} || handle-error
-    # Also test the fast-translation option
-    echo "@@@BUILD_STEP archived_frontend [${arch} translate-fast]\
-        rev ${ARCHIVED_TOOLCHAIN_REV} RUN@@@"
-    ${SCONS_COMMON_SLOW} ${SCONS_PICK_TC} ${archived_flags} translate_fast=1 \
-      ${targets} || handle-error
-  else
-    ${SCONS_COMMON} ${SCONS_PICK_TC} \
-      ${archived_flags} ${targets} || handle-error
-    # Also test the fast-translation option
-    echo "@@@BUILD_STEP archived_frontend [${arch} translate-fast]\
-        rev ${ARCHIVED_TOOLCHAIN_REV} RUN@@@"
-    ${SCONS_COMMON} ${SCONS_PICK_TC} ${archived_flags} translate_fast=1 \
-      ${targets} || handle-error
-  fi
+  ${SCONS_COMMON} ${flags} "run_hello_world_test"
 }
 
 
@@ -277,6 +142,9 @@ tc-test-bot() {
   local archset="$1"
   clobber
 
+  # Update Clang
+  python ${CLANG_UPDATE}
+
   # Only build MIPS stuff on mips bots
   if [[ ${archset} == "mips" ]]; then
     export PNACL_BUILD_MIPS=true
@@ -287,11 +155,7 @@ tc-test-bot() {
 
   # Build the un-sandboxed toolchain. The build script outputs its own buildbot
   # annotations.
-  # Build and use the 64-bit llvm build, to get 64-bit versions of the build
-  # tools such as fpcmp (used for llvm test suite). For some reason it matters
-  # that they match the build machine. TODO(dschuff): Is this still necessary?
-  ${TOOLCHAIN_BUILD} --verbose --sync --clobber --build-64bit-host \
-    --testsuite-sync \
+  ${TOOLCHAIN_BUILD} --verbose --sync --clobber --testsuite-sync --gcc\
     --install toolchain/linux_x86/pnacl_newlib
 
   # Linking the tests require additional sdk libraries like libnacl.
@@ -342,8 +206,6 @@ tc-test-bot() {
     echo "@@@BUILD_STEP libcxx-test ${arch} @@@"
     python ${LLVM_TEST} --libcxx-test --arch ${arch} -c || handle-error
 
-    archived-frontend-test ${arch}
-
     # Note: we do not build the sandboxed translator on this bot
     # because this would add another 20min to the build time.
     # The upshot of this is that we are using the sandboxed