From 6c87a69fe1c5a50508252141956dc3739aa0c89e Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Mon, 4 Jan 2010 11:48:38 -0500 Subject: [PATCH] Fix two bugs reported by dcoombs. 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 | 5 ++++- test-sh | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/randomgen.c b/randomgen.c index 946f7c4..00aae05 100644 --- a/randomgen.c +++ b/randomgen.c @@ -2,6 +2,7 @@ #include #include #include +#include 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 d969d4a..35c2f48 100755 --- 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" -- 2.39.2