diff options
author | Charles Baylis <charles.baylis@linaro.org> | 2017-03-30 11:52:09 +0000 |
---|---|---|
committer | Charles Baylis <charles.baylis@linaro.org> | 2017-03-30 15:09:29 +0000 |
commit | e5d5c4b2834ee7e217c0c3040802d42090427aea (patch) | |
tree | 61b12f301bef02bc924898bcb1a96429e29e2b50 | |
parent | f07f7b7043e572b6384b4afeeb63995389930484 (diff) |
Use --list-artifacts instead of find.
Use --list-artifacts for the manifest tests and checkout tests
in place of using find to locate the manifest and the toolchain
tarballs.
Change-Id: Icf88f37c0ec9512d07d12f3ca1580347bc4bac32
-rwxr-xr-x | test-checkout.sh | 69 | ||||
-rwxr-xr-x | test-manifest2.sh | 26 |
2 files changed, 58 insertions, 37 deletions
diff --git a/test-checkout.sh b/test-checkout.sh index ad7c3ed..4e99072 100755 --- a/test-checkout.sh +++ b/test-checkout.sh @@ -94,10 +94,19 @@ trap '{ fi }' EXIT +read_var() +{ + local artifact_list=$1 + local var=$2 + grep "^${var}=" "${artifact_list}" | cut -d = -f 2- +} + relocate_manifest() { - local DEST="$1" - find . -name '*manifest.txt' -exec mv {} "$DEST" \; + local ARTIFACTS="$1" + local DEST="$2" + mv "$(read_var ${ARTIFACTS} manifest)" "${DEST}" + rm -f "${ARTIFACTS}" } validate_manifests() @@ -114,20 +123,20 @@ validate_manifests() test_defaults() { set -ex - $ABE_PATH/abe.sh --checkout all --target "$BUILD_TARGET" - relocate_manifest mani1.txt - $ABE_PATH/abe.sh --checkout all --target "$BUILD_TARGET" --enable update - relocate_manifest mani2.txt + $ABE_PATH/abe.sh --list-artifacts art.txt --checkout all --target "$BUILD_TARGET" + relocate_manifest art.txt mani1.txt + $ABE_PATH/abe.sh --list-artifacts art.txt --checkout all --target "$BUILD_TARGET" --enable update + relocate_manifest art.txt mani2.txt validate_manifests mani1.txt mani2.txt } test_native() { set -ex - $ABE_PATH/abe.sh --checkout all - relocate_manifest mani1.txt - $ABE_PATH/abe.sh --checkout all --enable update - relocate_manifest mani2.txt + $ABE_PATH/abe.sh --list-artifacts art.txt --checkout all + relocate_manifest art.txt mani1.txt + $ABE_PATH/abe.sh --list-artifacts art.txt --checkout all --enable update + relocate_manifest art.txt mani2.txt # manifest validation fails for native builds because gdbserver # is not built, and we can't recognise a native build from the # manifest. @@ -138,10 +147,10 @@ test_native() test_extraconfigdir() { set -ex - $ABE_PATH/abe.sh --checkout all --target "$BUILD_TARGET" --extraconfigdir "$ABE_PATH/config/$1" - relocate_manifest mani1.txt - $ABE_PATH/abe.sh --checkout all --target "$BUILD_TARGET" --extraconfigdir "$ABE_PATH/config/$1" --enable update - relocate_manifest mani2.txt + $ABE_PATH/abe.sh --list-artifacts art.txt --checkout all --target "$BUILD_TARGET" --extraconfigdir "$ABE_PATH/config/$1" + relocate_manifest art.txt mani1.txt + $ABE_PATH/abe.sh --list-artifacts art.txt --checkout all --target "$BUILD_TARGET" --extraconfigdir "$ABE_PATH/config/$1" --enable update + relocate_manifest art.txt mani2.txt validate_manifests mani1.txt mani2.txt } @@ -150,10 +159,10 @@ test_gccver() set -ex local gcc_ver_opt="$1" shift - $ABE_PATH/abe.sh --checkout all --target "$BUILD_TARGET" "$gcc_ver_opt" - relocate_manifest mani1.txt - $ABE_PATH/abe.sh --checkout all --target "$BUILD_TARGET" "$gcc_ver_opt" --enable update - relocate_manifest mani2.txt + $ABE_PATH/abe.sh --list-artifacts art.txt --checkout all --target "$BUILD_TARGET" "$gcc_ver_opt" + relocate_manifest art.txt mani1.txt + $ABE_PATH/abe.sh --list-artifacts art.txt --checkout all --target "$BUILD_TARGET" "$gcc_ver_opt" --enable update + relocate_manifest art.txt mani2.txt validate_manifests mani1.txt mani2.txt # we handle errors explicitly here, so switch off set -x, so that we get @@ -181,7 +190,7 @@ test_gccver() test_unknown_branch() { set -ex - ! $ABE_PATH/abe.sh --checkout all --target "$BUILD_TARGET" "$1" gcc=gcc.git~unknownbranch + ! $ABE_PATH/abe.sh --list-artifacts art.txt --checkout all --target "$BUILD_TARGET" "$1" gcc=gcc.git~unknownbranch } helper_prev_abe() @@ -193,7 +202,7 @@ helper_prev_abe() git new-workdir "$ABE_PATH" previous-abe "$(git -C "$ABE_PATH" rev-parse ${PREV_ABE_REVISION})" ./previous-abe/configure ${GIT_REF_OPT:+$GIT_REF_OPT} >& "configure.log" ./previous-abe/"$@" - relocate_manifest ../$MANI + relocate_manifest art.txt ../$MANI popd } @@ -201,10 +210,10 @@ helper_prev_abe() test_previous_abe_manifest() { set -ex - helper_prev_abe mani1.txt abe.sh --checkout all --target "$BUILD_TARGET" --release foo "$@" + helper_prev_abe mani1.txt abe.sh --list-artifacts art.txt --checkout all --target "$BUILD_TARGET" --release foo "$@" - "$ABE_PATH/abe.sh" --checkout all --manifest mani1.txt "$@" - relocate_manifest mani2.txt + "$ABE_PATH/abe.sh" --list-artifacts art.txt --checkout all --manifest mani1.txt "$@" + relocate_manifest art.txt mani2.txt validate_manifests mani1.txt mani2.txt "$ABE_TESTS_PATH/compare-manifests.pl" mani1.txt mani2.txt @@ -214,10 +223,10 @@ test_previous_abe_cmd_line() { set -ex - helper_prev_abe mani1.txt abe.sh --checkout all --target $BUILD_TARGET --release foo "$@" + helper_prev_abe mani1.txt abe.sh --list-artifacts art.txt --checkout all --target $BUILD_TARGET --release foo "$@" - "$ABE_PATH/abe.sh" --checkout all --target $BUILD_TARGET --release foo "$@" - relocate_manifest mani2.txt + "$ABE_PATH/abe.sh" --list-artifacts art.txt --checkout all --target $BUILD_TARGET --release foo "$@" + relocate_manifest art.txt mani2.txt validate_manifests mani1.txt mani2.txt # we ignore revisions here, because there could be a commit @@ -238,10 +247,10 @@ manifest_after_1_4() test_mingw() { set -ex - $ABE_PATH/abe.sh --checkout all --target "$BUILD_TARGET" --release foo - relocate_manifest mani1.txt - $ABE_PATH/abe.sh --checkout all --target "$BUILD_TARGET" --host i686-w64-mingw32 --enable update --release foo - relocate_manifest mani2.txt + $ABE_PATH/abe.sh --list-artifacts art.txt --checkout all --target "$BUILD_TARGET" --release foo + relocate_manifest art.txt mani1.txt + $ABE_PATH/abe.sh --list-artifacts art.txt --checkout all --target "$BUILD_TARGET" --host i686-w64-mingw32 --enable update --release foo + relocate_manifest art.txt mani2.txt validate_manifests mani1.txt mani2.txt if manifest_after_1_4 mani1.txt; then "$ABE_TESTS_PATH/compare-manifests.pl" mani1.txt mani2.txt diff --git a/test-manifest2.sh b/test-manifest2.sh index 4c00bc1..372a592 100755 --- a/test-manifest2.sh +++ b/test-manifest2.sh @@ -22,6 +22,14 @@ validate_path() fi } +read_var() +{ + local artifact_list=$1 + local var=$2 + grep "^${var}=" "${artifact_list}" | cut -d = -f 2- +} + + # parse command line options while [[ $# -gt 0 ]]; do OPT=$1 @@ -314,6 +322,7 @@ echo "======= BUILD TOOLCHAIN (PHASE 1)" wrap_abe 1 $TOP/test-mani-build1.txt \ $ABE_PATH/abe.sh --snapshots $SNAPSHOTS \ + --list-artifacts "artifacts1.txt" \ --target "$BUILD_TARGET" \ --build all \ ${ABE_FLAGS:+$ABE_FLAGS} \ @@ -329,19 +338,19 @@ extract_revisions $TOP/test-mani-build1.txt > $TOP/revisions1.txt echo "======= ADDING EXTRA REVISIONS (PHASE 1)" add_extra_revisions $TOP/test-mani-build1.txt -echo "======= RENAMING BUILD DIRECTORY" -mv build build.orig - echo "======= FINDING MANIFEST FROM PHASE 1" mkdir -p test pushd test -TARBALL="`ls -1rt $SNAPSHOTS/gcc-linaro-*.tar.xz | tail -n 1`" +TARBALL="$(read_var $TOP/build/artifacts1.txt toolchain)" tar axf "$TARBALL" -MANIFEST="`find $(pwd) -name '*manifest.txt'`" +MANIFEST="$(read_var $TOP/build/artifacts1.txt manifest)" cp "$MANIFEST" "$TOP/orig-manifest1.txt" popd +echo "======= RENAMING BUILD DIRECTORY" +mv build build.orig + echo "======= FOUND MANIFEST AT $MANIFEST (PHASE 1)" echo "======= VALIDATING MANIFEST FORMAT (PHASE 1)" @@ -363,6 +372,7 @@ $ABE_PATH/configure ${GIT_REF_OPT:+"$GIT_REF_OPT"} ${ABE_CONF_FLAGS:+$ABE_CONF_F echo "======= BUILD TOOLCHAIN (PHASE 2)" wrap_abe 2 $TOP/test-mani-build2.txt \ $ABE_PATH/abe.sh --disable update --snapshots $SNAPSHOTS \ + --list-artifacts "artifacts2.txt" \ --manifest "$TOP/stripped-manifest1.txt" \ --build all --tarbin @@ -389,9 +399,9 @@ echo "======= FINDING MANIFESTS FROM PHASE 2" mkdir -p test2 pushd test2 -TARBALL2="`ls -1rt $SNAPSHOTS/gcc-linaro-*.tar.xz | tail -n 1`" +TARBALL2="$(read_var $TOP/build2/artifacts2.txt toolchain)" tar axf "$TARBALL2" -MANIFEST2="`find $(pwd) -name 'gcc*manifest.txt' `" +MANIFEST2="$(read_var $TOP/build2/artifacts2.txt manifest)" cp "$MANIFEST2" "$TOP/orig-manifest2.txt" echo "======= VALIDATING MANIFEST FORMAT (PHASE 2)" @@ -484,10 +494,12 @@ $ABE_PATH/configure ${GIT_REF_OPT:+"$GIT_REF_OPT"} ${ABE_CONF_FLAGS:+$ABE_CONF_F echo "======= BUILD TOOLCHAIN (ARCHIVE 1)" wrap_abe archive1 $TOP/test-mani-checkout-archive1.txt \ $ABE_PATH/abe.sh --snapshots $SNAPSHOTS \ + --list-artifacts "artifacts-checkout-archive1.txt" \ --manifest "$ARCHIVE_TOP/orig-manifest1.txt" \ --checkout all wrap_abe archive1 $TOP/test-mani-build-archive1.txt \ $ABE_PATH/abe.sh --disable update --snapshots $SNAPSHOTS \ + --list-artifacts "artifacts-build-archive1.txt" \ --manifest "$ARCHIVE_TOP/orig-manifest1.txt" \ --build all --tarbin --dryrun |