diff options
author | Ryan S. Arnold <ryan.arnold@linaro.org> | 2015-05-19 13:58:44 -0500 |
---|---|---|
committer | Robert Savoye <rob.savoye@linaro.org> | 2015-05-20 01:28:55 +0000 |
commit | 6b11762fb9bb76c8a0a93f2faf6392c5860def6f (patch) | |
tree | 0158b9e83fdfe060e4f795da168fccdad1679ea4 /testsuite | |
parent | 670a1a95212da11753cbd3b1f159c15879c3adb8 (diff) |
${force} now overwrites existing files in fetch_http()
The wget program will not overwrite a file unless -O is used to specify the
output file name on the command line. This patch enables -O
${local_snapshots}/${getfile} to overwrite the existing file if ${force} is
specified.
It also moves a check for ${force} to the top of the function
so that fetch_http() won't return 0 automatically if ${force} is specified
but the ${getfile} already exists. This also allows us to squash an
if-block around the wget call.
A test-case was added to verify that fetch_http works with ${force} = yes.
Change-Id: I685011b3383bd0aa7f1cf01a31ca22b77c0c5d41
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/test.sh | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/testsuite/test.sh b/testsuite/test.sh index a3c47bf4..3417ff21 100755 --- a/testsuite/test.sh +++ b/testsuite/test.sh @@ -555,7 +555,8 @@ sleep 1s out="`supdate=yes fetch_http infrastructure/gmp-5.1.3.tar.xz 2>/dev/null`" ret=$? -# Compare the second timestamp to make sure they're equal. +# Compare the second timestamp to make sure they're equal (i.e., that a new +# one wasn't downloaded). gmp_stamp2=`stat -c %X ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz` if test $ret -eq 0 -a ${gmp_stamp1} -eq ${gmp_stamp2}; then @@ -564,6 +565,23 @@ else fail "fetch_http infrastructure/gmp-5.1.3.tar.xz with \${supdate}=yes" fi +# Sleep so that the timestamps differ (if they will) +sleep 1s + +# Try to download it again with supdate=yes and force=yes explicit it +# should download it again and return 0 (and the timestamp should differ) +out="`force=yes supdate=yes fetch_http infrastructure/gmp-5.1.3.tar.xz 2>/dev/null`" +ret=$? + +# Compare to the second timestamp to make sure they're not equal. +gmp_stamp3=`stat -c %X ${local_snapshots}/infrastructure/gmp-5.1.3.tar.xz` + +if test $ret -eq 0 -a ${gmp_stamp2} -ne ${gmp_stamp3}; then + pass "fetch_http infrastructure/gmp-5.1.3.tar.xz with \${supdate}=yes and \${force}=yes" +else + fail "fetch_http infrastructure/gmp-5.1.3.tar.xz with \${supdate}=yes and \${force}=yes" +fi + out="`fetch_http md5sums 2>/dev/null`" if test $? -eq 0; then pass "fetch_http md5sums" |