############################################################################### # Copyright (c) 2013 Linaro # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html ############################################################################### export GIT_SSH=/var/run/lava/ssh source "${BUILD_SCRIPT_ROOT}"/helpers trap infrastructure_error ERR # get the source if [ -n "$REPO_SEED_URL" ]; then repo-sync-from-seed "${1}" else repo-sync-from-mirror "${1}" fi # get toolchain if test -n "$TOOLCHAIN_URL"; then wget -nv --no-check-certificate $TOOLCHAIN_URL toolchain_filename=`echo $TOOLCHAIN_URL | sed -e 's/.*\/\([^/]*\)$/\1/'` mkdir toolchain tar -C toolchain --strip-components 1 -xf $toolchain_filename rm -rf $toolchain_filename export PATH=`pwd`/toolchain/bin:$PATH if test -z "$TOOLCHAIN_TRIPLET"; then #assume arm-linux-gnueabihf- echo "WARNING: assuming arm.linux-gnueabihf toolchain" CROSS_COMPILE="CROSS_COMPILE=arm-linux-gnueabihf-" else CROSS_COMPILE="CROSS_COMPILE=$TOOLCHAIN_TRIPLET" fi else echo "ERROR: TOOLCHAIN_URL is not optional." exit 1 fi # build the tests trap - ERR if test -e "build/Makefile"; then make $CROSS_COMPILE -C build/ build make $CROSS_COMPILE -C build/ install else echo "ERROR: Could not locate build tools, expecting a Makefile in build/ with targets build and install" exit 1 fi trap infrastructure_error ERR # Verify that the build has produced out/ if [ ! -d out ]; then echo "ERROR: out directory not found." exit 1 fi # Combine output with prebuilt android images if test -n "$ANDROID_PREBUILT_URL"; then #get prebuilt android ${BUILD_SCRIPT_ROOT}/fetch_prebuilt.py $ANDROID_PREBUILT_URL if [ ! -e boot.tar.bz2 ]; then echo "ERROR: boot.tar.bz2 not downloaded" exit 1 elif [ ! -e system.tar.bz2 ]; then echo "ERROR: system.tar.bz2 not downloaded" exit 1 elif [ ! -e userdata.tar.bz2 ]; then echo "ERROR: userdata.tar.bz2 not downloaded" exit 1 fi # move the boot tarball mv boot.tar.bz2 out/. # we are assuming that the makefile has given us a out/ structure # containing data/ and system/ with the test files # uncompress the archives so we can update them bunzip2 --keep userdata.tar.bz2 bunzip2 --keep system.tar.bz2 mv userdata.tar out/. mv system.tar out/. # update the archives with the tests cd out tar -uvpf userdata.tar data tar -uvpf system.tar system # compress them again bzip2 userdata.tar bzip2 system.tar # create tarballs with just the tests tar -pcjf tests_userdata.tar.bz2 data tar -pcjf tests_system.tar.bz2 system #clean up rm -rf data rm -rf system cd .. rm -rf system.tar.bz2 rm -rf userdata.tar.bz2 else echo "ERROR: Could not locate prebuilt android image, please set ANDROID_PREBUILT_URL" fi