Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / native_client / buildbot / buildbot_pnacl.sh
index 044a0b8..7ff16d3 100755 (executable)
@@ -34,6 +34,12 @@ readonly SCONS_S_M_IRT="small_tests_irt medium_tests_irt"
 readonly SCONS_NONSFI_NEWLIB="\
     nonsfi_nacl=1 \
     nonsfi_tests_irt"
+# Build with pnacl_generate_pexe=0 to allow using pnacl-clang with
+# direct-to-native mode. This allows assembly to be used in tests.
+readonly SCONS_NONSFI_NEWLIB_NOPNACL_GENERATE_PEXE="\
+    nonsfi_nacl=1 \
+    pnacl_generate_pexe=0 \
+    nonsfi_tests"
 # This uses the host-libc-based nonsfi_loader.
 # Using skip_nonstable_bitcode=1 here disables the tests for zero-cost C++
 # exception handling, which don't pass for Non-SFI mode yet because we
@@ -49,7 +55,7 @@ readonly SCONS_NONSFI="\
 # subset of tests used on toolchain builders
 readonly SCONS_TC_TESTS="small_tests medium_tests"
 
-readonly SCONS_COMMON="./scons --verbose bitcode=1 naclsdk_validate=0"
+readonly SCONS_COMMON="./scons --verbose bitcode=1"
 readonly UP_DOWN_LOAD="buildbot/file_up_down_load.sh"
 # This script is used by toolchain bots (i.e. tc-xxx functions)
 readonly PNACL_BUILD="pnacl/build.sh"
