]> arthur.barton.de Git - bup.git/commitdiff
Fix two bugs reported by dcoombs.
authorAvery Pennarun <apenwarr@gmail.com>
Mon, 4 Jan 2010 16:48:38 +0000 (11:48 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Mon, 4 Jan 2010 16:48:38 +0000 (11:48 -0500)
test-sh was assuming 'bup' was on the PATH.  (It wasn't *supposed* to be
assuming that, but the "alias bup=whatever" line wasn't working,
apparently.)

randomgen.c triggered a warning in some versions of gcc about the return
value of write() being ignored.  It really doesn't bother me if some of my
random bytes don't get written, but whatever; I'll assert instead, which
should shut it up.

randomgen.c
test-sh

index 946f7c4dcb03eaa1c6a9944ff053f00e6559b3d7..00aae058799398b3159091bab0b9cd38c1dbf392 100644 (file)
@@ -2,6 +2,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
+#include <assert.h>
 
 int main(int argc, char **argv)
 {
@@ -13,13 +14,15 @@ int main(int argc, char **argv)
     
     int kbytes = atoi(argv[1]);
     uint32_t buf[1024/4];
+    ssize_t written;
     int i;
     
     for (; kbytes > 0; kbytes--)
     {
        for (i = 0; i < sizeof(buf)/sizeof(buf[0]); i++)
            buf[i] = random();
-       write(1, buf, sizeof(buf));
+       written = write(1, buf, sizeof(buf));
+       assert(written = sizeof(buf)); // we'd die from SIGPIPE otherwise
        if (!(kbytes%1024))
            fprintf(stderr, ".");
     }
diff --git a/test-sh b/test-sh
index d969d4a0f56b1cfa7365b08669dcbfa32d3f5496..35c2f48a38824d39be6d42b536d550d56b961730 100755 (executable)
--- a/test-sh
+++ b/test-sh
@@ -1,10 +1,14 @@
 #!/bin/bash
 set -e
-echo "Testing \"$@\" in Makefile:"
+echo "Testing \"integration\" in $0:"
 
 TOP="$(pwd)"
 export BUP_DIR="$TOP/buptest.tmp"
-alias bup="$TOP/bup"
+
+bup()
+{
+       "$TOP/bup" "$@"
+}
 
 set -x
 rm -rf "$BUP_DIR"