diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2016-04-27 10:26:41 +0000 |
---|---|---|
committer | Linaro Code Review <review@review.linaro.org> | 2016-04-27 10:26:41 +0000 |
commit | f55dc323103cfbfd204122d407b324a31660e12d (patch) | |
tree | e9d0742864eb6e06e06a557e72592ee74a67d918 | |
parent | 9ccc2446b115cb93126ebfb95a0d03e51fc1fe31 (diff) | |
parent | ce354fae5d3196135c78577f2a46ed1cb4daf29f (diff) |
Merge "Update tastsuite so it works after array branch merge."
-rw-r--r-- | lib/checkout.sh | 35 | ||||
-rw-r--r-- | lib/common.sh | 2 | ||||
-rwxr-xr-x | testsuite/test.sh | 459 |
3 files changed, 237 insertions, 259 deletions
diff --git a/lib/checkout.sh b/lib/checkout.sh index a64ebc0e..ef2bc8a3 100644 --- a/lib/checkout.sh +++ b/lib/checkout.sh @@ -149,16 +149,17 @@ checkout() local repo= repo="`get_component_filespec ${component}`" || return 1 local protocol="`echo ${url} | cut -d ':' -f 1`" + local repodir="${url}/${repo}" + + git ls-remote ${repodir} > /dev/null 2>&1 + if test $? -ne 0; then + error "proper URL required" + return 1 + fi case ${protocol} in git*|http*|ssh*) - local repodir="${url}/${repo}" # local revision= `echo ${gcc_version} | grep -o "[~@][0-9a-z]*\$" | tr -d '~@'`" - if test x"${revision}" != x"" -a x"${branch}" != x""; then - warning "You've specified both a branch \"${branch}\" and a commit \"${revision}\"." - warning "Git considers a commit as implicitly on a branch.\nOnly the commit will be used." - fi - # If the master branch doesn't exist, clone it. If it exists, # update the sources. if test ! -d ${local_snapshots}/${repo}; then @@ -193,6 +194,10 @@ checkout() # give the current checkout a name. Use -B so that it's only created if # it doesn't exist already. dryrun "(cd ${srcdir} && git checkout -B local_${revision})" + if test $? -gt 0; then + error "Can't checkout ${revision}" + return 1 + fi else notice "Checking out branch ${branch} for ${component} in ${srcdir}" if test x${dryrun} != xyes; then @@ -235,23 +240,29 @@ checkout() # No need to pull. A commit is a single moment in time # and doesn't change. dryrun "(cd ${srcdir} && git_robust checkout -B local_${revision})" + if test $? -gt 0; then + error "Can't checkout ${revision}" + return 1 + fi else # Make sure we are on the correct branch. # This is a no-op if $branch is empty and it # just gets master. dryrun "(cd ${srcdir} && git_robust checkout -B ${branch} origin/${branch})" + if test $? -gt 0; then + error "Can't checkout ${revision}" + return 1 + fi dryrun "(cd ${srcdir} && git_robust pull)" fi fi - local newrev="`pushd ${srcdir} 2>&1 > /dev/null && git log --format=format:%H -n 1 ; popd 2>&1 > /dev/null`" - if test x"${revision}" != x"${newrev}" -a x"${revision}" != x; then - error "SHA1s don't match for ${component}!, now is ${newrev}, was ${revision}" - return 1 - fi - set_component_revision ${component} ${newrev} +# local newrev="`pushd ${srcdir} 2>&1 > /dev/null && git log --format=format:%H -n 1 ; popd 2>&1 > /dev/null`" +# set_component_revision ${component} ${newrev} ;; *) + error "proper URL required" + return 1 ;; esac diff --git a/lib/common.sh b/lib/common.sh index ae8fa5a6..a5c1356d 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -266,7 +266,7 @@ create_release_tag() if test x"${release}" = x; then local date="`date +%Y%m%d`" if test x"${component}" = x"glibc"; then - local branch="~`basename ${branch}`" + local branch="`echo ${branch} | tr '/' '-'`" fi local rtag="${rtag}${branch}${revision}-${date}" else diff --git a/testsuite/test.sh b/testsuite/test.sh index f6d0ee47..99cf94ef 100755 --- a/testsuite/test.sh +++ b/testsuite/test.sh @@ -132,7 +132,7 @@ totals() # Pretty much everything uses the git parser so test it first. . "${topdir}/testsuite/git-parser-tests.sh" . "${topdir}/testsuite/stamp-tests.sh" -. "${topdir}/testsuite/normalize-tests.sh" +#. "${topdir}/testsuite/normalize-tests.sh" . "${topdir}/testsuite/dryrun-tests.sh" #. "${topdir}/testsuite/gerrit-tests.sh" #. "${topdir}/testsuite/report-tests.sh" @@ -223,29 +223,31 @@ fi # ---------------------------------------------------------------------------------- echo "============= fetch_http() tests ================" +collect_data gmp + # Download the first time without force. -out="`fetch_http infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" -if test $? -eq 0 -a -e ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz; then - pass "fetch_http infrastructure/gmp-6.0.0a.tar.xz" +out="`fetch_http gmp 2>/dev/null`" +if test $? -eq 0 -a -e ${local_snapshots}/gmp-6.0.0a.tar.xz; then + pass "fetch_http gmp" else - fail "fetch_http infrastructure/gmp-6.0.0a.tar.xz" + fail "fetch_http gmp" fi # Get the timestamp of the file. -gmp_stamp1=`stat -c %X ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz` +gmp_stamp1=`stat -c %X ${local_snapshots}/gmp-6.0.0a.tar.xz` # Download it again -out="`fetch_http infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" +out="`fetch_http gmp 2>/dev/null`" ret=$? # Get the timestamp of the file after another fetch. -gmp_stamp2=`stat -c %X ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz` +gmp_stamp2=`stat -c %X ${local_snapshots}/gmp-6.0.0a.tar.xz` # They should be the same timestamp. if test $ret -eq 0 -a ${gmp_stamp1} -eq ${gmp_stamp2}; then - pass "fetch_http infrastructure/gmp-6.0.0a.tar.xz didn't update as expected (force=no)" + pass "fetch_http gmp didn't update as expected (force=no)" else - fail "fetch_http infrastructure/gmp-6.0.0a.tar.xz updated unexpectedly (force=no)" + fail "fetch_http gmp updated unexpectedly (force=no)" fi # If the two operations happen within the same second then their timestamps will @@ -253,41 +255,41 @@ fi sleep 2s # Now try it with force on -out="`force=yes fetch_http infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" +out="`force=yes fetch_http gmp 2>/dev/null`" if test $? -gt 0; then - fail "fetch_http infrastructure/gmp-6.0.0a.tar.xz with \${force}=yes when source exists" + fail "fetch_http gmp with \${force}=yes when source exists" else - pass "fetch_http infrastructure/gmp-6.0.0a.tar.xz with \${force}=yes when source exists" + pass "fetch_http gmp with \${force}=yes when source exists" fi # Get the timestamp of the file after another fetch. -gmp_stamp3=`stat -c %X ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz` +gmp_stamp3=`stat -c %X ${local_snapshots}/gmp-6.0.0a.tar.xz` if test ${gmp_stamp1} -eq ${gmp_stamp3}; then - fail "fetch_http infrastructure/gmp-6.0.0a.tar.xz with \${force}=yes has unexpected matching timestamps" + fail "fetch_http gmp with \${force}=yes has unexpected matching timestamps" else - pass "fetch_http infrastructure/gmp-6.0.0a.tar.xz with \${force}=yes has unmatching timestamps as expected." + pass "fetch_http gmp with \${force}=yes has unmatching timestamps as expected." fi # Make sure force doesn't get in the way of a clean download. -rm ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz +rm ${local_snapshots}/gmp-6.0.0a.tar.xz # force should override supdate and this should download for the first time. -out="`force=yes fetch_http infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" +out="`force=yes fetch_http gmp 2>/dev/null`" if test $? -gt 0; then - fail "fetch_http infrastructure/gmp-6.0.0a.tar.xz with \${force}=yes and sources don't exist" + fail "fetch_http gmp with \${force}=yes and sources don't exist" else - pass "fetch_http infrastructure/gmp-6.0.0a.tar.xz with \${force}=yes and sources don't exist" + pass "fetch_http gmp with \${force}=yes and sources don't exist" fi # Test the case where wget_bin isn't set. -rm ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz +rm ${local_snapshots}/gmp-6.0.0a.tar.xz -out="`unset wget_bin; fetch_http infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" +out="`unset wget_bin; fetch_http gmp 2>/dev/null`" if test $? -gt 0; then - pass "unset wget_bin; fetch_http infrastructure/gmp-6.0.0a.tar.xz should fail." + pass "unset wget_bin; fetch_http gmp should fail." else - fail "unset wget_bin; fetch_http infrastructure/gmp-6.0.0a.tar.xz should fail." + fail "unset wget_bin; fetch_http gmp should fail." fi # Verify that '1' is returned when a non-existent file is requested. @@ -308,146 +310,101 @@ else fail "fetch <with no filename should error>" fi -# Test fetch from server with a partial name. -rm ${local_snapshots}/infrastructure/gmp-5.1* &>/dev/null -out="`fetch "infrastructure/gmp-5.1" 2>/dev/null`" -if test $? -gt 0 -o ! -e "${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz"; then - fail "fetch infrastructure/gmp-5.1 (with partial name) from server failed unexpectedly." -else - pass "fetch infrastructure/gmp-5.1 (with partial name) from server passed as expected." -fi - # Create a git_reference_dir local_refdir="${local_snapshots}/../refdir" -mkdir -p ${local_refdir}/infrastructure +mkdir -p ${local_refdir} # We need a way to differentiate the refdir version. -cp ${local_snapshots}/infrastructure/gmp-5.1* ${local_refdir}/infrastructure/gmp-6.0.0a.tar.xz -rm ${local_snapshots}/infrastructure/gmp-5.1* &>/dev/null +cp ${local_snapshots}/gmp-* ${local_refdir}/ +rm -f ${local_snapshots}/gmp-* &>/dev/null -# Use fetch that goes to a reference dir using a shortname -out="`git_reference_dir=${local_refdir} fetch infrastructure/gmp-5.1 2>/dev/null`" -if test $? -gt 0 -o ! -e "${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz"; then - fail "fetch infrastructure/gmp-5.1 (with partial name) from reference dir failed unexpectedly." -else - pass "fetch infrastructure/gmp-5.1 (with partial name) from reference dir passed as expected." -fi - -rm ${local_snapshots}/infrastructure/gmp-5.1* &>/dev/null +rm -f ${local_snapshots}/gmp-* &>/dev/null # Use fetch that goes to a reference dir using a longname -out="`git_reference_dir=${local_refdir} fetch infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" -if test $? -gt 0 -o ! -e "${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz"; then - fail "fetch infrastructure/gmp-5.1 (with full name) from reference dir failed unexpectedly." +out="`git_reference_dir=${local_refdir} fetch gmp &>/dev/null`" +if test $? -gt 0 -o ! -e "${local_snapshots}/gmp-6.0.0a.tar.xz"; then + fail "fetch gmp (with full name) from reference dir failed unexpectedly." else - pass "fetch infrastructure/gmp-5.1 (with full name) from reference dir passed as expected." + pass "fetch gmp (with full name) from reference dir passed as expected." fi -rm ${local_snapshots}/infrastructure/gmp-5.1* +rm -f ${local_snapshots}/gmp-* &>/dev/null # Replace with a marked version so we can tell if it's copied the reference # versions erroneously. -rm ${local_refdir}/infrastructure/gmp-6.0.0a.tar.xz -echo "DEADBEEF" > ${local_refdir}/infrastructure/gmp-6.0.0a.tar.xz +rm -f ${local_refdir}/gmp-6.0.0a.tar.xz +echo "DEADBEEF" > ${local_refdir}/gmp-6.0.0a.tar.xz # Use fetch that finds a git reference dir but is forced to use the server. -out="`force=yes git_reference_dir=${local_refdir} fetch infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" +out="`force=yes git_reference_dir=${local_refdir} fetch gmp 2>/dev/null`" if test $? -gt 0; then - fail "fetch infrastructure/gmp-5.1 (with full name) from reference dir failed unexpectedly." -elif test x"$(grep DEADBEEF ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz)" != x""; then - fail "fetch infrastructure/gmp-5.1 pulled from reference dir instead of server." + fail "fetch gmp (with full name) from reference dir failed unexpectedly." +elif test x"$(grep DEADBEEF ${local_snapshots}/gmp-6.0.0a.tar.xz)" != x""; then + fail "fetch gmp pulled from reference dir instead of server." else - pass "fetch infrastructure/gmp-5.1 (with full name) from reference dir passed as expected." -fi - -# The next test makes sure that the failure is due to a file md5sum mismatch. -rm ${local_refdir}/infrastructure/gmp-6.0.0a.tar.xz -echo "DEADBEEF" > ${local_refdir}/infrastructure/gmp-6.0.0a.tar.xz -out="`git_reference_dir=${local_refdir} fetch infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" -if test $? -gt 0 -a x"$(grep DEADBEEF ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz)" != x""; then - pass "fetch infrastructure/gmp-5.1 --force=yes git_reference_dir=foo failed because md5sum doesn't match." -else - fail "fetch infrastructure/gmp-5.1 --force=yes git_reference_dir=foo unexpectedly passed." + pass "fetch gmp (with full name) from reference dir passed as expected." fi # Make sure supdate=no where source doesn't exist fails -rm ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz -rm ${local_refdir}/infrastructure/gmp-6.0.0a.tar.xz -out="`supdate=no fetch infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" +rm ${local_snapshots}/gmp-6.0.0a.tar.xz +rm ${local_refdir}/gmp-6.0.0a.tar.xz +out="`supdate=no fetch gmp 2>/dev/null`" if test $? -gt 0; then - pass "fetch infrastructure/gmp-6.0.0a.tar.xz --supdate=no failed as expected when there's no source downloaded." + pass "fetch gmp --supdate=no failed as expected when there's no source downloaded." else - fail "fetch infrastructure/gmp-6.0.0a.tar.xz --supdate=no passed unexpectedly when there's no source downloaded." + fail "fetch gmp --supdate=no passed unexpectedly when there's no source downloaded." fi # Make sure supdate=no --force=yes where source doesn't exist passes by forcing # a download -rm ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz &>/dev/null -rm ${local_refdir}/infrastructure/gmp-6.0.0a.tar.xz &>/dev/null -out="`force=yes supdate=no fetch infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" -if test $? -eq 0 -a -e "${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz"; then - pass "fetch infrastructure/gmp-6.0.0a.tar.xz --supdate=no --force=yes passed as expected when there's no source downloaded." +rm ${local_snapshots}/gmp-6.0.0a.tar.xz &>/dev/null +rm ${local_refdir}/gmp-6.0.0a.tar.xz &>/dev/null +out="`force=yes supdate=no fetch gmp 2>/dev/null`" +if test $? -eq 0 -a -e "${local_snapshots}/gmp-6.0.0a.tar.xz"; then + pass "fetch gmp --supdate=no --force=yes passed as expected when there's no source downloaded." else - fail "fetch infrastructure/gmp-6.0.0a.tar.xz --supdate=no --force=yes failed unexpectedly when there's no source downloaded." + fail "fetch gmp --supdate=no --force=yes failed unexpectedly when there's no source downloaded." fi # Make sure supdate=no where source does exist passes -out="`supdate=no fetch infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" -if test $? -eq 0 -a -e "${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz"; then - pass "fetch infrastructure/gmp-6.0.0a.tar.xz --supdate=no --force=yes passed as expected because the source already exists." -else - fail "fetch infrastructure/gmp-6.0.0a.tar.xz --supdate=no --force=yes failed unexpectedly when the source exists." -fi - -cp ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz ${local_refdir}/infrastructure/ &>/dev/null - -# Test to make sure the fetch_reference creates the infrastructure directory. -rm -rf ${local_snapshots}/infrastructure &>/dev/null -out="`git_reference_dir=${local_refdir} fetch_reference infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" -if test $? -eq 0 -a -e "${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz"; then - pass "fetch_reference infrastructure/gmp-6.0.0a.tar.xz passed as expected because the infrastructure/ directory was created." +out="`supdate=no fetch gmp 2>/dev/null`" +if test $? -eq 0 -a -e "${local_snapshots}/gmp-6.0.0a.tar.xz"; then + pass "fetch gmp --supdate=no --force=yes passed as expected because the source already exists." else - fail "fetch_reference infrastructure/gmp-6.0.0a.tar.xz fail unexpectedly because the infrastructure/ directory was not created." + fail "fetch gmp --supdate=no --force=yes failed unexpectedly when the source exists." fi -# Test the same, but through the fetch() function. -rm -rf ${local_snapshots}/infrastructure &>/dev/null -out="`git_reference_dir=${local_refdir} fetch infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null`" -if test $? -eq 0 -a -e "${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz"; then - pass "git_reference_dir=${local_refdir} fetch infrastructure/gmp-6.0.0a.tar.xz passed as expected because the infrastructure/ directory was created." -else - fail "git_reference_dir=${local_refdir} fetch infrastructure/gmp-6.0.0a.tar.xz fail unexpectedly because the infrastructure/ directory was not created." -fi +cp ${local_snapshots}/gmp-6.0.0a.tar.xz ${local_refdir}/ &>/dev/null # Download a clean/new copy for the check_md5sum tests -rm ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz* &>/dev/null -fetch_http infrastructure/gmp-6.0.0a.tar.xz 2>/dev/null +rm ${local_snapshots}/gmp-6.0.0a.tar.xz* &>/dev/null +fetch_http gmp 2>/dev/null -out="`check_md5sum 'infrastructure/gmp-6.0.0a.tar.xz' 2>/dev/null`" +out="`check_md5sum 'gmp' 2>/dev/null`" if test $? -gt 0; then - fail "check_md5sum failed for 'infrastructure/gmp-6.0.0a.tar.xz" + fail "check_md5sum failed for 'gmp" else - pass "check_md5sum passed for 'infrastructure/gmp-6.0.0a.tar.xz" + pass "check_md5sum passed for 'gmp" fi # Test with a non-infrastructure file -out="`check_md5sum 'infrastructure/foo.tar.xz' 2>/dev/null`" +out="`check_md5sum 'foo' 2>/dev/null`" if test $? -gt 0; then - pass "check_md5sum failed as expected for 'infrastructure/foo.tar.xz" + pass "check_md5sum failed as expected for 'foo" else - fail "check_md5sum passed as expected for 'infrastructure/foo.tar.xz" + fail "check_md5sum passed as expected for 'foo" fi -mv ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz.back -echo "empty file" > ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz +mv ${local_snapshots}/gmp-6.0.0a.tar.xz ${local_snapshots}/gmp-6.0.0a.tar.xz.back +echo "empty file" > ${local_snapshots}/gmp-6.0.0a.tar.xz # Test an expected failure case. -out="`check_md5sum 'infrastructure/gmp-6.0.0a.tar.xz' 2>/dev/null`" +out="`check_md5sum 'gmp' 2>/dev/null`" if test $? -gt 0; then - pass "check_md5sum failed as expected for nonmatching 'infrastructure/gmp-6.0.0a.tar.xz file" + pass "check_md5sum failed as expected for nonmatching 'gmp file" else - fail "check_md5sum passed unexpectedly for nonmatching 'infrastructure/gmp-6.0.0a.tar.xz file" + fail "check_md5sum passed unexpectedly for nonmatching 'gmp file" fi -mv ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz.back ${local_snapshots}/infrastructure/gmp-6.0.0a.tar.xz +mv ${local_snapshots}/gmp-6.0.0a.tar.xz.back ${local_snapshots}/gmp-6.0.0a.tar.xz # ---------------------------------------------------------------------------------- # @@ -480,7 +437,6 @@ else fixme "create_release_tag returned ${out}" fi -mkdir -p ${local_abe_tmp}/builds echo "#define RELEASE \"development\"" > ${local_abe_tmp}/builds/version.h echo "#define VERSION \"2.22.90\"" >> ${local_abe_tmp}/builds/version.h component_init glibc BRANCH="aa/bb/cc" REVISION="1a2b3c4d5e6f" SRCDIR="${local_abe_tmp}/builds" @@ -498,6 +454,7 @@ else fixme "create_release_tag returned ${out}" fi +mkdir -p ${local_abe_tmp}/builds release=foobar testing="create_release_tag: GCC repository with release string set" out="`create_release_tag gcc | grep -v TRACE`" @@ -512,12 +469,12 @@ fi export release="2015.08-rc1" testing="create_release_tag: release candidate tarball with release" -in="gcc-linaro-5.1-2015.08-rc1.tar.xz" +in="gcc-linaro-5.1.1-2015.08-rc1.tar.xz" out="`create_release_tag ${in} | grep -v TRACE`" toolname="`echo ${out} | cut -d ' ' -f 1`" branch="`echo ${out} | cut -d ' ' -f 2`" revision="`echo ${out} | cut -d ' ' -f 3`" -if test x"${out}" = x"gcc-linaro-5.1-2015.08-rc1"; then +if test x"${out}" = x"gcc-linaro-5.1.1-2015.08-rc1"; then pass "${testing}" else fail "${testing}" @@ -526,20 +483,18 @@ fi export release="2015.08-2-rc1" testing="create_release_tag: release candidate tarball with release" -in="gcc-linaro-5.1-2015.08-2-rc1.tar.xz" +in="gcc-linaro-5.1.1-2015.08-2-rc1.tar.xz" out="`create_release_tag ${in} | grep -v TRACE`" toolname="`echo ${out} | cut -d ' ' -f 1`" branch="`echo ${out} | cut -d ' ' -f 2`" revision="`echo ${out} | cut -d ' ' -f 3`" -if test x"${out}" = x"gcc-linaro-5.1-2015.08-2-rc1"; then +if test x"${out}" = x"gcc-linaro-5.1.1-2015.08-2-rc1"; then pass "${testing}" else fail "${testing}" fixme "create_release_tag returned ${out}" fi - - # ---------------------------------------------------------------------------------- echo "============= checkout () tests ================" echo " Checking out sources into ${local_snapshots}" @@ -548,14 +503,16 @@ echo "================================================" # These can be painfully slow so test small repos. -#confirm that checkout works with raw URLs +component_init abe TOOL=abe URL=http://git.linaro.org/toolchain FILESPEC=abe.git SRCDIR=${local_snapshots}/abe.git BRANCH=master + +# confirm that checkout works with raw URLs rm -rf "${local_snapshots}"/*.git* testing="http://abe.git@git.linaro.org/git/toolchain/abe.git" -in="${testing}" +in="abe" if test x"${debug}" = xyes; then - out="`cd ${local_snapshots} && checkout ${testing}`" + out="`cd ${local_snapshots} && checkout ${in}`" else - out="`cd ${local_snapshots} && checkout ${testing} 2>/dev/null`" + out="`cd ${local_snapshots} && checkout ${in} 2>/dev/null`" fi if test $? -eq 0; then pass "${testing}" @@ -563,11 +520,13 @@ else fail "${testing}" fi -#confirm that checkout fails approriately with a range of bad services in raw URLs +# confirm that checkout fails approriately with a range of bad services in raw URLs for service in "foomatic://" "http:" "http:/fake.git" "http/" "http//" ""; do rm -rf "${local_snapshots}"/*.git* - in="${service}abe.git@git.linaro.org/git/toolchain/abe.git" - testing="checkout: ${in} should fail with 'proper URL required' message." + url="${service}abe.git@git.linaro.org/git/toolchain" + set_component_url abe ${url} + in="abe" + testing="checkout: ${in} should fail with 'proper URL required' message for ${service}." if test x"${debug}" = xyes; then out="`cd ${local_snapshots} && checkout ${in} 2> >(tee /dev/stderr)`" else @@ -576,7 +535,7 @@ for service in "foomatic://" "http:" "http:/fake.git" "http/" "http//" ""; do if test $? -eq 0; then fail "${testing}" else - if echo "${out}" | tail -n1 | grep -q "^ERROR.*: checkout (Unable to parse service from '${in}'\\. You have either a bad URL, or an identifier that should be passed to get_component_url\\.)$"; then + if echo "${out}" | grep -q "^ERROR.*: checkout (proper URL required)"; then pass "${testing}" else fail "${testing}" @@ -584,9 +543,10 @@ for service in "foomatic://" "http:" "http:/fake.git" "http/" "http//" ""; do fi done -#confirm that checkout fails with bad repo - abe is so forgiving that I can only find one suitable input +# only find one suitable input rm -rf "${local_snapshots}"/*.git* -in="http://" +set_component_url abe "http://" +in="abe" testing="checkout: ${in} should fail with 'Malformed input' message." if test x"${debug}" = xyes; then out="`cd ${local_snapshots} && checkout ${in} 2> >(tee /dev/stderr)`" @@ -596,13 +556,16 @@ fi if test $? -eq 0; then fail "${testing}" else - if echo "${out}" | tail -n1 | grep -q "^ERROR.*: get_git_repo (Malformed input \"http://\")$"; then + if echo "${out}" | grep -q "^ERROR.*: checkout (proper URL required)"; then pass "${testing}" else fail "${testing}" fi fi +# Reset the URL +set_component_url abe "http://git.linaro.org/toolchain" + test_checkout () { local should="$1" @@ -610,141 +573,154 @@ test_checkout () local package="$3" local branch="$4" local revision="$5" - local expected="$6" - - #in="${package}${branch:+/${branch}}${revision:+@${revision}}" - in="${package}${branch:+~${branch}}${revision:+@${revision}}" - - local gitinfo= - gitinfo="`sources_conf=${test_sources_conf} get_component_url ${in}`" - - local tag= - tag="`sources_conf=${test_sources_conf} get_git_url ${gitinfo}`" - tag="${tag}${branch:+~${branch}}${revision:+@${revision}}" - - # We also support / designated branches, but want to move to ~ mostly. - #tag="${tag}${branch:+~${branch}}${revision:+@${revision}}" - - #Make sure there's no hanging state relating to this test before it runs - if ls "${local_snapshots}/${package}"* > /dev/null 2>&1; then - rm -rf "${local_snapshots}/${package}"* + local ret= + local out= + + # Make sure there's no hanging state relating to this test before it runs + rm -rf ${local_snapshots}/${package}* + + if test x"${branch}" != x; then + set_component_branch ${package} ${branch} + fi + if test x"${branch}" != x; then + set_component_revision ${package} ${revision} fi - if test x"${debug}" = x"yes"; then - if test x"${expected}" = x; then - out="`(cd ${local_snapshots} && sources_conf=${test_sources_conf} checkout ${tag})`" - else - out="`(cd ${local_snapshots} && sources_conf=${test_sources_conf} checkout ${tag} 2> >(tee /dev/stderr))`" - fi + out="`(cd ${local_snapshots} && checkout ${package})`" + ret=$? + if test ${ret} -eq 0 -a x"${should}" = x"pass"; then + pass "function ${testing}" + fi + if test ${ret} -eq 0 -a x"${should}" = x"fail"; then + fail "function ${testing}" + fi + if test ${ret} -eq 1 -a x"${should}" = x"pass"; then + fail "function ${testing}" + fi + if test ${ret} -eq 1 -a x"${should}" = x"fail"; then + pass "function ${testing}" + fi else - if test x"${expected}" = x; then - out="`(cd ${local_snapshots} && sources_conf=${test_sources_conf} checkout ${tag} 2>/dev/null)`" - else - out="`(cd ${local_snapshots} && sources_conf=${test_sources_conf} checkout ${tag} 2>&1)`" - fi - fi - - #Make sure we leave no hanging state - if ls "${local_snapshots}/${package}"* > /dev/null 2>&1; then - rm -rf "${local_snapshots}/${package}"* + out="`(cd ${local_snapshots} && checkout ${package})`" + local ret=$? + if test ${ret} -eq 0 -a x"${should}" = x"pass"; then + pass "function ${testing}" + fi + if test ${ret} -eq 0 -a x"${should}" = x"fail"; then + fail "function ${testing}" + fi + if test ${ret} -eq 1 -a x"${should}" = x"pass"; then + fail "function ${testing}" + fi + if test ${ret} -eq 1 -a x"${should}" = x"fail"; then + pass "function ${testing}" + fi fi - if test x"${branch_test}" = x1 -a x"${should}" = xpass; then - if test x"${expected}" = x; then - pass "${testing}" - else - if echo "${out}" | grep -q "${expected}"; then - pass "${testing}" - return 0 - else - fail "${testing}" - return 1 - fi - fi - elif test x"${branch_test}" = x1 -a x"${should}" = xfail; then - fail "${testing}" - return 1 - elif test x"${branch_test}" = x0 -a x"${should}" = xfail; then - if test x"${expected}" = x; then - pass "${testing}" - else - if echo "${out}" | grep -q "${expected}"; then - pass "${testing}" - return 0 - else - fail "${testing}" - return 1 - fi - fi + set_component_branch ${package} "" + set_component_revision ${package} "" + + local srcdir="`get_component_srcdir ${package}`" + local branch_test=0 + if test -d ${srcdir}; then + if test x"${branch}" = x -a x"${revision}" = x; then + branch_test=`(cd ${srcdir} && git branch -a | egrep -c "^\* (local_HEAD|master)$")` + elif test x"${revision}" = x; then + branch_test=`(cd ${srcdir} && git branch -a | grep -c "^\* ${branch}$")` + else + branch_test=`(cd ${srcdir} && git branch -a | grep -c "^\* local_${revision}$")` + fi else - fail "${testing}" + untested "${testing}" return 1 fi + + # Make sure we leave no hanging state + rm -rf "${local_snapshots}/${package}"* + case ${should} in + *pass) + if test "${branch_test}" -gt 0; then + pass "${testing}" + return 0 + fi + fail "${testing}" + return 1 + ;; + *fail) + if test "${branch_test}" -eq 0; then + pass "${testing}" + return 0 + fi + fail "${testing}" + return 1 + ;; + *) + fail "${testing}" + return 1 + ;; + esac } testing="checkout: http://git@<url>/<repo>.git" -package="abe.git" +package="abe" branch='' revision='' should="pass" -expected='' -test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" "${expected}" +test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" testing="checkout: http://git@<url>/<repo>.git/<branch>" -package="abe.git" -branch="gerrit" +package="abe" +branch="stable" revision='' should="pass" -expected='' -test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" "${expected}" +test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" testing="checkout: http://git@<url>/<repo>.git@<revision>" -package="abe.git" -branch='' +package="abe" +branch='master' revision="9bcced554dfc" should="pass" -expected='' -test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" "${expected}" +test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" testing="checkout: http://git@<url>/<repo>.git/unusedbranchname@<revision>" package="abe.git" branch="unusedbranchname" revision="9bcced554dfc" should="pass" -expected='' -test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" "${expected}" +test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" + +# This should fail because it's an unknown repository +component_init foo TOOL=foo testing="checkout: git://testingrepository/foo should fail with 'clone failed' message." package="foo.git" branch='' revision='' should="fail" -expected="^ERROR.*: checkout (Failed to clone master branch from git://testingrepository/foo to ${local_snapshots}/foo)$" -test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" "${expected}" +test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" +# This should fail because an unknown branch is specified testing="checkout: http://git@<url>/<repo>.git/<nonexistentbranch> should fail with 'branch does not exist' message." package="abe.git" branch="nonexistentbranch" revision='' should="fail" -expected="^ERROR.*: checkout (Branch ${branch} likely doesn't exist in git repo ${package}\\!)$" -test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" "${expected}" +test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" +# This should fail because an unknown revision is specified testing="checkout: http://git@<url>/<repo>.git@<nonexistentrevision> should fail with 'revision does not exist' message." package="abe.git" branch='' revision="123456bogusbranch" should="fail" -expected="^ERROR.*: checkout (Revision ${revision} likely doesn't exist in git repo ${package}\\!)$" -test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" "${expected}" +test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" testing="checkout: http://git@<url>/<repo>.git~<branch> should pass with appropriate notice" package="abe.git" branch='staging' revision="" should="pass" -expected="^NOTE: Checking out branch staging for abe in .\\+~staging$" -test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" "${expected}" +test_checkout "${should}" "${testing}" "${package}" "${branch}" "${revision}" rm -rf "${local_snapshots}"/*.git* @@ -757,7 +733,7 @@ else fail "${testing}" fi -#Do not pollute env +# Do not pollute env testing="source_config" depends="`depends= && source_config isl && echo ${depends}`" static_link="`static_link= && source_config isl && echo ${static_link}`" @@ -793,42 +769,33 @@ else fi cmp_makeflags= -set +x +component_init dejagnu TOOL=dejagnu BRANCH=linaro SRCDIR=${local_snapshots}/dejagnu.git~linaro BUILDDIR=${local_builds}/dejagnu.git~linaro FILESPEC=dejagnu.git URL=http://git.linaro.org/git/toolchain + +checkout dejagnu +if test $? -eq 0; then + pass "Checking out Dejagnu for configure test" +else + fail "Checking out Dejagnu for configure test" +fi testing="configure" tool="dejagnu" configure="`grep ^configure= ${topdir}/config/${tool}.conf | cut -d '\"' -f 2`" if test x"${configure}" = xno; then - untested "${testing}" + untested "${testing}" else - out=`configure_build ${tool}.git 2>&1` - if test x"${debug}" = x"yes"; then - echo "${out}" - fi - echo "${out}" | grep -- '^DRYRUN: .*/configure ' > /dev/null - if test $? -eq 0; then - pass "${testing}" - else - fail "${testing}" - fi -fi -testing="copy instead of configure" -tool="eembc" -configure="`grep ^configure= ${topdir}/config/${tool}.conf | cut -d '\"' -f 2`" -if test \! x"${configure}" = xno; then - untested "${testing}" #implies that the tool's config no longer contains configure, or that it has a wrong value -elif test x"${configure}" = xno; then - out=`configure_build ${tool}.git 2>&1` - if test x"${debug}" = x"yes"; then - echo "${out}" - fi - echo "${out}" | grep -- '^DRYRUN: rsync -a --exclude=.git/ .\+/ ' > /dev/null - if test $? -eq 0; then - pass "${testing}" - else - fail "${testing}" - fi + out=`configure_build ${tool} 2>&1` + ret=$? + if test x"${debug}" = x"yes"; then + echo "${out}" + fi + if test -f ${local_builds}/dejagnu.git~linaro/config.log -a ${ret} -eq 0; then + pass "${testing}" + else + fail "${testing}" + fi fi + # TODO: Test checkout directly with a non URL. # TODO: Test checkout with a multi-/ branch |