@@ -192,7 +198,7 @@ unarchive-for-hw-bots() {
 gyp-arm-build() {
   local gypmode="Release"
   if [ "${BUILD_MODE_HOST}" = "DEBUG" ] ; then
-      gypmode="Debug"
+    gypmode="Debug"
   fi
   local toolchain_dir=native_client/toolchain/linux_x86/arm_trusted
   local extra="-isystem ${toolchain_dir}/usr/include \
@@ -205,11 +211,10 @@ gyp-arm-build() {
 
   export AR=arm-linux-gnueabihf-ar
   export AS=arm-linux-gnueabihf-as
-  export CC="arm-linux-gnueabihf-gcc ${extra} "
-  export CXX="arm-linux-gnueabihf-g++ ${extra} "
-  export LD="arm-linux-gnueabihf-g++ ${extra} "
+  export CC="arm-linux-gnueabihf-gcc ${extra}"
+  export CXX="arm-linux-gnueabihf-g++ ${extra}"
+  export LD="arm-linux-gnueabihf-g++ ${extra}"
   export RANLIB=arm-linux-gnueabihf-ranlib
-  export SYSROOT
   export GYP_DEFINES="target_arch=arm \
     sysroot=${toolchain_dir} \
     linux_use_tcmalloc=0 armv7=1 arm_thumb=1"
@@ -228,6 +233,49 @@ gyp-arm-build() {
   make -C .. -k -j8 V=1 BUILDTYPE=${gypmode}
 }
 
+# Build with gyp for MIPS.
+gyp-mips32-build() {
+  local gypmode="Release"
+  if [ "${BUILD_MODE_HOST}" = "DEBUG" ] ; then
+    gypmode="Debug"
+  fi
+  local toolchain_dir=$(pwd)/toolchain/linux_x86/mips_trusted
+  local extra="-EL -isystem ${toolchain_dir}/usr/include \
+               -Wl,-rpath-link=${toolchain_dir}/lib/mipsel-linux-gnu \
+               -L${toolchain_dir}/lib \
+               -L${toolchain_dir}/lib/mipsel-linux-gnu \
+               -L${toolchain_dir}/usr/lib \
+               -L${toolchain_dir}/usr/lib/mipsel-linux-gnu"
+  # Setup environment for mips32.
+
+  # Check if MIPS TC has already been built. If not, build it.
+  if [ ! -f ${toolchain_dir}/bin/mipsel-linux-gnu-gcc ] ; then
+    tools/trusted_cross_toolchains/trusted-toolchain-creator.mipsel.debian.sh \
+      nacl_sdk
+  fi
+
+  export AR="$toolchain_dir/bin/mipsel-linux-gnu-ar"
+  export AS="$toolchain_dir/bin/mipsel-linux-gnu-as"
+  export CC="$toolchain_dir/bin/mipsel-linux-gnu-gcc ${extra}"
+  export CXX="$toolchain_dir/bin/mipsel-linux-gnu-g++ ${extra}"
+  export LD="$toolchain_dir/bin/mipsel-linux-gnu-g++ ${extra}"
+  export RANLIB="$toolchain_dir/bin/mipsel-linux-gnu-ranlib"
+  export GYP_DEFINES="target_arch=mipsel mips_arch_variant=mips32r2"
+  export GYP_GENERATORS=make
+
+  # NOTE: this step is also run implicitly as part of
+  #        gclient runhooks --force
+  #       it uses the exported env vars so we have to run it again
+  #
+  echo "@@@BUILD_STEP gyp_configure [${gypmode}]@@@"
+  cd ..
+  native_client/build/gyp_nacl native_client/build/all.gyp
+  cd native_client
+
+  echo "@@@BUILD_STEP gyp_compile [${gypmode}]@@@"
+  make -C .. -k -j8 V=1 BUILDTYPE=${gypmode}
+}
+
 build-sbtc-prerequisites() {
   local platform=$1
   # Sandboxed translators currently only require irt_core since they do not
@@ -322,6 +370,8 @@ mode-buildbot-arm() {
 
   # Test Non-SFI Mode.
   scons-stage-irt "arm" "${qemuflags}" "${SCONS_NONSFI_NEWLIB}"
+  scons-stage-irt "arm" "${qemuflags}" \
+    "${SCONS_NONSFI_NEWLIB_NOPNACL_GENERATE_PEXE}"
   scons-stage-irt "arm" "${qemuflags}" "${SCONS_NONSFI}"
 }
 
@@ -347,15 +397,25 @@ mode-buildbot-arm-hw() {
 
   # Test Non-SFI Mode.
   scons-stage-irt "arm" "${hwflags}" "${SCONS_NONSFI_NEWLIB}"
+  scons-stage-irt "arm" "${hwflags}" \
+    "${SCONS_NONSFI_NEWLIB_NOPNACL_GENERATE_PEXE}"
   scons-stage-irt "arm" "${hwflags}" "${SCONS_NONSFI}"
 }
 
 mode-trybot-qemu() {
   clobber
+  local arch=$1
   # TODO(dschuff): move the gyp build to buildbot_pnacl.py
-  gyp-arm-build
+  if [[ ${arch} == "arm" ]] ; then
+    gyp-arm-build
+  elif [[ ${arch} == "mips32" ]] ; then
+    gyp-mips32-build
+  fi
 
-  buildbot/buildbot_pnacl.py opt arm pnacl
+  # TODO(petarj): Enable this for MIPS arch too once all the tests pass.
+  if [[ ${arch} == "arm" ]] ; then
+    buildbot/buildbot_pnacl.py opt $arch pnacl
+  fi
 }
 
 mode-buildbot-arm-dbg() {
@@ -432,12 +492,7 @@ tc-tests-fast() {
 
   driver-tests "${arch}"
 
-  scons-stage-noirt "${arch}" "${scons_flags} -j8" "${SCONS_TC_TESTS}"
-  # Large tests cannot be run in parallel
-  scons-stage-noirt "${arch}" "${scons_flags} -j1" "large_tests"
-  scons-stage-noirt "${arch}" "${scons_flags} -j8 pnacl_generate_pexe=0" \
-    "nonpexe_tests"
-  scons-stage-noirt "${arch}" "${scons_flags} -j8 minsfi=1" "minsfi_tests"
+  buildbot/buildbot_pnacl.py opt 32 pnacl
 }
 
 mode-buildbot-tc-x8664-linux() {