diff options
author | Charles Baylis <charles.baylis@linaro.org> | 2017-04-10 17:03:22 +0000 |
---|---|---|
committer | Charles Baylis <charles.baylis@linaro.org> | 2017-04-10 17:03:22 +0000 |
commit | 540d5912176d3124bfb4a393cff9a687ed7120bf (patch) | |
tree | 67e832c0ca8c20b1658237e7ac635cf75100ec40 | |
parent | 5251f7b3fff093a3eb16e29f0185f4d257f6ba44 (diff) |
test-manifest2.sh: Tests for --list-artifacts.
Ensure that all artifacts have absolute paths, and point to files
which exist.
Change-Id: Icbadd8171b8c9671403d315468972dfaa244eca0
-rwxr-xr-x | test-manifest2.sh | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/test-manifest2.sh b/test-manifest2.sh index 372a592..1f0e571 100755 --- a/test-manifest2.sh +++ b/test-manifest2.sh @@ -273,6 +273,33 @@ check_log() } +check_artifacts() +{ + local PHASE=$1 + local ARTIFACTS=$2 + local error + + error=0 + while read; do + local object=$(echo "${REPLY}" | cut -d = -f 1) + local path=$(echo "${REPLY}" | cut -d = -f 2-) + + if [ "${path:0:1}" != "/" ]; then + error=1 + echo "Artifact '${object}' has relative path '${path}'" >> $TOP/artifact-errors$PHASE.txt + fi + if [ ! -f ${path} ]; then + error=1 + echo "Artifact '${object}' has non-existent path '${path}'" >> $TOP/artifact-errors$PHASE.txt + fi + done < "${ARTIFACTS}" + + if [ "${error}" -eq 0 ]; then + result_pass Phase $PHASE Artifacts. + else + result_fail $TOP/artifact-errors$PHASE.txt Phase $PHASE Artifacts are invalid. + fi +} if [ -d "$GIT_REF_DIR" ]; then GIT_REF_OPT=--with-git-reference-dir=$GIT_REF_DIR @@ -338,6 +365,9 @@ 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 "======= VALIDATING ARTIFACTS (PHASE 1)" +check_artifacts 1 $TOP/build/artifacts1.txt + echo "======= FINDING MANIFEST FROM PHASE 1" mkdir -p test @@ -348,11 +378,11 @@ MANIFEST="$(read_var $TOP/build/artifacts1.txt manifest)" cp "$MANIFEST" "$TOP/orig-manifest1.txt" popd +echo "======= FOUND MANIFEST AT $MANIFEST (PHASE 1)" + echo "======= RENAMING BUILD DIRECTORY" mv build build.orig -echo "======= FOUND MANIFEST AT $MANIFEST (PHASE 1)" - echo "======= VALIDATING MANIFEST FORMAT (PHASE 1)" if $ABE_TESTS_PATH/validate-manifest.pl "$TOP/orig-manifest1.txt" &> "$TOP/validate1.txt"; then result_pass phase 1 manifest validated successfully. @@ -393,6 +423,9 @@ extract_run test-mani-build2.txt build2 >$TOP/run_lines_2.txt compare_run_lines $TOP/run_lines_1.txt $TOP/run_lines_2.txt $TOP/run_lines_diff.txt +echo "======= VALIDATING ARTIFACTS (PHASE 2)" +check_artifacts 2 $TOP/build/artifacts2.txt + echo "======= FINDING MANIFESTS FROM PHASE 2" @@ -414,8 +447,6 @@ fi echo "======= CREATING STRIPPED MANIFEST (PHASE 2)" strip_unused_content_from_manifest "$TOP/orig-manifest2.txt" "$TOP/stripped-manifest2.txt" -echo "======= FOUND MANIFESTS AT $MANIFEST (PHASE 2)" - echo "======= CHECKING MANIFESTS" scan_manifest_for_build_dir "$TOP/stripped-manifest1.txt" "$TOP/build" 1 scan_manifest_for_build_dir "$TOP/stripped-manifest2.txt" "$TOP/build" 2 |