You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by sf...@apache.org on 2013/05/03 21:07:01 UTC
svn commit: r1478929 - in /apr/apr/branches/1.4.x: ./ test/echod.c
test/sockperf.c test/testfile.c test/testlockperf.c test/testmmap.c
test/testnames.c
Author: sf
Date: Fri May 3 19:06:49 2013
New Revision: 1478929
URL: http://svn.apache.org/r1478929
Log:
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
Modified:
apr/apr/branches/1.4.x/ (props changed)
apr/apr/branches/1.4.x/test/echod.c
apr/apr/branches/1.4.x/test/sockperf.c
apr/apr/branches/1.4.x/test/testfile.c
apr/apr/branches/1.4.x/test/testlockperf.c
apr/apr/branches/1.4.x/test/testmmap.c
apr/apr/branches/1.4.x/test/testnames.c
Propchange: apr/apr/branches/1.4.x/
------------------------------------------------------------------------------
Merged /apr/apr/trunk:r1389077,1456418,1460399,1460405
Modified: apr/apr/branches/1.4.x/test/echod.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/test/echod.c?rev=1478929&r1=1478928&r2=1478929&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/test/echod.c (original)
+++ apr/apr/branches/1.4.x/test/echod.c Fri May 3 19:06:49 2013
@@ -113,7 +113,6 @@ static apr_status_t glassToWall(apr_int1
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;
}
Modified: apr/apr/branches/1.4.x/test/sockperf.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/test/sockperf.c?rev=1478929&r1=1478928&r2=1478929&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/test/sockperf.c (original)
+++ apr/apr/branches/1.4.x/test/sockperf.c Fri May 3 19:06:49 2013
@@ -96,8 +96,10 @@ static apr_status_t sendRecvBuffer(apr_t
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_t
}
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_t
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);
Modified: apr/apr/branches/1.4.x/test/testfile.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/test/testfile.c?rev=1478929&r1=1478928&r2=1478929&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/test/testfile.c (original)
+++ apr/apr/branches/1.4.x/test/testfile.c Fri May 3 19:06:49 2013
@@ -749,6 +749,7 @@ static void test_writev_buffered_seek(ab
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,
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,
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);
Modified: apr/apr/branches/1.4.x/test/testlockperf.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/test/testlockperf.c?rev=1478929&r1=1478928&r2=1478929&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/test/testlockperf.c (original)
+++ apr/apr/branches/1.4.x/test/testlockperf.c Fri May 3 19:06:49 2013
@@ -226,7 +226,6 @@ int main(int argc, const char * const *a
{
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 *a
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) {
Modified: apr/apr/branches/1.4.x/test/testmmap.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/test/testmmap.c?rev=1478929&r1=1478928&r2=1478929&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/test/testmmap.c (original)
+++ apr/apr/branches/1.4.x/test/testmmap.c Fri May 3 19:06:49 2013
@@ -125,6 +125,7 @@ static void test_mmap_offset(abts_case *
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);
}
Modified: apr/apr/branches/1.4.x/test/testnames.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/test/testnames.c?rev=1478929&r1=1478928&r2=1478929&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/test/testnames.c (original)
+++ apr/apr/branches/1.4.x/test/testnames.c Fri May 3 19:06:49 2013
@@ -269,7 +269,9 @@ static void root_from_cwd_and_back(abts_
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_
| 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,