aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan S. Arnold <ryan.arnold@linaro.org>2013-12-10 16:08:17 -0600
committerRyan S. Arnold <ryan.arnold@linaro.org>2013-12-10 16:30:07 -0600
commite6e39f5d1f7963332b3d7dd2e4400de91847219c (patch)
tree38bb686b7d9f52968c21ab86a4ba765008c42d99
parentb6e9c6c7c850eff8f9d7894410a59bc340f847b1 (diff)
Correct get_toolname to work with unified repo: binutils-gdb.git
Secondary fixes required: * Set config/binutils.conf and config/gdb.conf to use unified repo binutils-gdb.git. * Re-enable binutils-gdb.git in config/sources.conf. * get_toolname now calls get_git_tool and determines the actual toolname for binutils and gdb from the branch name if the repository is unified. * Made all other usages of get_git_tool use get_toolname instead. * checkout() now uses ${repo} as returned from get_git_repo as the git repository instead of ${tool}.git. This allows a unified repository to only be checked out once. * The git parser now determines whether an http:// in a url means a git service or an svn service. * The git parser now returns branch names for launchpad urls with branches in the url. * The git parser now returns the tool name properly for an svn service. * The git parser testsuite now has testcases for all new additions. Also * Added --snapshots functionality to allow specifying an existing snapshots directory. * Add testcases to test.sh to test --snapshots functionality. * Changes test.sh --snapshots directive to --md5sums to avoid confusion with cbuild2.sh --snapshots. Change-Id: I2c279bd85320bd3d0b50ae262cc13255f45f8b14
-rwxr-xr-xcbuild2.sh24
-rw-r--r--config/binutils.conf2
-rw-r--r--config/gdb.conf2
-rw-r--r--config/sources.conf6
-rw-r--r--lib/checkout.sh16
-rw-r--r--lib/common.sh25
-rwxr-xr-xlib/configure.sh6
-rw-r--r--lib/git-parser.sh46
-rwxr-xr-xlib/make.sh5
-rwxr-xr-xtest.sh80
-rw-r--r--testsuite/git-parser-tests.sh103
-rw-r--r--testsuite/normalize-tests.sh23
-rwxr-xr-xtestsuite/test.sh77
-rw-r--r--testsuite/test_sources.conf1
14 files changed, 291 insertions, 125 deletions
diff --git a/cbuild2.sh b/cbuild2.sh
index fcf83edd..00c115c3 100755
--- a/cbuild2.sh
+++ b/cbuild2.sh
@@ -4,7 +4,7 @@
if test -e "${PWD}/host.conf"; then
. "${PWD}/host.conf"
else
- warning "no host.conf file! Did you run configure?"
+ echo "WARNING: no host.conf file! Did you run configure?" 1>&2
fi
# load commonly used functions
@@ -305,8 +305,8 @@ OPTIONS
setting overrides the default. Specifying a libc
other than newlib on baremetal targets is an error.
- --snapshots <url>
- Use an alternate snapshots file as specified by <url>.
+ --snapshots /path/to/alternative/local_snapshots/directory
+ Use an alternative path to a local snapshots directory.
--tarball
Build source and binary tarballs after a successful build.
@@ -581,8 +581,18 @@ while test $# -gt 0; do
fi
shift
;;
- --snapshots|-s)
- set_snapshots ${url}
+ --snap*|-snap*)
+ if test `echo $1 | grep -c "\-snapshots.*=" ` -gt 0; then
+ error "A '=' is invalid after --snapshots. A space is expected."
+ exit 1;
+ fi
+ if test x"$2" = x; then
+ error "--snapshots requires a directive. See --usage for details.' "
+ time="`expr ${SECONDS} / 60`"
+ error "Build process failed after ${time} minutes"
+ exit 1
+ fi
+ local_snapshots=$2
shift
;;
--tarball*|-tarba*)
@@ -604,7 +614,7 @@ while test $# -gt 0; do
error "--target requires a directive. See --usage for details.' "
time="`expr ${SECONDS} / 60`"
error "Build process failed after ${time} minutes"
- exit
+ exit 1
fi
target=$2
@@ -635,7 +645,7 @@ while test $# -gt 0; do
error "--timeout requires a directive. See --usage for details.' "
time="`expr ${SECONDS} / 60`"
error "Build process failed after ${time} minutes"
- exit
+ exit 1
elif test $2 -lt 11; then
wget_timeout=$2
else
diff --git a/config/binutils.conf b/config/binutils.conf
index c1b653ba..8e25610b 100644
--- a/config/binutils.conf
+++ b/config/binutils.conf
@@ -2,7 +2,7 @@
depends=""
# This is the latest version of this toolchain component
-#latest="binutils.git"
+#latest="binutils.git~binutils-2_24-branch"
latest="binutils-gdb.git/binutils-2_24-branch"
# Example of a tarball that extracts to a directory name that differs from
diff --git a/config/gdb.conf b/config/gdb.conf
index 5c35fd1e..661c32bb 100644
--- a/config/gdb.conf
+++ b/config/gdb.conf
@@ -1,7 +1,7 @@
# This is a list of packages that must be installed on the build machine
depends=""
-#latest="gdb.git"
+#latest="gdb.git~gdb_7_6-branch"
latest="binutils-gdb.git/gdb_7_6-branch"
# If yes, only static linking will be used
diff --git a/config/sources.conf b/config/sources.conf
index 468c3cd5..1aa66438 100644
--- a/config/sources.conf
+++ b/config/sources.conf
@@ -13,8 +13,8 @@ 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.git git://git.linaro.org/toolchain/gcc.git
-gcc.git http://staging.git.linaro.org/git/toolchain/gcc.git
+gcc.git git://git.linaro.org/toolchain/gcc.git
+#gcc.git http://staging.git.linaro.org/git/toolchain/gcc.git
#gcc-linaro-4.7 lp:gcc-linaro/4.7
gcc-linaro-4.6 lp:gcc-linaro/4.6
@@ -25,7 +25,7 @@ cfe http://llvm.org/svn/llvm-project/cfe/trunk
# Binutils
binutils.git git://git.linaro.org/toolchain/binutils.git
-#binutils-gdb.git git://git.linaro.org/toolchain/binutils-gdb.git
+binutils-gdb.git git://git.linaro.org/toolchain/binutils-gdb.git
gdb.git git://git.linaro.org/toolchain/gdb.git
# Libraries
diff --git a/lib/checkout.sh b/lib/checkout.sh
index 8485ceb8..de41572b 100644
--- a/lib/checkout.sh
+++ b/lib/checkout.sh
@@ -8,6 +8,7 @@
# but we also want to work with the native source code control system.
usegit=no
+# This is used by cbuild2.sh --checkout all but not by --build
checkout_infrastructure()
{
trace "$*"
@@ -164,8 +165,11 @@ checkout()
return 1
fi
+ local repo=
+ repo="`get_git_repo $1`"
+
local tool=
- tool="`get_git_tool $1`"
+ tool="`get_toolname $1`"
local url=
url="`get_git_url $1`"
local branch=
@@ -232,18 +236,16 @@ checkout()
if test x"${branch}" = x -a x"${revision}" = x; then
dryrun "git clone $1 ${srcdir}"
else
- if test ! -d ${local_snapshots}/${tool}.git; then
+ if test ! -d ${local_snapshots}/${repo}; then
# Strip off the "[/<branchname>][@<revision>]" from $1 to
# get the repo address
- #local repo="`echo $1 | sed -e "s:\(^.*/${tool}.git\).*:\1:"`"
- #dryrun "git clone ${repo} ${local_snapshots}/${tool}.git"
- dryrun "git clone ${url} ${local_snapshots}/${tool}.git"
+ dryrun "git clone ${url} ${local_snapshots}/${repo}"
fi
# If revision is set only use ${branch} for naming.
if test x"${revision}" != x; then
notice "Creating git workdir for revision ${revision}"
- dryrun "git-new-workdir ${local_snapshots}/${tool}.git ${srcdir}"
+ dryrun "git-new-workdir ${local_snapshots}/${repo} ${srcdir}"
if test $? -gt 0; then
error "Couldn't create git workdir ${srcdir}"
return 1
@@ -259,7 +261,7 @@ checkout()
dryrun "(cd ${srcdir} && git checkout -b "${branch:+${branch}_}${revision}")"
elif test x"${branch}" != x; then
# If there's no revision we checkout a specific branch.
- dryrun "git-new-workdir ${local_snapshots}/${tool}.git ${srcdir}${branch:+ ${branch}}"
+ dryrun "git-new-workdir ${local_snapshots}/${repo} ${srcdir}${branch:+ ${branch}}"
fi
# We don't need a new-workdir if there's no designated
# branch or revision.
diff --git a/lib/common.sh b/lib/common.sh
index 898c4394..bddce297 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -291,6 +291,7 @@ source_config()
return 0
fi
fi
+ error "Couldn't find ${topdir}/config/${conf}"
return 1
}
@@ -306,19 +307,19 @@ get_toolname()
error "No toolchain component name argument!"
return 1
fi
- if test `echo $1 | grep -c "lp:"` -eq 0; then
- local tool="`echo $1 | sed -e 's:/git@:/:' -e 's:\.git[@/].*::' -e 's:-[0-9].*::'`"
- local tool="`basename ${tool}`"
- else
- local tool="`echo $1 | sed -e 's:git@::' -e 's/lp://' -e 's:/.*::' -e 's:\.git.*::'`"
- fi
- if test `echo $1 | grep -c "trunk"` -eq 1; then
- local tool="`echo $1 | sed -e 's:-[0-9].*::' -e 's:/trunk::'`"
- local tool="`basename ${tool}`"
- fi
- echo ${tool} | sed -e 's:-linaro::' -e 's:\.git::'
+ local tool=
+ tool="`get_git_tool $1`"
+
+ # binutils and gdb are special. They share a repository and the tool is
+ # designated by the branch.
+ if test x"${tool}" = x"binutils-gdb"; then
+ local branch=
+ branch="`get_git_branch $1`"
+ tool="`echo ${branch} | sed -e 's:binutils.*:binutils:' -e 's:gdb.*:gdb:'`"
+ fi
+ echo ${tool}
return 0
}
@@ -557,7 +558,7 @@ get_srcdir()
fi
local tool=
- tool="`get_git_tool ${process}`"
+ tool="`get_toolname ${process}`"
local repo=
repo="`get_git_repo ${process}`"
diff --git a/lib/configure.sh b/lib/configure.sh
index fb23c433..9a311292 100755
--- a/lib/configure.sh
+++ b/lib/configure.sh
@@ -9,8 +9,7 @@ configure_build()
local gitinfo="`get_source $1`"
- local tool="`get_git_tool ${gitinfo}`"
-# local tool="`get_toolname ${tool}`"
+ local tool="`get_toolname ${gitinfo}`"
# Linux isn't a build project, we only need the headers via the existing
# Makefile, so there is nothing to configure.
@@ -72,8 +71,7 @@ configure_build()
# Extract the toolchain component name, stripping off the linaro
# part if it exists as it's not used for the config file name.
- tool="`get_git_tool $1`"
- tool="`get_toolname ${tool} | sed -e 's:-linaro::'`"
+ tool="`get_toolname $1`"
# Load the default config file for this component if it exists.
default_configure_flags=""
diff --git a/lib/git-parser.sh b/lib/git-parser.sh
index 900b3ea7..6845edef 100644
--- a/lib/git-parser.sh
+++ b/lib/git-parser.sh
@@ -114,9 +114,18 @@ git_parser()
local service="`echo "${in}" | sed -n 's#\(^git\)://.*#\1#p;s#\(^http\)://.*#\1#p;s#\(^svn\)://.*#\1#p;s#\(^lp\):[/]*.*#\1#p'`"
+ # An http service with /svn in the url is actually an svn service.
+ if test x"${service}" = x"http" -a "`echo ${in} | egrep -c "\/svn"`" -gt 0; then
+ service="svn"
+ fi
+
# Do this early because this is called often and we don't need all that
# other parsing in this case.
if test x"${part}" = x"service"; then
+ # An http service with .git in the url is actually a git service.
+ if test x"${service}" = x"http" -a "`echo ${in} | egrep -c "\.git"`" -gt 0; then
+ service="git"
+ fi
echo ${service}
return 0
fi
@@ -129,12 +138,26 @@ git_parser()
repo="`echo ${in} | sed -e "s#lp:[/]*##" -e 's:/.*::'`"
echo "${repo}"
;;
+ branch)
+ local hastilde="`echo "${in}" | grep -c '\~'`"
+ local hasslash="`echo "${in}" | grep -c '\/'`"
+ if test ${hastilde} -gt 0; then
+ # Grab everything to the right of the ~
+ branch="`echo ${in} | sed -e 's:.*~\(.*\):\1:'`"
+ elif test ${hasslash} -gt 0; then
+ branch="`basename ${in}`"
+ fi
+ echo ${branch}
+ # otherwise there's no branch.
+ ;;
url)
echo "${in}"
;;
tool)
- # Strip service information and any trailing information.
+ # Strip service information and any trailing branch information.
local tool="`echo ${in} | sed -e 's/lp://' -e 's:/.*::'`"
+ # Strip superflous -linaro tags
+ local tool="`echo ${tool} | sed -e 's:-linaro::'`"
echo ${tool}
;;
*)
@@ -144,23 +167,18 @@ git_parser()
fi
# Just bail out early if this is an svn service.
+ # This _should_ capture http://<foo>/svn
if test x"${service}" = x"svn"; then
case ${part} in
- repo)
- local repo=""
- repo="`basename ${in}`"
+ repo|tool)
+ # Strip any trailing branch information.
+ local repo="`echo ${in} | sed -e 's:-[0-9].*::' -e 's:/trunk::'`"
+ repo="`basename ${repo}`"
echo "${repo}"
;;
url)
echo "${in}"
;;
- tool)
- # Strip any trailing branch information.
- local tool="`echo ${in} | sed -e 's:-[0-9].*::'`"
- # Strip service information.
- tool="`basename ${tool}`"
- echo ${tool}
- ;;
*)
;;
esac
@@ -168,7 +186,7 @@ git_parser()
fi
# This is tarball and it is unique
- if test x"${service}" = x -a "`echo ${in} | egrep -c "\.tar"`" -gt 0; then
+ if test "`echo ${in} | egrep -c "\.tar"`" -gt 0; then
case ${part} in
repo)
local repo=""
@@ -200,7 +218,7 @@ git_parser()
fi
# This will only find a username if it follows the <service>://
- # and precededs the first / in the url. Yes you could
+ # and precedes the first / in the url. Yes you could
# get away with http://www<user>@.foo.com/.
local user="`echo "${in}" | sed -n "s;^${service}://\([^/]*\)@.*;\1;p"`"
@@ -452,5 +470,5 @@ get_git_tag()
revision="`git_parser revision ${in}`"
echo "${repo}${branch:+~${branch}}${revision:+@${revision}}"
- return ${ret}
+ return 0
}
diff --git a/lib/make.sh b/lib/make.sh
index dd82ed80..7ddb2c35 100755
--- a/lib/make.sh
+++ b/lib/make.sh
@@ -248,7 +248,7 @@ make_all()
{
trace "$*"
- local tool="`get_git_tool $1`"
+ local tool="`get_toolname $1`"
# Linux isn't a build project, we only need the headers via the existing
# Makefile, so there is nothing to compile.
@@ -278,6 +278,7 @@ make_all()
# LDFLAGS here, as it breaks configure. So we forcibly configure
# everything first, then build it to avoid problems.
# FIXME: use the static_link value from the config file
+
if test `echo ${tool} | egrep -c binutils` -gt 0; then
local makeret=
dryrun "make SHELL=${bash_shell} configure-host ${make_flags} -w -C ${builddir} 2>&1 | tee -a ${builddir}/configure.log"
@@ -317,7 +318,7 @@ make_install()
local make_flags="${make_flags} -j ${cpus}"
fi
- local tool="`get_git_tool $1`"
+ local tool="`get_toolname $1`"
if test x"${tool}" = x"linux"; then
local srcdir="`get_srcdir $1`"
if test `echo ${target} | grep -c aarch64` -gt 0; then
diff --git a/test.sh b/test.sh
index f983a66f..e64b4a6e 100755
--- a/test.sh
+++ b/test.sh
@@ -26,7 +26,8 @@ fi
usage()
{
- echo " ${testcbuild2} [--debug] [--snapshots <path/to/snapshots/md5sums>]"
+ echo " ${testcbuild2} [--debug|-v]"
+ echo " [--md5sums <path/to/alternative/snapshots/md5sums>]"
echo ""
echo " ${testcbuild2} is the cbuild2 frontend command conformance test."
echo ""
@@ -37,14 +38,22 @@ passes=0
pass()
{
- echo "PASS: '$1'"
+ local testlineno=$1
+ if test x"${debug}" = x"yes"; then
+ echo -n "($testlineno) " 1>&2
+ fi
+ echo "PASS: '$2'"
passes="`expr ${passes} + 1`"
}
failures=0
fail()
{
- echo "FAIL: '$1'"
+ local testlineno=$1
+ if test x"${debug}" = x"yes"; then
+ echo -n "($testlineno) " 1>&2
+ fi
+ echo "FAIL: '$2'"
failures="`expr ${failures} + 1`"
}
@@ -60,12 +69,13 @@ totals()
cbtest()
{
- case "$1" in
- *$2*)
- pass "$3"
+ local testlineno=$1
+ case "$2" in
+ *$3*)
+ pass ${testlineno} "$4"
;;
*)
- fail "$3"
+ fail ${testlineno} "$4"
;;
esac
}
@@ -78,21 +88,21 @@ while test $# -gt 0; do
usage
exit 1
;;
- --deb*|-deb)
+ --deb*|-deb|-v)
debug="yes"
;;
- --snap*|-snap*)
- if test `echo $1 | grep -c "\-snap.*="` -gt 0; then
- error "A '=' is invalid after --snapshots. A space is expected."
+ --md5*|-md5*)
+ if test `echo $1 | grep -c "\-md5.*="` -gt 0; then
+ error "A '=' is invalid after --md5sums. A space is expected."
exit 1;
fi
if test -z $2; then
- error "--snapshots requires a path to an md5sums file."
+ error "--md5sums requires a path to an md5sums file."
exit 1;
fi
md5sums=$2
if test ! -e "$md5sums"; then
- error "Path to snapshots/md5sums is invalid."
+ error "Path to md5sums is invalid."
exit 1;
fi
echo "Copying ${md5sums} to ${local_snapshots} for snapshots file."
@@ -118,40 +128,26 @@ fi
test_failure()
{
+ local testlineno=$BASH_LINENO
local cb_commands=$1
local match=$2
local out=
- if test x"${debug}" != x; then
- set -x
- fi
-
out="`./cbuild2.sh ${cb_commands} 2>&1 | grep "${match}" | sed -e 's:\(^ERROR\).*\('"${match}"'\).*:\1 \2:'`"
-
- if test x"${debug}" != x; then
- set +x
- fi
- cbtest "${out}" "ERROR ${match}" "ERROR ${cb_commands}"
+ cbtest ${testlineno} "${out}" "ERROR ${match}" "ERROR ${cb_commands}"
}
test_pass()
{
+ local testlineno=$BASH_LINENO
local cb_commands=$1
local match=$2
local out=
- if test x"${debug}" != x; then
- set -x
- fi
-
# Continue to search for error so we don't get false positives.
out="`./cbuild2.sh ${cb_commands} 2>&1 | grep "${match}" | sed -e 's:\(^ERROR\).*\('"${match}"'\).*:\1 \2:'`"
- if test x"${debug}" != x; then
- set +x
- fi
-
- cbtest "${out}" "${match}" "VALID ${cb_commands}"
+ cbtest ${testlineno} "${out}" "${match}" "VALID ${cb_commands}"
}
cb_commands="--dry-run"
@@ -223,15 +219,15 @@ cb_commands="--checkout --foo"
match="requires a directive"
test_failure "${cb_commands}" "${match}"
-cb_commands="--dryrun --target arm-linxu-none-gnueabihf --checkout glibc.git"
+cb_commands="--dryrun --target arm-none-linux-gnueabihf --checkout glibc.git"
match=''
test_pass "${cb_commands}" "${match}"
-cb_commands="--dryrun --target arm-linxu-none-gnueabihf --checkout=glibc.git"
+cb_commands="--dryrun --target arm-none-linux-gnueabihf --checkout=glibc.git"
match="A space is expected"
test_failure "${cb_commands}" "${match}"
-cb_commands="--dryrun --target arm-linxu-none-gnueabihf --checkout all"
+cb_commands="--dryrun --target arm-none-linux-gnueabihf --checkout all"
match=''
test_pass "${cb_commands}" "${match}"
@@ -271,6 +267,22 @@ cb_commands="--target ${target} --set libc=${libc}"
match=''
test_pass "${cb_commands}" "${match}"
+cb_commands="--snapshots"
+match='requires a directive'
+test_failure "${cb_commands}" "${match}"
+
+cb_commands="--snapshots=foo/bar --build all"
+match="A space is expected"
+test_failure "${cb_commands}" "${match}"
+
+cb_commands="--snapshots=foo/bar --build all"
+match="A space is expected"
+test_failure "${cb_commands}" "${match}"
+
+cb_commands="--dryrun --snapshots ${local_snapshots} --build all"
+match=''
+test_pass "${cb_commands}" "${match}"
+
cb_commands="--set gcc=meh"
match="'gcc' is not a supported package"
test_failure "${cb_commands}" "${match}"
diff --git a/testsuite/git-parser-tests.sh b/testsuite/git-parser-tests.sh
index bfd6d76c..257b8741 100644
--- a/testsuite/git-parser-tests.sh
+++ b/testsuite/git-parser-tests.sh
@@ -92,7 +92,7 @@ test_parser revision "${in}" "${match}" "${errmatch}"
# Minor variation with a different service
in="http://address.com/directory/repo.git"
-match='http'
+match='git'
test_parser service "${in}" "${match}" "${errmatch}"
# Minor variation with a different service
@@ -123,7 +123,7 @@ match='svn'
test_parser service "${in}" "${match}" "${errmatch}"
match="svn://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch"
test_parser url "${in}" "${match}" "${errmatch}"
-match='gcc-4_7-branch'
+match='gcc'
test_parser repo "${in}" "${match}" "${errmatch}"
match=''
test_parser branch "${in}" "${match}" "${errmatch}"
@@ -156,25 +156,12 @@ match='cortex-strings'
test_parser repo "${in}" "${match}" "${errmatch}"
match=''
test_parser revision "${in}" "${match}" "${errmatch}"
-match=''
+match='foo'
test_parser branch "${in}" "${match}" "${errmatch}"
match='cortex-strings'
test_parser tool "${in}" "${match}" "${errmatch}"
# Minor variation with a different service
-in="lp:/cortex-strings"
-match='lp'
-test_parser service "${in}" "${match}" "${errmatch}"
-match='lp:/cortex-strings'
-test_parser url "${in}" "${match}" "${errmatch}"
-match='cortex-strings'
-test_parser repo "${in}" "${match}" "${errmatch}"
-match=''
-test_parser revision "${in}" "${match}" "${errmatch}"
-match=''
-test_parser branch "${in}" "${match}" "${errmatch}"
-
-# Minor variation with a different service
in="cortex-strings"
match=''
test_parser service "${in}" "${match}" "${errmatch}"
@@ -334,7 +321,7 @@ test_parser user "${in}" "${match}" "${errmatch}"
# Test with different service
in="http://user@address.com/directory/repo.git/branch"
-match='http'
+match='git'
test_parser service "${in}" "${match}" "${errmatch}"
match='user'
test_parser user "${in}" "${match}" "${errmatch}"
@@ -426,7 +413,7 @@ test_parser repo "${in}" "${match}" "${errmatch}"
# This one will bail early even though it's malformed so the error case won't be set.
errmatch=0
in="http://firstname.lastname@address.com/directory@/repo.git/branch"
-match='http'
+match='git'
test_parser service "${in}" "${match}" "${errmatch}"
errmatch=1
match='firstname.lastname'
@@ -434,6 +421,10 @@ test_parser user "${in}" "${match}" "${errmatch}"
# No repo! This will use the non .git suffixed code path.
in="http://firstname.lastname@address.com/directory/@1234567"
+errmatch=0
+match='http'
+test_parser service "${in}" "${match}" "${errmatch}"
+errmatch=1
match=''
test_parser repo "${in}" "${match}" "${errmatch}"
match='http://firstname.lastname@address.com/directory'
@@ -483,6 +474,8 @@ test_parser url "${in}" "${match}" "${errmatch}"
errmatch=0
# Trash but we have a valid repo and revision.
in="http://firstname.lastname@address.com/directory/repo.git~~@1234567"
+match='git'
+test_parser service "${in}" "${match}" "${errmatch}"
match='repo.git'
test_parser repo "${in}" "${match}" "${errmatch}"
match=''
@@ -493,6 +486,8 @@ test_parser revision "${in}" "${match}" "${errmatch}"
# Trash but we have a valid repo and revision.
errmatch=0
in="http://firstname.lastname@address.com/directory/repo.git///~~@1234567"
+match='git'
+test_parser service "${in}" "${match}" "${errmatch}"
match='repo.git'
test_parser repo "${in}" "${match}" "${errmatch}"
match=''
@@ -507,6 +502,8 @@ test_parser url "${in}" "${match}" "${errmatch}"
errmatch=0
# We can't tell that this is an erroneous case so it shouldn't error.
in="http://git.address.com/directory/repo.git/branch~uhoh@1234567"
+match='git'
+test_parser service "${in}" "${match}" "${errmatch}"
match='repo.git'
test_parser repo "${in}" "${match}" "${errmatch}"
match='http://git.address.com/directory/repo.git'
@@ -523,6 +520,10 @@ test_parser branch "${in}" "${match}" "${errmatch}"
# chars so this generates an error.
errmatch=1
in="http://firstname.lastname@address.com/directory@@@@1234567"
+errmatch=0
+match='http'
+test_parser service "${in}" "${match}" "${errmatch}"
+errmatch=1
match='directory'
test_parser repo "${in}" "${match}" "${errmatch}"
match='1234567'
@@ -597,6 +598,8 @@ test_parser revision "${in}" "${match}" "${errmatch}"
errmatch=0
in="http://repo.git@1234567"
+match='git'
+test_parser service "${in}" "${match}" "${errmatch}"
match='http://repo.git'
test_parser url "${in}" "${match}" "${errmatch}"
match='repo.git'
@@ -612,6 +615,8 @@ test_parser url "${in}" "${match}" "${errmatch}"
in="http://repo.git/branch@12334677"
match='http://repo.git'
test_parser url "${in}" "${match}" "${errmatch}"
+match='git'
+test_parser service "${in}" "${match}" "${errmatch}"
match='repo.git'
test_parser repo "${in}" "${match}" "${errmatch}"
match='branch'
@@ -624,6 +629,8 @@ test_parser tool "${in}" "${match}" "${errmatch}"
in="http://repo.git~branch@12334677"
match='http://repo.git'
test_parser url "${in}" "${match}" "${errmatch}"
+match='git'
+test_parser service "${in}" "${match}" "${errmatch}"
match='repo.git'
test_parser repo "${in}" "${match}" "${errmatch}"
match='branch'
@@ -659,7 +666,7 @@ test_parser tool "${in}" "${match}" "${errmatch}"
# Try it with numeric urls.
in="http://firstname.lastname@127.0.0.1/directory/repo.git"
-match='http'
+match='git'
test_parser service "${in}" "${match}" "${errmatch}"
match='firstname.lastname'
test_parser user "${in}" "${match}" "${errmatch}"
@@ -840,6 +847,8 @@ match='1234567'
test_parser revision "${in}" "${match}" "${errmatch}"
match='user.name'
test_parser user "${in}" "${match}" "${errmatch}"
+match='git'
+test_parser service "${in}" "${match}" "${errmatch}"
in="http://user.name@git.linaro.org/git/toolchain/repo.git@1234~67"
match=''
@@ -873,10 +882,14 @@ test_parser repo "${in}" "${match}" "${errmatch}"
in="http://user.name@git.linaro.org/git/toolchain/repo@12345@67"
match='repo'
test_parser repo "${in}" "${match}" "${errmatch}"
+match='http'
+test_parser service "${in}" "${match}" "${errmatch}"
in="http://user.name@git.linaro.org/git/toolchain/repo.git/multi/part/branch-name@12345@67"
match='repo.git'
test_parser repo "${in}" "${match}" "${errmatch}"
+match='git'
+test_parser service "${in}" "${match}" "${errmatch}"
match='multi/part/branch-name'
test_parser branch "${in}" "${match}" "${errmatch}"
@@ -981,3 +994,55 @@ in="infrastructure/linux-linaro-3.11-rc6-2013.08.tar.bz2"
match='linux'
test_parser tool "${in}" "${match}" "${errmatch}"
+errmatch=0
+in="git://git.linaro.org/toolchain/binutils-gdb.git/gdb_7_6-branch"
+match='binutils-gdb'
+test_parser tool "${in}" "${match}" "${errmatch}"
+
+errmatch=0
+in="http://cbuild.validation.linaro.org/snapshots/gdb-7.6~20121001+git3e2e76a.tar"
+match='gdb'
+test_parser repo "${in}" "${match}" "${errmatch}"
+
+# This is just goofy, and if the system doesn't know the service it's
+# just going to guess.
+in="gcc-linaro-4.6"
+match=''
+test_parser service "${in}" "${match}" "${errmatch}"
+match='gcc-linaro-4.6'
+test_parser url "${in}" "${match}" "${errmatch}"
+match='gcc-linaro-4.6'
+test_parser repo "${in}" "${match}" "${errmatch}"
+match=''
+test_parser revision "${in}" "${match}" "${errmatch}"
+match=''
+test_parser branch "${in}" "${match}" "${errmatch}"
+
+in="lp:gcc-linaro/4.6"
+match='lp'
+test_parser service "${in}" "${match}" "${errmatch}"
+match='lp:gcc-linaro/4.6'
+test_parser url "${in}" "${match}" "${errmatch}"
+match='gcc-linaro'
+test_parser repo "${in}" "${match}" "${errmatch}"
+match='gcc'
+test_parser tool "${in}" "${match}" "${errmatch}"
+match=''
+test_parser revision "${in}" "${match}" "${errmatch}"
+match='4.6'
+test_parser branch "${in}" "${match}" "${errmatch}"
+
+
+in="http://llvm.org/svn/llvm-project/cfe/trunk"
+match='svn'
+test_parser service "${in}" "${match}" "${errmatch}"
+match='http://llvm.org/svn/llvm-project/cfe/trunk'
+test_parser url "${in}" "${match}" "${errmatch}"
+match='cfe'
+test_parser repo "${in}" "${match}" "${errmatch}"
+match='cfe'
+test_parser tool "${in}" "${match}" "${errmatch}"
+match=''
+test_parser revision "${in}" "${match}" "${errmatch}"
+match=''
+test_parser branch "${in}" "${match}" "${errmatch}"
diff --git a/testsuite/normalize-tests.sh b/testsuite/normalize-tests.sh
index 66065ae4..22167a1a 100644
--- a/testsuite/normalize-tests.sh
+++ b/testsuite/normalize-tests.sh
@@ -58,6 +58,17 @@ else
fixme "${in} returned ${out}"
fi
+testing="normalize_path: full git url with ~ branch"
+in="http://staging.git.linaro.org/git/toolchain/gcc.git/linaro-4.8-branch"
+out="`normalize_path ${in}`"
+if test x"${out}" = x"gcc.git~linaro-4.8-branch"; then
+ pass "${testing}"
+else
+ fail "${testing}"
+ fixme "${in} returned ${out}"
+fi
+
+
in="gdb-7.6~20121001+git3e2e76a.tar"
out="`normalize_path ${in}`"
if test x"${out}" = x"gdb-7.6~20121001@3e2e76a"; then
@@ -102,3 +113,15 @@ else
fail "normalize_path: bzr branch"
fixme "${in} returned ${out}"
fi
+
+in="binutils-gdb.git/gdb_7_6-branch"
+out="`normalize_path ${in}`"
+match="binutils-gdb.git~gdb_7_6-branch"
+if test x"${out}" = x"${match}"; then
+ pass "normalize_path: new binutils-gdb repository"
+else
+ fail "normalize_path: new binutils-gdb repository"
+ fixme "${in} returned ${out} but expected ${match}"
+fi
+
+
diff --git a/testsuite/test.sh b/testsuite/test.sh
index 1df88e49..84b82653 100755
--- a/testsuite/test.sh
+++ b/testsuite/test.sh
@@ -150,7 +150,7 @@ else
fi
# ----------------------------------------------------------------------------------
-testing="get_toolname: bzr branch"
+testing="get_toolname: bzr <repo> -linaro/<branch>"
in="lp:gdb-linaro/7.5"
out="`get_toolname ${in}`"
if test ${out} = "gdb"; then
@@ -190,23 +190,24 @@ else
fixme "${in} returned ${out}"
fi
-testing="get_toolname: git://<repo>[no .git suffix]@<revision> isn't supported."
+testing="get_toolname: git://<repo>[no .git suffix]@<revision>."
+# This works, but please don't do this.
in="git://git.linaro.org/toolchain/binutils@12345"
out="`get_toolname ${in}`"
-if test ${out} != "binutils"; then
+match="binutils"
+if test x"${out}" = x"${match}"; then
pass "${testing}"
else
fail "${testing}"
- fixme "${in} returned ${out}"
+ fixme "${in} returned ${out} but expected ${match}"
fi
-
# ----------------------------------------------------------------------------------
# Test git:// git combinations
testing="get_toolname: git://<repo>.git"
in="git://git.linaro.org/toolchain/binutils.git"
out="`get_toolname ${in}`"
-if test ${out} = "binutils"; then
+if test x"${out}" = x"binutils"; then
pass "${testing}"
else
fail "${testing}"
@@ -216,7 +217,7 @@ fi
testing="get_toolname: git://<repo>.git/<branch>"
in="git://git.linaro.org/toolchain/binutils.git/2.4-branch"
out="`get_toolname ${in}`"
-if test ${out} = "binutils"; then
+if test x"${out}" = x"binutils"; then
pass "${testing}"
else
fail "${testing}"
@@ -226,7 +227,7 @@ fi
testing="get_toolname: git://<repo>.git/<branch>@<revision>"
in="git://git.linaro.org/toolchain/binutils.git/2.4-branch@12345"
out="`get_toolname ${in}`"
-if test ${out} = "binutils"; then
+if test x"${out}" = x"binutils"; then
pass "${testing}"
else
fail "${testing}"
@@ -236,7 +237,7 @@ fi
testing="get_toolname: git://<repo>.git@<revision>"
in="git://git.linaro.org/toolchain/binutils.git@12345"
out="`get_toolname ${in}`"
-if test ${out} = "binutils"; then
+if test x"${out}" = x"binutils"; then
pass "${testing}"
else
fail "${testing}"
@@ -247,7 +248,7 @@ fi
testing="get_toolname: http://<repo>.git"
in="http://staging.git.linaro.org/git/toolchain/binutils.git"
out="`get_toolname ${in}`"
-if test ${out} = "binutils"; then
+if test x"${out}" = x"binutils"; then
pass "${testing}"
else
fail "${testing}"
@@ -257,7 +258,7 @@ fi
testing="get_toolname: http://<repo>.git/<branch>"
in="http://staging.git.linaro.org/git/toolchain/binutils.git/2.4-branch"
out="`get_toolname ${in}`"
-if test ${out} = "binutils"; then
+if test x"${out}" = x"binutils"; then
pass "${testing}"
else
fail "${testing}"
@@ -267,7 +268,7 @@ fi
testing="get_toolname: http://<repo>.git/<branch>@<revision>"
in="http://staging.git.linaro.org/git/toolchain/binutils.git/2.4-branch@12345"
out="`get_toolname ${in}`"
-if test ${out} = "binutils"; then
+if test x"${out}" = x"binutils"; then
pass "${testing}"
else
fail "${testing}"
@@ -277,7 +278,7 @@ fi
testing="get_toolname: http://<repo>.git@<revision>"
in="http://staging.git.linaro.org/git/toolchain/binutils.git@12345"
out="`get_toolname ${in}`"
-if test ${out} = "binutils"; then
+if test x"${out}" = x"binutils"; then
pass "${testing}"
else
fail "${testing}"
@@ -289,7 +290,7 @@ fi
testing="get_toolname: http://<user>@<repo>.git"
in="http://git@staging.git.linaro.org/git/toolchain/binutils.git"
out="`get_toolname ${in}`"
-if test ${out} = "binutils"; then
+if test x"${out}" = x"binutils"; then
pass "${testing}"
else
fail "${testing}"
@@ -299,7 +300,7 @@ fi
testing="get_toolname: http://<user>@<repo>.git/<branch>"
in="http://git@staging.git.linaro.org/git/toolchain/binutils.git/2.4-branch"
out="`get_toolname ${in}`"
-if test ${out} = "binutils"; then
+if test x"${out}" = x"binutils"; then
pass "${testing}"
else
fail "${testing}"
@@ -309,7 +310,7 @@ fi
testing="get_toolname: http://<user>@<repo>.git/<branch>@<revision>"
in="http://git@staging.git.linaro.org/git/toolchain/binutils.git/2.4-branch@12345"
out="`get_toolname ${in}`"
-if test ${out} = "binutils"; then
+if test x"${out}" = x"binutils"; then
pass "${testing}"
else
fail "${testing}"
@@ -319,7 +320,7 @@ fi
testing="get_toolname: http://<user>@<repo>.git@<revision>"
in="http://git@staging.git.linaro.org/git/toolchain/binutils.git@12345"
out="`get_toolname ${in}`"
-if test ${out} = "binutils"; then
+if test x"${out}" = x"binutils"; then
pass "${testing}"
else
fail "${testing}"
@@ -330,7 +331,7 @@ fi
testing="get_toolname: sources.conf identifier <repo>.git"
in="eglibc.git"
out="`get_toolname ${in}`"
-if test ${out} = "eglibc"; then
+if test x"${out}" = x"eglibc"; then
pass "${testing}"
else
fail "${testing}"
@@ -340,7 +341,7 @@ fi
testing="get_toolname: sources.conf identifier <repo>.git/<branch>"
in="eglibc.git/linaro_eglibc-2_18"
out="`get_toolname ${in}`"
-if test ${out} = "eglibc"; then
+if test x"${out}" = x"eglibc"; then
pass "${testing}"
else
fail "${testing}"
@@ -350,7 +351,7 @@ fi
testing="get_toolname: sources.conf identifier <repo>.git/<branch>@<revision>"
in="eglibc.git/linaro_eglibc-2_18@12345"
out="`get_toolname ${in}`"
-if test ${out} = "eglibc"; then
+if test x"${out}" = x"eglibc"; then
pass "${testing}"
else
fail "${testing}"
@@ -360,12 +361,46 @@ fi
testing="get_toolname: sources.conf identifier <repo>.git@<revision>"
in="eglibc.git@12345"
out="`get_toolname ${in}`"
-if test ${out} = "eglibc"; then
+if test x"${out}" = x"eglibc"; then
pass "${testing}"
else
fail "${testing}"
fixme "${in} returned ${out}"
fi
+
+testing="get_toolname: combined binutils-gdb repository with gdb branch"
+in="binutils-gdb.git/gdb_7_6-branch"
+out="`get_toolname ${in}`"
+match="gdb"
+if test x"${out}" = x"${match}"; then
+ pass "${testing}"
+else
+ fail "${testing}"
+ fixme "${in} returned ${out} expected ${match}"
+fi
+
+testing="get_toolname: combined binutils-gdb repository with binutils branch"
+in="binutils-gdb.git/binutils-2_24"
+out="`get_toolname ${in}`"
+match="binutils"
+if test x"${out}" = x"${match}"; then
+ pass "${testing}"
+else
+ fail "${testing}"
+ fixme "${in} returned ${out} but expected ${match}"
+fi
+
+testing="get_toolname: svn archive with /trunk trailing designator"
+in="http://llvm.org/svn/llvm-project/cfe/trunk"
+out="`get_toolname ${in}`"
+match="cfe"
+if test x"${out}" = x"${match}"; then
+ pass "${testing}"
+else
+ fail "${testing}"
+ fixme "${in} returned ${out} but expected ${match}"
+fi
+
# ----------------------------------------------------------------------------------
echo "============= fetch() tests ================"
out="`fetch md5sums 2>/dev/null`"
diff --git a/testsuite/test_sources.conf b/testsuite/test_sources.conf
index 6b85c442..031bf4bc 100644
--- a/testsuite/test_sources.conf
+++ b/testsuite/test_sources.conf
@@ -21,3 +21,4 @@ bitbake.git git://git.openembedded.org/bitbake
# nomatch.git don't uncomment and don't use this identifier.
foo.git git://testingrepository/foo
cortex-strings lp:cortex-strings
+binutils-gdb.git git://git.linaro.org/toolchain/binutils-gdb.git