diff options
author | sf <sf@13f79535-47bb-0310-9956-ffa450edef68> | 2013-05-03 19:06:49 +0000 |
---|---|---|
committer | sf <sf@13f79535-47bb-0310-9956-ffa450edef68> | 2013-05-03 19:06:49 +0000 |
commit | 013bad0138842460bcccbb2050d16bcaa85973bf (patch) | |
tree | b18b4a2057bb7f58f004efae1c547df8a53efef9 | |
parent | bc3bf1d7dd5438037d382740d73ef4ea42676ac0 (diff) | |
download | libapr-013bad0138842460bcccbb2050d16bcaa85973bf.tar.gz |
Merge r1389077, r1456418, r1460399, r1460405:
r1389077:
easy fixes for a few warnings about unused variables
r1456418:
remove ignored rv
r1460399:
clean up a bit of error handling just to get rid of
sockperf.c: In function 'main':
sockperf.c:206:18: warning: variable 'rv' set but not used [-Wunused-but-set-variable]
r1460405:
hide an unused variable on Unix
All submitted by: trawick
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@1478929 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | test/echod.c | 3 | ||||
-rw-r--r-- | test/sockperf.c | 25 | ||||
-rw-r--r-- | test/testfile.c | 3 | ||||
-rw-r--r-- | test/testlockperf.c | 6 | ||||
-rw-r--r-- | test/testmmap.c | 1 | ||||
-rw-r--r-- | test/testnames.c | 4 |
6 files changed, 29 insertions, 13 deletions
diff --git a/test/echod.c b/test/echod.c index c78e90fd5..87f386abf 100644 --- a/test/echod.c +++ b/test/echod.c @@ -113,7 +113,6 @@ static apr_status_t glassToWall(apr_int16_t port, apr_pool_t *parent) int main(int argc, char **argv) { apr_pool_t *pool; - apr_status_t rv; apr_int16_t theport = 4747; printf("APR Test Application: echod\n"); @@ -129,7 +128,7 @@ int main(int argc, char **argv) } fprintf(stdout, "Starting to listen on port %d\n", theport); - rv = glassToWall(theport, pool); + glassToWall(theport, pool); return 0; } diff --git a/test/sockperf.c b/test/sockperf.c index bc3d1e2f3..a18d8ba3f 100644 --- a/test/sockperf.c +++ b/test/sockperf.c @@ -96,8 +96,10 @@ static apr_status_t sendRecvBuffer(apr_time_t *t, const char *buf, rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, APR_PROTO_TCP, pool); - if (rv != APR_SUCCESS) + if (rv != APR_SUCCESS) { + reportError("Unable to create IPv4 stream socket", rv, pool); return rv; + } rv = apr_socket_connect(sock, sockAddr); if (rv != APR_SUCCESS) { @@ -110,16 +112,21 @@ static apr_status_t sendRecvBuffer(apr_time_t *t, const char *buf, } recvBuf = apr_palloc(pool, size); - if (! recvBuf) + if (! recvBuf) { + reportError("Unable to allocate buffer", ENOMEM, pool); return ENOMEM; + } + *t = 0; /* START! */ testStart = apr_time_now(); rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, APR_PROTO_TCP, pool); - if (rv != APR_SUCCESS) + if (rv != APR_SUCCESS) { + reportError("Unable to create IPv4 stream socket", rv, pool); return rv; + } rv = apr_socket_connect(sock, sockAddr); if (rv != APR_SUCCESS) { @@ -146,8 +153,10 @@ static apr_status_t sendRecvBuffer(apr_time_t *t, const char *buf, do { len = thistime; rv = apr_socket_recv(sock, &recvBuf[size - thistime], &len); - if (rv != APR_SUCCESS) + if (rv != APR_SUCCESS) { + reportError("Error receiving from socket", rv, pool); break; + } thistime -= len; } while (thistime); } @@ -218,14 +227,18 @@ int main(int argc, char **argv) results = (struct testResult *)apr_pcalloc(pool, sizeof(*results) * nTests); - for(i = 0; i < nTests; i++) { + for (i = 0; i < nTests; i++) { printf("Test -> %c\n", testRuns[i].c); results[i].size = testRuns[i].size * (apr_size_t)TEST_SIZE; rv = runTest(&testRuns[i], &results[i], pool); + if (rv != APR_SUCCESS) { + /* error already reported */ + exit(1); + } } printf("Tests Complete!\n"); - for(i = 0; i < nTests; i++) { + for (i = 0; i < nTests; i++) { int j; apr_time_t totTime = 0; printf("%10d byte block:\n", results[i].size); diff --git a/test/testfile.c b/test/testfile.c index 2b4658669..7b5800661 100644 --- a/test/testfile.c +++ b/test/testfile.c @@ -749,6 +749,7 @@ static void test_writev_buffered_seek(abts_case *tc, void *data) APR_OS_DEFAULT, p)); rv = apr_file_read(f, str, &nbytes); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, TESTSTR, str); APR_ASSERT_SUCCESS(tc, "buffered seek", apr_file_seek(f, APR_SET, &off)); @@ -950,6 +951,7 @@ static void test_xthread(abts_case *tc, void *data) apr_off_t offset = 0; rv = apr_file_seek(f, APR_END, &offset); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } APR_ASSERT_SUCCESS(tc, "more writes should succeed", @@ -960,6 +962,7 @@ static void test_xthread(abts_case *tc, void *data) apr_off_t offset = 0; rv = apr_file_seek(f, APR_SET, &offset); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } apr_file_read_full(f, buf, sizeof(buf), NULL); diff --git a/test/testlockperf.c b/test/testlockperf.c index f673e5f7b..84c0ba991 100644 --- a/test/testlockperf.c +++ b/test/testlockperf.c @@ -226,7 +226,6 @@ int main(int argc, const char * const *argv) { apr_status_t rv; char errmsg[200]; - const char *lockname = "multi.lock"; apr_getopt_t *opt; char optchar; const char *optarg; @@ -245,13 +244,10 @@ int main(int argc, const char * const *argv) exit(-1); } - while ((rv = apr_getopt(opt, "vf:", &optchar, &optarg)) == APR_SUCCESS) { + while ((rv = apr_getopt(opt, "v", &optchar, &optarg)) == APR_SUCCESS) { if (optchar == 'v') { verbose = 1; } - if (optchar == 'f') { - lockname = optarg; - } } if (rv != APR_SUCCESS && rv != APR_EOF) { diff --git a/test/testmmap.c b/test/testmmap.c index 4063ba62e..74c0c9f50 100644 --- a/test/testmmap.c +++ b/test/testmmap.c @@ -125,6 +125,7 @@ static void test_mmap_offset(abts_case *tc, void *data) ABTS_PTR_NOTNULL(tc, themmap); rv = apr_mmap_offset(&addr, themmap, 5); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* Must use nEquals since the string is not guaranteed to be NULL terminated */ ABTS_STR_NEQUAL(tc, addr, TEST_STRING + 5, thisfsize-5); } diff --git a/test/testnames.c b/test/testnames.c index 7a310faff..5afba0c44 100644 --- a/test/testnames.c +++ b/test/testnames.c @@ -269,7 +269,9 @@ static void root_from_cwd_and_back(abts_case *tc, void *data) const char *path = "//"; char *origpath; char *testpath; +#if defined(WIN32) || defined(OS2) || defined(NETWARE) int hadfailed; +#endif ABTS_INT_EQUAL(tc, APR_SUCCESS, apr_filepath_get(&origpath, 0, p)); path = origpath; @@ -308,7 +310,9 @@ static void root_from_cwd_and_back(abts_case *tc, void *data) | APR_FILEPATH_NOTABOVEROOT | APR_FILEPATH_NOTRELATIVE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); +#if defined(WIN32) || defined(OS2) || defined(NETWARE) hadfailed = tc->failed; +#endif /* The API doesn't promise equality!!! * apr_filepath_get never promised a canonical filepath. * We'll emit noise under verbose so the user is aware, |