diff options
author | Ryan S. Arnold <ryan.arnold@linaro.org> | 2013-12-10 16:08:17 -0600 |
---|---|---|
committer | Ryan S. Arnold <ryan.arnold@linaro.org> | 2013-12-10 16:30:07 -0600 |
commit | e6e39f5d1f7963332b3d7dd2e4400de91847219c (patch) | |
tree | 38bb686b7d9f52968c21ab86a4ba765008c42d99 /test.sh | |
parent | b6e9c6c7c850eff8f9d7894410a59bc340f847b1 (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
Diffstat (limited to 'test.sh')
-rwxr-xr-x | test.sh | 80 |
1 files changed, 46 insertions, 34 deletions
@@ -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}" |