diff mbox

[Cbuildv2/get_source,17/17] lib/common.sh: get_source - Fix for partial match in snapshots with <package>.conf:latest set.

Message ID 1382129579-5777-18-git-send-email-ryan.arnold@linaro.org
State New
Headers show

Commit Message

Ryan S. Arnold Oct. 18, 2013, 8:52 p.m. UTC
From: "Ryan S. Arnold" <ryan.arnold@linaro.org>

This fix also removes repositories that aren't used from
testsuite/test_sources.conf and adds a few new test cases.
---
 lib/common.sh               | 21 ++++++++++++++-------
 testsuite/test.sh           | 27 +++++++++++++++++++++++++--
 testsuite/test_sources.conf | 43 ++++---------------------------------------
 3 files changed, 43 insertions(+), 48 deletions(-)
diff mbox

Patch

diff --git a/lib/common.sh b/lib/common.sh
index 0cbc532..08370b3 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -378,16 +378,23 @@  get_source()
 		    echo "	$i" 1>&2
 		done
 	     	read answer
-	     	local url="`find_snapshot ${answer}`"
-		return $?
+		local url
+	     	url="`find_snapshot ${answer}`"
+		local ssret=$?
+		echo "${url}"
+		return ${ssret}
 	    else
 		if test x"${snapshot}" != x; then
-		    # If there is a config file for this toolchain component,
-		    # see if it has a latest version set. If so, we use that.
+		    # It's possible that the value passed in to get_sources
+		    # didn't match any known snapshots OR there were too many
+		    # matches.  Check <package>.conf:latest to see if there's a
+		    # matching snapshot.
 		    if test x"${latest}"  != x; then
-			# TODO: Add a testcase for this leg.
-			local url=`find_snapshot ${latest}`
-			return $?
+			local url
+			url=`find_snapshot ${latest}`
+			local ssret=$?
+			echo "${url}"
+			return ${ssret}
 		    fi
 		    # Technically 'notice' and 'get_URL' already suppress without
 		    # verbose being set but no reason to do unnecessary work.
diff --git a/testsuite/test.sh b/testsuite/test.sh
index 25709eb..eda2ffa 100755
--- a/testsuite/test.sh
+++ b/testsuite/test.sh
@@ -328,6 +328,10 @@  echo "============= get_source() tests ================"
 #      This might be due to running testsuite in a builddir rather than a
 #      source dir.
 
+# get_sources might, at times peak at latest for a hint if it can't find
+# things.  Keep it unset unless you want to test a specific code leg.
+latest=''
+
 # Test get_source with a variety of inputs
 in="asdfasdf"
 out="`get_source ${in} 2>&1`"
@@ -446,9 +450,9 @@  else
     fixme "get_source returned ${out}"
 fi
 
-in="gcc-4.6"
+in="gcc-4.8"
 out="`get_source ${in} 2>/dev/null`"
-if test x"${out}" = x"svn://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch"; then
+if test x"${out}" = x"svn://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch"; then
     pass "get_source: tag matching an svn repo in ${sources_conf}"
 else
     fail "get_source: tag matching an svn repo in ${sources_conf}"
@@ -491,6 +495,25 @@  else
     fixme "get_source returned ${out}"
 fi
 
+latest=''
+in="gcc-linaro-4.8"
+out="`get_source ${in} 2>/dev/null`"
+if test x"${out}" = x""; then
+    pass "get_source: partial match in snapshots, latest not set."
+else
+    fail "get_source: partial match in snapshots, latest not set."
+    fixme "get_source returned ${out}"
+fi
+
+latest="gcc-linaro-4.8-2013.06.tar.bz2"
+in="gcc-linaro-4.8"
+out="`get_source ${in} 2>/dev/null`"
+if test x"${out}" = x"gcc-linaro-4.8-2013.06.tar.bz2"; then
+    pass "get_source: too many matches in snapshots, latest set."
+else
+    fail "get_source: partial matches in snapshots, latest set."
+    fixme "get_source returned ${out}"
+fi
 # ----------------------------------------------------------------------------------
 
 echo "========= create_release_tag() tests ============"
diff --git a/testsuite/test_sources.conf b/testsuite/test_sources.conf
index 90a053b..80253b2 100644
--- a/testsuite/test_sources.conf
+++ b/testsuite/test_sources.conf
@@ -2,50 +2,15 @@ 
 # This is a table of URLs for checking out development sources.
 # NOTE: use spaces instead of TABs
 #
+# For Testing Only
 
-# GCC
-gcc-4.6         svn://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch
-gcc-4.7         svn://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch
 gcc-4.8         svn://gcc.gnu.org/svn/gcc/branches/gcc-4_8-branch
-gcc-aarch64-4.7 svn://gcc.gnu.org/svn/gcc/branches/ARM/aarch64-4.7-branch
-gcc-embedded-4.6 svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-4_6-branch
-gcc-google-4.6  svn://gcc.gnu.org/svn/gcc/branches/google/gcc-4_6
-#gcc             svn://gcc.gnu.org/svn/gcc/trunk
+gcc-4.7         svn://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch
 gcc.git         git://git.linaro.org/toolchain/gcc.git
-#gcc-linaro-4.7  lp:gcc-linaro/4.7
-gcc-linaro-4.6  lp:gcc-linaro/4.6
-gdb-linaro-7.6  lp:gdb-linaro/7.6
-gdb-linaro-7.5  lp:gdb-linaro/7.5
-clang           http://llvm.org/svn/llvm-project/cfe/trunk
-cfe             http://llvm.org/svn/llvm-project/cfe/trunk
-
-# Binutils
 binutils.git    git://git.linaro.org/toolchain/binutils.git
-gdb.git         git://git.linaro.org/toolchain/gdb.git
-
-# Libraries
-llvm            http://llvm.org/svn/llvm-project/llvm/trunk
-eglibc.git      git://git.linaro.org/toolchain/eglibc.git
-glibc.git       git://git.linaro.org/toolchain/glibc.git
-newlib.git      git://git.linaro.org/toolchain/newlib.git
 libgloss.git    git://git.linaro.org/toolchain/newlib.git
-cortex-strings  lp:cortex-strings
-libav.git       git://git.libav.org/libav.git
-libffi.git      git://github.com/atgreen/libffi.git
-
-crosstool-ng-linaro lp:~linaro-toolchain-dev/crosstool-ng/linaro
-
-boot-wrapper.git git://git.linaro.org/arm/models/boot-wrapper.git
-
+newlib.git      git://git.linaro.org/toolchain/newlib.git
+eglibc.git      git://git.linaro.org/toolchain/eglibc.git
 bitbake.git     git://git.openembedded.org/bitbake
-llvm-test-suite http://llvm.org/svn/llvm-project/test-suite/trunk
-
-meta-linaro.git git://git.linaro.org/openembedded/meta-linaro.git
-openembedded-core.git git://git.openembedded.org/openembedded-core
-valgrind        svn://svn.valgrind.org/valgrind/trunk
-qemu.git        git://git.qemu.org/qemu.git
-qemu-linaro.git git://git.linaro.org/qemu/qemu-linaro.git
-
-# For Testing Only
 # nomatch.git don't uncomment and don't use this identifier.
 foo.git   git://testingrepository/foo