diff mbox

[test_fetch_md5sums,2/2] testsuite/test.sh: Add fetch tests section.

Message ID 1381522338-30673-2-git-send-email-ryan.arnold@linaro.org
State New
Headers show

Commit Message

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

When run in the src dir the find_snapshot test would generate errors
because the md5sums file that find_snapshot uses wasn't downloaded.  This
test addition creates a temporary build directory and performs a "fetch
md5sums" test.

This patch also adds a wget quiet option that is used when running the
test suite.
---
 lib/fetch.sh      |  2 +-
 testsuite/test.sh | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/lib/fetch.sh b/lib/fetch.sh
index 7505813..85ed871 100755
--- a/lib/fetch.sh
+++ b/lib/fetch.sh
@@ -124,7 +124,7 @@  fetch_http()
 	    # NOTE: the timeout is short, and we only try twice to access the
 	    # remote host. This is to improve performance when offline, or
 	    # the remote host is offline.
-	    dryrun "${wget_bin} --timeout=1 --tries=2 --directory-prefix=${local_snapshots}/${dir} ${remote_snapshots}/${getfile}"
+	    dryrun "${wget_bin} ${wget_quiet:+-q} --timeout=1 --tries=2 --directory-prefix=${local_snapshots}/${dir} ${remote_snapshots}/${getfile}"
 	    if test ! -s ${local_snapshots}/${getfile}; then
 		warning "downloaded file ${getfile} has zero data!"
 		return 1
diff --git a/testsuite/test.sh b/testsuite/test.sh
index 7c3cf7d..b3d3778 100755
--- a/testsuite/test.sh
+++ b/testsuite/test.sh
@@ -15,6 +15,10 @@  if test -e "${PWD}/host.conf"; then
     . "${PWD}/host.conf"
 else
     warning "no host.conf file!"
+    remote_snapshots=http://cbuild.validation.linaro.org/snapshots
+    local_snapshots=test_snapshots
+    wget_bin=/usr/bin/wget
+    wget_quiet=yes
 fi
 
 # Since we're testing, we don't load the host.conf file, instead
@@ -22,6 +26,10 @@  fi
 cbuild_top=/build/cbuild2/test
 hostname=test.foobar.org
 target=x86_64-linux-gnu
+#remote_snapshots=http://cbuild.validation.linaro.org/snapshots
+#local_snapshots=test_snapshots
+#wget_bin=/usr/bin/wget
+#wget_quiet=yes
 
 if test x"$1" = x"-v"; then
     debug=yes
@@ -142,6 +150,19 @@  else
 fi
 
 # ----------------------------------------------------------------------------------
+echo "============= fetch() tests ================"
+if test -d "${local_snapshots}"; then
+    notice "${local_snapshots} directory exists.  Moving it to ${local_snapshots}.bak."
+    mv ${local_snapshots} ${local_snapshots}.bak
+fi
+
+out="`fetch md5sums`"
+if test $? -eq 0; then
+    pass "fetch md5sums"
+else
+    fail "fetch md5sums"
+fi
+# ----------------------------------------------------------------------------------
 echo "============= find_snapshot() tests ================"
 
 out="`find_snapshot gcc`"