# The motivation is to ensure that newer translators can still handle
# older pexes.
-# This hopefully needs to be updated rarely, it contains pexe from
-# the sandboxed llc/gold builds
-ARCHIVED_PEXE_TRANSLATOR_REV=12177
-
# 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=12276
+ARCHIVED_TOOLCHAIN_REV=12922
readonly PNACL_BUILD="pnacl/build.sh"
readonly TOOLCHAIN_BUILD="toolchain_build/toolchain_build_pnacl.py"
# 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="pnaclsdk_mode=custom:toolchain/${PNACL_TOOLCHAIN_LABEL}"
+readonly SCONS_PICK_TC="pnacl_newlib_dir=toolchain/${PNACL_TOOLCHAIN_DIR}"
# download-old-tc -
# Download the archived frontend toolchain, if we haven't already
clobber() {
echo @@@BUILD_STEP clobber@@@
rm -rf scons-out
- # Don't clobber toolchain/pnacl_translator; these bots currently don't build
+ # Don't clobber pnacl_translator; these bots currently don't build
# it, but they use the DEPSed-in version.
- rm -rf toolchain/pnacl_linux* toolchain/pnacl_mac* toolchain/pnacl_win*
+ rm -rf toolchain/linux_x86/pnacl_newlib* \
+ toolchain/mac_x86/pnacl_newlib* \
+ toolchain/win_x86/pnacl_newlib*
}
handle-error() {
readonly SCONS_COMMON="./scons --verbose bitcode=1 -j${PNACL_CONCURRENCY}"
readonly SCONS_COMMON_SLOW="./scons --verbose bitcode=1 -j2"
-build-sbtc-prerequisites() {
+build-run-prerequisites() {
local platform=$1
${SCONS_COMMON} ${SCONS_PICK_TC} platform=${platform} \
sel_ldr sel_universal irt_core
scons-tests-translator() {
local platform=$1
-
- echo "@@@BUILD_STEP scons-sb-trans [${platform}] [prereq]@@@"
- build-sbtc-prerequisites ${platform}
-
local flags="--mode=opt-host,nacl use_sandboxed_translator=1 \
platform=${platform} -k"
local targets="small_tests medium_tests large_tests"
# 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/archived_tc
+ download-old-tc toolchain/${TOOLCHAIN_BASE_DIR}/archived_tc
# Save the current toolchain.
- mkdir -p toolchain/current_tc
- rm -rf toolchain/current_tc/*
- mv toolchain/${PNACL_TOOLCHAIN_LABEL} \
- toolchain/current_tc/${PNACL_TOOLCHAIN_LABEL}
+ 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 just use pnaclsdk_mode to select a
- # different toolchain, SCons will attempt to rebuild the IRT.
- ln -s archived_tc/${PNACL_TOOLCHAIN_LABEL} toolchain/${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_LABEL}
- mv toolchain/current_tc/${PNACL_TOOLCHAIN_LABEL} \
- toolchain/${PNACL_TOOLCHAIN_LABEL}
+ 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
fi
}
-archived-pexe-translator-test() {
- local arch=$1
- echo "@@@BUILD_STEP archived_pexe_translator \
- $arch rev ${ARCHIVED_PEXE_TRANSLATOR_REV} @@@"
- local dir="$(pwd)/pexe_archive"
- local tarball="${dir}/pexes.tar.bz2"
- local measure_cmd="/usr/bin/time -v"
- local sb_translator="${measure_cmd} \
- toolchain/pnacl_translator/bin/pnacl-translate"
- rm -rf ${dir}
- mkdir -p ${dir}
-
- ${UP_DOWN_LOAD} DownloadArchivedPexesTranslator \
- ${ARCHIVED_PEXE_TRANSLATOR_REV} ${tarball}
- tar jxf ${tarball} --directory ${dir}
-
- local ld_ext=""
- local llc_ext=""
- # Pexes are arch specific.
- case ${arch} in
- arm)
- ld_ext=".armv7.final.pexe"
- llc_ext=".armv7.final.pexe"
- ;;
- x86-32)
- ld_ext=".i686.final.pexe"
- llc_ext=".i686.final.pexe"
- ;;
- x86-64)
- ld_ext=".x86_64.final.pexe"
- llc_ext=".i686.final.pexe" # One llc pexe handles both x86-32 and x86-64.
- ;;
- *) echo "unknown arch!" && handle-error ;;
- esac
-
- # Note, that the arch flag has two functions:
- # 1) it selects the target arch for the translator
- # 2) combined with --pnacl-sb it selects the host arch for the
- # sandboxed translators
- local flags="-arch ${arch} --pnacl-sb --pnacl-driver-verbose \
- -pnaclabi-allow-dev-intrinsics"
- if [[ ${arch} = arm ]] ; then
- # We need to enable qemu magic for arm
- flags="${flags} --pnacl-use-emulator"
- fi
- local fast_trans_flags="${flags} -translate-fast"
-
- # Driver flags for overriding *just* the LLC and LD from
- # the translator, to test that the LLC and LD generated
- # from archived pexes may work. Note that this does not override the
- # libaries or the driver that are part of the translator,
- # so it is not a full override and will not work if the interface
- # has changed.
- local override_flags="\
- --pnacl-driver-set-LLC_SB=${dir}/pnacl-llc-${arch}.nexe \
- --pnacl-driver-set-LD_SB=${dir}/ld-${arch}.nexe"
- local fast_override_flags="\
- --pnacl-driver-set-LLC_SB=${dir}/pnacl-llc-${arch}.fast_trans.nexe \
- --pnacl-driver-set-LD_SB=${dir}/ld-${arch}.fast_trans.nexe"
-
- echo "=== Translating the archived translator."
- echo "=== Compiling Old Gold (normal mode) ==="
- ${sb_translator} ${flags} ${dir}/ld${ld_ext} \
- -o ${dir}/ld-${arch}.nexe
- echo "=== Compiling Old Gold (fast mode) ==="
- ${sb_translator} ${fast_trans_flags} ${dir}/ld${ld_ext} \
- -o ${dir}/ld-${arch}.fast_trans.nexe
-
- # Yikes: This takes about 17min on arm with qemu
- echo "=== Compiling Old pnacl-llc (normal mode) ==="
- ${sb_translator} ${flags} ${dir}/pnacl-llc${llc_ext} \
- -o ${dir}/pnacl-llc-${arch}.nexe
- echo "=== Compiling Old pnacl-llc (fast mode) ==="
- ${sb_translator} ${fast_trans_flags} ${dir}/pnacl-llc${llc_ext} \
- -o ${dir}/pnacl-llc-${arch}.fast_trans.nexe
-
- ls -l ${dir}
- file ${dir}/*
-
- echo "=== Running the translated archived translator to test."
- ${sb_translator} ${flags} ${override_flags} ${dir}/ld${ld_ext} \
- -o ${dir}/ld-${arch}.2.nexe
- ${sb_translator} ${flags} ${fast_override_flags} ${dir}/ld${ld_ext} \
- -o ${dir}/ld-${arch}.3.nexe
-
- # TODO(robertm): Ideally we would compare the result of translation like so
- # ${dir}/ld-${arch}.2.nexe == ${dir}/ld-${arch}.3.nexe
- # but this requires the translator to be deterministic which is not
- # quite true at the moment - probably due to due hashing inside of
- # llc based on pointer values.
-}
-
tc-test-bot() {
local archset="$1"
archset=
fi
- echo "@@@BUILD_STEP show-config@@@"
- ${PNACL_BUILD} show-config
-
- ${PNACL_BUILD} clean
- echo "@@@BUILD_STEP Sync repos for build.sh@@@"
- python ${TOOLCHAIN_BUILD} --legacy-repo-sync
- ${PNACL_BUILD} newlib-nacl-headers
-
- # Build the un-sandboxed toolchain
- echo "@@@BUILD_STEP compile_toolchain@@@"
-
- HOST_ARCH=x86_32 ${PNACL_BUILD} build-all
- # Make 64-bit versions of the build tools such as fpcmp (used for llvm
- # test suite and for some reason it matters that they match the build machine)
- ${PNACL_BUILD} llvm-configure
- PNACL_MAKE_OPTS=BUILD_DIRS_ONLY=1 ${PNACL_BUILD} llvm-make
+ # 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 \
+ --install toolchain/linux_x86/pnacl_newlib
+
+ # Linking the tests require additional sdk libraries like libnacl.
+ # Do this once and for all early instead of attempting to do it within
+ # each test step and having some late test steps rely on early test
+ # steps building the prerequisites -- sometimes the early test steps
+ # get skipped.
+ echo "@@@BUILD_STEP install sdk libraries @@@"
+ ${PNACL_BUILD} sdk
+ for arch in ${archset}; do
+ # Similarly, build the run prerequisites (sel_ldr and the irt) early.
+ echo "@@@BUILD_STEP build run prerequisites [${arch}]@@@"
+ build-run-prerequisites ${arch}
+ done
- # run the torture tests. the "trybot" phases take care of prerequisites
- # for both test sets
+ # Run the torture tests.
for arch in ${archset}; do
if [[ "${arch}" == "x86-32" ]]; then
# Torture tests on x86-32 are covered by tc-tests-all in
--concurrency=${PNACL_CONCURRENCY} || handle-error
done
- # llvm-test-suite below requires the SDK libraries to be installed.
- # torture_tests above do this as a side effect, but we do it
- # explicitly here for cases in which torture_tests are not run.
- echo "@@@BUILD_STEP install sdk libraries @@@"
- ${PNACL_BUILD} sdk
local optset
optset[1]="--opt O3f --opt O2b"
fi
for opt in "${optset[@]}"; do
echo "@@@BUILD_STEP llvm-test-suite ${arch} ${opt} @@@"
- python ${LLVM_TEST} --testsuite-prereq --arch ${arch}
python ${LLVM_TEST} --testsuite-clean
python ${LLVM_TEST} \
--testsuite-configure --testsuite-run --testsuite-report \
# script without running any more tests.
scons-tests-translator ${arch}
- archived-pexe-translator-test ${arch}
-
if [[ ${arch} = x86-64 ]] ; then
scons-tests-x86-64-zero-based-sandbox
fi