From 4f9b76b6f2acc4030ce9ef164322514c5d0e761b Mon Sep 17 00:00:00 2001 From: Ivan Zhakov Date: Sun, 20 Nov 2022 07:14:38 +0000 Subject: Remove trailing whitespaces in *.c. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68 --- test/abts.c | 16 +++---- test/echod.c | 2 +- test/globalmutexchild.c | 4 +- test/internal/testregex.c | 6 +-- test/internal/testutf.c | 34 +++++++------- test/proc_child.c | 2 +- test/readchild.c | 2 +- test/sendfile.c | 44 +++++++++---------- test/sockchild.c | 6 +-- test/sockperf.c | 16 +++---- test/testargs.c | 12 ++--- test/testbuckets.c | 52 +++++++++++----------- test/testcond.c | 2 +- test/testdate.c | 2 +- test/testdir.c | 8 ++-- test/testdso.c | 10 ++--- test/testdup.c | 14 +++--- test/testfile.c | 110 +++++++++++++++++++++++----------------------- test/testfilecopy.c | 38 ++++++++-------- test/testfileinfo.c | 10 ++--- test/testflock.c | 6 +-- test/testfnmatch.c | 6 +-- test/testglobalmutex.c | 4 +- test/testhash.c | 8 ++-- test/testhooks.c | 4 +- test/testipsub.c | 6 +-- test/testlfs.c | 46 +++++++++---------- test/testlock.c | 26 +++++------ test/testlockperf.c | 12 ++--- test/testmd4.c | 30 ++++++------- test/testmd5.c | 6 +-- test/testmemcache.c | 4 +- test/testmmap.c | 4 +- test/testmutexscope.c | 8 ++-- test/testnames.c | 16 +++---- test/testoc.c | 18 ++++---- test/testpass.c | 8 ++-- test/testpipe.c | 16 +++---- test/testpoll.c | 56 +++++++++++------------ test/testpools.c | 10 ++--- test/testproc.c | 8 ++-- test/testprocmutex.c | 14 +++--- test/testredis.c | 56 +++++++++++------------ test/testshm.c | 12 ++--- test/testshmconsumer.c | 4 +- test/testshmproducer.c | 2 +- test/testskiplist.c | 6 +-- test/testsock.c | 64 +++++++++++++-------------- test/testsockets.c | 2 +- test/testsockopt.c | 4 +- test/teststr.c | 22 +++++----- test/teststrmatch.c | 2 +- test/testtable.c | 8 ++-- test/testtemp.c | 2 +- test/testthread.c | 4 +- test/testuri.c | 2 +- test/testuser.c | 4 +- test/testutil.c | 6 +-- test/testxml.c | 2 +- test/tryread.c | 2 +- 60 files changed, 455 insertions(+), 455 deletions(-) (limited to 'test') diff --git a/test/abts.c b/test/abts.c index e03ccc461..eb029d402 100644 --- a/test/abts.c +++ b/test/abts.c @@ -97,7 +97,7 @@ abts_suite *abts_add_suite(abts_suite *suite, const char *suite_name_full) char *p; const char *suite_name; curr_char = 0; - + /* Only end the suite if we actually ran it */ if (suite && suite->tail &&!suite->tail->not_run) { end_suite(suite); @@ -108,7 +108,7 @@ abts_suite *abts_add_suite(abts_suite *suite, const char *suite_name_full) subsuite->failed = 0; subsuite->skipped = 0; subsuite->next = NULL; - /* suite_name_full may be an absolute path depending on __FILE__ + /* suite_name_full may be an absolute path depending on __FILE__ * expansion */ suite_name = strrchr(suite_name_full, '/'); if (!suite_name) { @@ -131,7 +131,7 @@ abts_suite *abts_add_suite(abts_suite *suite, const char *suite_name_full) if (list_tests) { fprintf(stdout, "%s\n", subsuite->name); } - + subsuite->not_run = 0; if (suite == NULL) { @@ -185,12 +185,12 @@ void abts_run_test(abts_suite *ts, test_func f, void *value) tc.failed = 0; tc.skipped = 0; tc.suite = ss; - + ss->num_test++; update_status(); f(&tc, value); - + if (tc.failed) { ss->failed++; } @@ -373,7 +373,7 @@ void abts_ptr_notnull(abts_case *tc, const void *ptr, int lineno) fflush(stderr); } } - + void abts_ptr_equal(abts_case *tc, const void *expected, const void *actual, int lineno) { update_status(); @@ -456,7 +456,7 @@ int main(int argc, const char *const argv[]) { int rv; int list_provided = 0; abts_suite *suite = NULL; - + initialize(); quiet = !isatty(STDOUT_FILENO); @@ -503,4 +503,4 @@ int main(int argc, const char *const argv[]) { abts_free_suite(suite); return rv; } - + diff --git a/test/echod.c b/test/echod.c index 052e47d87..537c03cf5 100644 --- a/test/echod.c +++ b/test/echod.c @@ -28,7 +28,7 @@ #define BUF_SIZE 4096 -static void reportError(const char *msg, apr_status_t rv, +static void reportError(const char *msg, apr_status_t rv, apr_pool_t *pool) { fprintf(stderr, "%s\nError: %d\n'%s'\n", msg, rv, diff --git a/test/globalmutexchild.c b/test/globalmutexchild.c index 4b8737b02..d5149fb46 100644 --- a/test/globalmutexchild.c +++ b/test/globalmutexchild.c @@ -37,7 +37,7 @@ int main(int argc, const char * const argv[]) apr_initialize(); atexit(apr_terminate); - + apr_pool_create(&p, NULL); if (argc >= 2) { mech = (apr_lockmech_e)apr_strtoi64(argv[1], NULL, 0); @@ -50,7 +50,7 @@ int main(int argc, const char * const argv[]) exit(-rv); } apr_global_mutex_child_init(&global_lock, LOCKNAME, p); - + while (1) { apr_global_mutex_lock(global_lock); if (i == MAX_ITER) { diff --git a/test/internal/testregex.c b/test/internal/testregex.c index 20dcfdebe..5fc4d9ec8 100644 --- a/test/internal/testregex.c +++ b/test/internal/testregex.c @@ -34,14 +34,14 @@ int main( int argc, char** argv) { apr_time_t now; apr_time_t end; apr_hash_t *h; - + if (argc !=4 ) { fprintf(stderr, "Usage %s match string #iterations\n",argv[0]); return -1; } iters = atoi( argv[3]); - + apr_initialize() ; atexit(apr_terminate); if (apr_pool_create(&context, NULL) != APR_SUCCESS) { @@ -86,6 +86,6 @@ int main( int argc, char** argv) { } end=apr_time_now(); puts(apr_psprintf( context, "Time to run %d hash (find)'s %8lld\n",iters,end-now)); - + return 0; } diff --git a/test/internal/testutf.c b/test/internal/testutf.c index a5b167170..db0c812f5 100644 --- a/test/internal/testutf.c +++ b/test/internal/testutf.c @@ -82,7 +82,7 @@ void displaynw(struct testval *f, struct testval *l) apr_size_t i; for (i = 0; i < f->nl; ++i) t += sprintf(t, "%02X ", f->n[i]); - *(t++) = '-'; + *(t++) = '-'; for (i = 0; i < l->nl; ++i) t += sprintf(t, " %02X", l->n[i]); *(t++) = ' '; @@ -98,7 +98,7 @@ void displaynw(struct testval *f, struct testval *l) } /* - * Test every possible byte value. + * Test every possible byte value. * If the test passes or fails at this byte value we are done. * Otherwise iterate test_nrange again, appending another byte. */ @@ -107,10 +107,10 @@ void test_nrange(struct testval *p) struct testval f, l, s; apr_status_t rc; int success = 0; - + memcpy (&s, p, sizeof(s)); - ++s.nl; - + ++s.nl; + do { apr_size_t nl = s.nl, wl = sizeof(s.w) / 2; rc = apr_conv_utf8_to_utf16(s.n, &nl, s.w, &wl); @@ -121,13 +121,13 @@ void test_nrange(struct testval *p) success = -1; } else { - if (s.wl != l.wl + if (s.wl != l.wl || memcmp(s.w, l.w, (s.wl - 1) * 2) != 0 || s.w[s.wl - 1] != l.w[l.wl - 1] + 1) { displaynw(&f, &l); memcpy(&f, &s, sizeof(s)); } - } + } memcpy(&l, &s, sizeof(s)); } else { @@ -147,10 +147,10 @@ void test_nrange(struct testval *p) } } -/* - * Test every possible word value. +/* + * Test every possible word value. * Once we are finished, retest every possible word value. - * if the test fails on the following null word, iterate test_nrange + * if the test fails on the following null word, iterate test_nrange * again, appending another word. * This assures the output order of the two tests are in sync. */ @@ -159,12 +159,12 @@ void test_wrange(struct testval *p) struct testval f, l, s; apr_status_t rc; int success = 0; - + memcpy (&s, p, sizeof(s)); - ++s.wl; - + ++s.wl; + do { - apr_size_t nl = sizeof(s.n), wl = s.wl; + apr_size_t nl = sizeof(s.n), wl = s.wl; rc = apr_conv_utf16_to_utf8(s.w, &wl, s.n, &nl); s.nl = sizeof(s.n) - nl; if (!wl && rc == APR_SUCCESS) { @@ -173,13 +173,13 @@ void test_wrange(struct testval *p) success = -1; } else { - if (s.nl != l.nl + if (s.nl != l.nl || memcmp(s.n, l.n, s.nl - 1) != 0 || s.n[s.nl - 1] != l.n[l.nl - 1] + 1) { displaynw(&f, &l); memcpy(&f, &s, sizeof(s)); } - } + } memcpy(&l, &s, sizeof(s)); } else { @@ -206,7 +206,7 @@ void test_wrange(struct testval *p) } /* - * Test every possible byte value. + * Test every possible byte value. * If the test passes or fails at this byte value we are done. * Otherwise iterate test_nrange again, appending another byte. */ diff --git a/test/proc_child.c b/test/proc_child.c index 9f458b9a3..56c036f5a 100644 --- a/test/proc_child.c +++ b/test/proc_child.c @@ -12,7 +12,7 @@ int main(void) { char buf[256]; int bytes, rv = 0; - + bytes = (int)read(STDIN_FILENO, buf, 256); if (bytes > 0) rv = write(STDOUT_FILENO, buf, (unsigned int)bytes) == bytes ? 0 : 1; diff --git a/test/readchild.c b/test/readchild.c index f8443cceb..eb1ed987b 100644 --- a/test/readchild.c +++ b/test/readchild.c @@ -25,7 +25,7 @@ int main(int argc, char *argv[]) apr_pool_t *p; char buf[128]; apr_status_t rv; - + apr_initialize(); atexit(apr_terminate); apr_pool_create(&p, NULL); diff --git a/test/sendfile.c b/test/sendfile.c index a09df421f..32e04d488 100644 --- a/test/sendfile.c +++ b/test/sendfile.c @@ -30,7 +30,7 @@ #if !APR_HAS_SENDFILE int main(void) { - fprintf(stderr, + fprintf(stderr, "This program won't work on this platform because there is no " "support for sendfile().\n"); return 0; @@ -95,13 +95,13 @@ static void create_testfile(apr_pool_t *p, const char *fname) apr_finfo_t finfo; printf("Creating a test file...\n"); - rv = apr_file_open(&f, fname, + rv = apr_file_open(&f, fname, APR_FOPEN_CREATE | APR_FOPEN_WRITE | APR_FOPEN_TRUNCATE | APR_FOPEN_BUFFERED, APR_FPROT_UREAD | APR_FPROT_UWRITE, p); if (rv) { aprerr("apr_file_open()", rv); } - + buf[0] = FILE_DATA_CHAR; buf[1] = '\0'; for (i = 0; i < FILE_LENGTH; i++) { @@ -131,7 +131,7 @@ static void create_testfile(apr_pool_t *p, const char *fname) } if (finfo.size != FILE_LENGTH) { - fprintf(stderr, + fprintf(stderr, "test file %s should be %ld-bytes long\n" "instead it is %ld-bytes long\n", fname, @@ -290,11 +290,11 @@ static int client(apr_pool_t *p, client_socket_mode_t socket_mode, memset(hdtr.trailers[2].iov_base, TRL3_CHAR, TRL3_LEN); hdtr.trailers[2].iov_len = TRL3_LEN; - expected_len = + expected_len = strlen(HDR1) + strlen(HDR2) + HDR3_LEN + strlen(TRL1) + strlen(TRL2) + TRL3_LEN + FILE_LENGTH; - + if (socket_mode == BLK) { current_file_offset = 0; len = FILE_LENGTH; @@ -302,13 +302,13 @@ static int client(apr_pool_t *p, client_socket_mode_t socket_mode, if (rv != APR_SUCCESS) { aprerr("apr_socket_sendfile()", rv); } - + printf("apr_socket_sendfile() updated offset with %ld\n", (long int)current_file_offset); - + printf("apr_socket_sendfile() updated len with %ld\n", (long int)len); - + printf("bytes really sent: %" APR_SIZE_T_FMT "\n", expected_len); @@ -333,7 +333,7 @@ static int client(apr_pool_t *p, client_socket_mode_t socket_mode, pfd.desc.s = sock; pfd.client_data = NULL; - rv = apr_pollset_add(pset, &pfd); + rv = apr_pollset_add(pset, &pfd); assert(!rv); total_bytes_sent = 0; @@ -388,7 +388,7 @@ static int client(apr_pool_t *p, client_socket_mode_t socket_mode, } else { hdtr.headers[0].iov_len -= tmplen; - hdtr.headers[0].iov_base = + hdtr.headers[0].iov_base = (char*) hdtr.headers[0].iov_base + tmplen; tmplen = 0; } @@ -421,14 +421,14 @@ static int client(apr_pool_t *p, client_socket_mode_t socket_mode, } else { hdtr.trailers[0].iov_len -= tmplen; - hdtr.trailers[0].iov_base = + hdtr.trailers[0].iov_base = (char *)hdtr.trailers[0].iov_base + tmplen; tmplen = 0; } } } while (total_bytes_sent < expected_len && - (rv == APR_SUCCESS || + (rv == APR_SUCCESS || (APR_STATUS_IS_EAGAIN(rv) && socket_mode != TIMEOUT))); if (total_bytes_sent != expected_len) { fprintf(stderr, @@ -444,7 +444,7 @@ static int client(apr_pool_t *p, client_socket_mode_t socket_mode, exit(1); } } - + current_file_offset = 0; rv = apr_file_seek(f, APR_CUR, ¤t_file_offset); if (rv != APR_SUCCESS) { @@ -467,7 +467,7 @@ static int client(apr_pool_t *p, client_socket_mode_t socket_mode, if (rv != APR_SUCCESS) { aprerr("apr_socket_timeout_set()", rv); } - + bytes_read = 1; rv = apr_socket_recv(sock, buf, &bytes_read); if (rv != APR_EOF) { @@ -575,7 +575,7 @@ static int server(apr_pool_t *p) (int)bytes_read, buf, HDR1); exit(1); } - + assert(sizeof buf > strlen(HDR2)); bytes_read = strlen(HDR2); rv = apr_socket_recv(newsock, buf, &bytes_read); @@ -614,7 +614,7 @@ static int server(apr_pool_t *p) exit(1); } } - + for (i = 0; i < FILE_LENGTH; i++) { bytes_read = 1; rv = apr_socket_recv(newsock, buf, &bytes_read); @@ -636,7 +636,7 @@ static int server(apr_pool_t *p) exit(1); } } - + assert(sizeof buf > strlen(TRL1)); bytes_read = strlen(TRL1); rv = apr_socket_recv(newsock, buf, &bytes_read); @@ -653,7 +653,7 @@ static int server(apr_pool_t *p) (int)bytes_read, buf, TRL1); exit(1); } - + assert(sizeof buf > strlen(TRL2)); bytes_read = strlen(TRL2); rv = apr_socket_recv(newsock, buf, &bytes_read); @@ -692,7 +692,7 @@ static int server(apr_pool_t *p) exit(1); } } - + bytes_read = 1; rv = apr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_EOF) { @@ -752,7 +752,7 @@ int main(int argc, char *argv[]) } else { host = argv[i]; - } + } } return client(p, mode, host, start_server); } @@ -760,7 +760,7 @@ int main(int argc, char *argv[]) return server(p); } - fprintf(stderr, + fprintf(stderr, "Usage: %s client {blocking|nonblocking|timeout} [startserver] [server-host]\n" " %s server\n", argv[0], argv[0]); diff --git a/test/sockchild.c b/test/sockchild.c index a1116af2b..29e261aa8 100644 --- a/test/sockchild.c +++ b/test/sockchild.c @@ -50,7 +50,7 @@ int main(int argc, char *argv[]) } apr_socket_connect(sock, remote_sa); - + if (!strcmp("read", argv[1])) { char datarecv[STRLEN]; apr_size_t length = STRLEN; @@ -60,13 +60,13 @@ int main(int argc, char *argv[]) rv = apr_socket_recv(sock, datarecv, &length); apr_socket_close(sock); if (APR_STATUS_IS_TIMEUP(rv)) { - exit(SOCKET_TIMEOUT); + exit(SOCKET_TIMEOUT); } if (strcmp(datarecv, DATASTR)) { exit(-1); } - + exit((int)length); } else if (!strcmp("write", argv[1]) diff --git a/test/sockperf.c b/test/sockperf.c index b21becac2..02509af8f 100644 --- a/test/sockperf.c +++ b/test/sockperf.c @@ -58,14 +58,14 @@ struct testResult { static apr_int16_t testPort = 4747; static apr_sockaddr_t *sockAddr = NULL; -static void reportError(const char *msg, apr_status_t rv, +static void reportError(const char *msg, apr_status_t rv, apr_pool_t *pool) { fprintf(stderr, "%s\n", msg); if (rv != APR_SUCCESS) fprintf(stderr, "Error: %d\n'%s'\n", rv, apr_psprintf(pool, "%pm", &rv)); - + } static void closeConnection(apr_socket_t *sock) @@ -74,7 +74,7 @@ static void closeConnection(apr_socket_t *sock) apr_socket_send(sock, NULL, &len); } -static apr_status_t sendRecvBuffer(apr_time_t *t, const char *buf, +static apr_status_t sendRecvBuffer(apr_time_t *t, const char *buf, apr_size_t size, apr_pool_t *pool) { apr_socket_t *sock; @@ -142,14 +142,14 @@ static apr_status_t sendRecvBuffer(apr_time_t *t, const char *buf, rv = apr_socket_send(sock, buf, &len); if (rv != APR_SUCCESS || len != size) { - reportError(apr_psprintf(pool, + reportError(apr_psprintf(pool, "Unable to send data correctly (iteration %d of 3)", i) , rv, pool); closeConnection(sock); apr_socket_close(sock); return rv; } - + do { len = thistime; rv = apr_socket_recv(sock, &recvBuf[size - thistime], &len); @@ -169,7 +169,7 @@ static apr_status_t sendRecvBuffer(apr_time_t *t, const char *buf, if (thistime) { reportError("Received less than we sent :-(", rv, pool); return rv; - } + } if (strncmp(recvBuf, buf, size) != 0) { reportError("Received corrupt data :-(", 0, pool); printf("We sent:\n%s\nWe received:\n%s\n", buf, recvBuf); @@ -186,7 +186,7 @@ static apr_status_t runTest(struct testSet *ts, struct testResult *res, apr_status_t rv = APR_SUCCESS; int i; apr_size_t sz = ts->size * TEST_SIZE; - + buffer = apr_palloc(pool, sz); if (!buffer) { reportError("Unable to allocate buffer", ENOMEM, pool); @@ -224,7 +224,7 @@ int main(int argc, char **argv) apr_pool_create(&pool, NULL); - results = (struct testResult *)apr_pcalloc(pool, + results = (struct testResult *)apr_pcalloc(pool, sizeof(*results) * nTests); for (i = 0; i < nTests; i++) { diff --git a/test/testargs.c b/test/testargs.c index 405b3bed6..8c3829a02 100644 --- a/test/testargs.c +++ b/test/testargs.c @@ -52,7 +52,7 @@ static void no_options_found(abts_case *tc, void *data) str[0] = '\0'; rv = apr_getopt_init(&opt, p, largc, largv); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - + while (apr_getopt(opt, "abcd", &ch, &opt_arg) == APR_SUCCESS) { switch (ch) { case 'a': @@ -85,7 +85,7 @@ static void no_options(abts_case *tc, void *data) opt->errfn = unknown_arg; opt->errarg = str; - + while (apr_getopt(opt, "efgh", &ch, &opt_arg) == APR_SUCCESS) { switch (ch) { case 'a': @@ -117,7 +117,7 @@ static void required_option(abts_case *tc, void *data) opt->errfn = unknown_arg; opt->errarg = str; - + while (apr_getopt(opt, "a:", &ch, &opt_arg) == APR_SUCCESS) { switch (ch) { case 'a': @@ -146,7 +146,7 @@ static void required_option_notgiven(abts_case *tc, void *data) opt->errfn = unknown_arg; opt->errarg = str; - + while (apr_getopt(opt, "a:", &ch, &opt_arg) == APR_SUCCESS) { switch (ch) { case 'a': @@ -175,7 +175,7 @@ static void optional_option(abts_case *tc, void *data) opt->errfn = unknown_arg; opt->errarg = str; - + while (apr_getopt(opt, "a::", &ch, &opt_arg) == APR_SUCCESS) { switch (ch) { case 'a': @@ -204,7 +204,7 @@ static void optional_option_notgiven(abts_case *tc, void *data) opt->errfn = unknown_arg; opt->errarg = str; - + while (apr_getopt(opt, "a::", &ch, &opt_arg) == APR_SUCCESS) { switch (ch) { case 'a': diff --git a/test/testbuckets.c b/test/testbuckets.c index 3957f0e2d..34466e5e3 100644 --- a/test/testbuckets.c +++ b/test/testbuckets.c @@ -39,10 +39,10 @@ static void test_simple(abts_case *tc, void *data) apr_bucket_alloc_t *ba; apr_bucket_brigade *bb; apr_bucket *fb, *tb; - + ba = apr_bucket_alloc_create(p); bb = apr_brigade_create(p, ba); - + fb = APR_BRIGADE_FIRST(bb); ABTS_ASSERT(tc, "first bucket of empty brigade is sentinel", fb == APR_BRIGADE_SENTINEL(bb)); @@ -75,12 +75,12 @@ static void test_simple(abts_case *tc, void *data) } static apr_bucket_brigade *make_simple_brigade(apr_bucket_alloc_t *ba, - const char *first, + const char *first, const char *second) { apr_bucket_brigade *bb = apr_brigade_create(p, ba); apr_bucket *e; - + e = apr_bucket_transient_create(first, strlen(first), ba); APR_BRIGADE_INSERT_TAIL(bb, e); @@ -120,7 +120,7 @@ static void test_flatten(abts_case *tc, void *data) flatten_match(tc, "flatten brigade", bb, "hello, world"); apr_brigade_destroy(bb); - apr_bucket_alloc_destroy(ba); + apr_bucket_alloc_destroy(ba); } static int count_buckets(apr_bucket_brigade *bb) @@ -128,12 +128,12 @@ static int count_buckets(apr_bucket_brigade *bb) apr_bucket *e; int count = 0; - for (e = APR_BRIGADE_FIRST(bb); + for (e = APR_BRIGADE_FIRST(bb); e != APR_BRIGADE_SENTINEL(bb); e = APR_BUCKET_NEXT(e)) { count++; } - + return count; } @@ -173,7 +173,7 @@ static void test_bwrite(abts_case *tc, void *data) int n; for (n = 0; n < COUNT; n++) { - APR_ASSERT_SUCCESS(tc, "brigade_write", + APR_ASSERT_SUCCESS(tc, "brigade_write", apr_brigade_write(bb, NULL, NULL, THESTR, sizeof THESTR)); } @@ -183,7 +183,7 @@ static void test_bwrite(abts_case *tc, void *data) ABTS_ASSERT(tc, "brigade has correct length", length == (COUNT * sizeof THESTR)); - + apr_brigade_destroy(bb); apr_bucket_alloc_destroy(ba); } @@ -275,7 +275,7 @@ static void test_bucket_content(abts_case *tc, apr_size_t alen; APR_ASSERT_SUCCESS(tc, "read from bucket", - apr_bucket_read(e, &adata, &alen, + apr_bucket_read(e, &adata, &alen, APR_BLOCK_READ)); ABTS_ASSERT(tc, "read expected length", alen == elen); @@ -294,19 +294,19 @@ static void test_splits(abts_case *tc, void *ctx) APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_immortal_create(str, 9, ba)); - APR_BRIGADE_INSERT_TAIL(bb, + APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_transient_create(str, 9, ba)); - APR_BRIGADE_INSERT_TAIL(bb, + APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_heap_create(strdup(str), 9, free, ba)); - APR_BRIGADE_INSERT_TAIL(bb, - apr_bucket_pool_create(apr_pstrdup(p, str), 9, p, + APR_BRIGADE_INSERT_TAIL(bb, + apr_bucket_pool_create(apr_pstrdup(p, str), 9, p, ba)); ABTS_ASSERT(tc, "four buckets inserted", count_buckets(bb) == 4); - + /* now split each of the buckets after byte 5 */ for (n = 0, e = APR_BRIGADE_FIRST(bb); n < 4; n++) { - ABTS_ASSERT(tc, "reached end of brigade", + ABTS_ASSERT(tc, "reached end of brigade", e != APR_BRIGADE_SENTINEL(bb)); ABTS_ASSERT(tc, "split bucket OK", apr_bucket_split(e, 5) == APR_SUCCESS); @@ -314,14 +314,14 @@ static void test_splits(abts_case *tc, void *ctx) ABTS_ASSERT(tc, "split OK", e != APR_BRIGADE_SENTINEL(bb)); e = APR_BUCKET_NEXT(e); } - - ABTS_ASSERT(tc, "four buckets split into eight", + + ABTS_ASSERT(tc, "four buckets split into eight", count_buckets(bb) == 8); for (n = 0, e = APR_BRIGADE_FIRST(bb); n < 4; n++) { const char *data; apr_size_t len; - + APR_ASSERT_SUCCESS(tc, "read alpha from bucket", apr_bucket_read(e, &data, &len, APR_BLOCK_READ)); ABTS_ASSERT(tc, "read 5 bytes", len == 5); @@ -346,9 +346,9 @@ static void test_splits(abts_case *tc, void *ctx) f = APR_BUCKET_NEXT(e); apr_bucket_delete(e); e = APR_BUCKET_NEXT(f); - } - - ABTS_ASSERT(tc, "eight buckets reduced to four", + } + + ABTS_ASSERT(tc, "eight buckets reduced to four", count_buckets(bb) == 4); flatten_match(tc, "flatten beta brigade", bb, @@ -381,11 +381,11 @@ static void test_insertfile(abts_case *tc, void *ctx) ABTS_NOT_IMPL(tc, "Skipped: could not create large file"); return; } - + bb = apr_brigade_create(p, ba); e = apr_brigade_insert_file(bb, f, 0, bignum, p); - + ABTS_ASSERT(tc, "inserted file was not at end of brigade", e == APR_BRIGADE_LAST(bb)); @@ -426,7 +426,7 @@ static apr_file_t *make_test_file(abts_case *tc, const char *fname, apr_file_open(&f, fname, APR_FOPEN_READ|APR_FOPEN_WRITE|APR_FOPEN_TRUNCATE|APR_FOPEN_CREATE, APR_FPROT_OS_DEFAULT, p) == APR_SUCCESS); - + ABTS_ASSERT(tc, "write test file contents", apr_file_puts(contents, f) == APR_SUCCESS); @@ -486,7 +486,7 @@ static void test_truncfile(abts_case *tc, void *data) apr_bucket_read(e, &buf, &len, APR_BLOCK_READ) == APR_EOF); ABTS_ASSERT(tc, "read length 0", len == 0); - + ABTS_ASSERT(tc, "still a single bucket in brigade", APR_BUCKET_NEXT(e) == APR_BRIGADE_SENTINEL(bb)); diff --git a/test/testcond.c b/test/testcond.c index b5a20bc46..e6428b8dc 100644 --- a/test/testcond.c +++ b/test/testcond.c @@ -387,7 +387,7 @@ static void pipe_consumer(toolbox_t *box) } while (1); /* naive fairness test - it would be good to introduce or solidify - * a solid test to ensure one thread is not starved. + * a solid test to ensure one thread is not starved. * ABTS_INT_EQUAL(tc, 1, !!consumed); */ } diff --git a/test/testdate.c b/test/testdate.c index 3d74b5c8a..49cdc47c3 100644 --- a/test/testdate.c +++ b/test/testdate.c @@ -200,7 +200,7 @@ static void test_date_exp_get(abts_case *tc, void *data) 1, 2, 10, 100, 1000, 9000, 10000, 100000, -1, -2, -10, -100, -1000, -9000, -10000, -100000, }; - + tm.tm_mday = 1; tm.tm_year = 70; diff --git a/test/testdir.c b/test/testdir.c index db8d1bc06..1521d2040 100644 --- a/test/testdir.c +++ b/test/testdir.c @@ -45,7 +45,7 @@ static void test_mkdir_recurs(abts_case *tc, void *data) apr_status_t rv; apr_finfo_t finfo; - rv = apr_dir_make_recursive("data/one/two/three", + rv = apr_dir_make_recursive("data/one/two/three", APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_UEXECUTE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -325,7 +325,7 @@ static void test_uncleared_errno(abts_case *tc, void *data) apr_finfo_t finfo; apr_int32_t finfo_flags = APR_FINFO_TYPE | APR_FINFO_NAME; apr_dir_t *this_dir; - apr_status_t rv; + apr_status_t rv; rv = apr_dir_make("dir1", APR_FPROT_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -343,7 +343,7 @@ static void test_uncleared_errno(abts_case *tc, void *data) `errno' will be set as a result. */ rv = apr_dir_remove("dir1", p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ENOTEMPTY(rv)); - + /* Read `.' and `..' out of dir2. */ rv = apr_dir_open(&this_dir, "dir2", p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -361,7 +361,7 @@ static void test_uncleared_errno(abts_case *tc, void *data) rv = apr_dir_close(this_dir); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - + /* Cleanup */ rv = apr_file_remove("dir1/file1", p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); diff --git a/test/testdso.c b/test/testdso.c index 0d9f27bb2..5ba07768c 100644 --- a/test/testdso.c +++ b/test/testdso.c @@ -36,8 +36,8 @@ #elif defined(WIN32) # define MOD_NAME TESTBINPATH "mod_test.dll" #elif defined(DARWIN) -# define MOD_NAME ".libs/mod_test.so" -# define LIB_NAME ".libs/libmod_test.dylib" +# define MOD_NAME ".libs/mod_test.so" +# define LIB_NAME ".libs/libmod_test.dylib" #elif (defined(__hpux__) || defined(__hpux)) && !defined(__ia64) # define MOD_NAME ".libs/mod_test.sl" # define LIB_NAME ".libs/libmod_test.sl" @@ -230,7 +230,7 @@ static void test_load_notthere(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_EDSOOPEN(status)); ABTS_PTR_NOTNULL(tc, h); -} +} #endif /* APR_HAS_DSO */ @@ -240,7 +240,7 @@ abts_suite *testdso(abts_suite *suite) #if APR_HAS_DSO apr_filepath_merge(&modname, NULL, MOD_NAME, 0, p); - + abts_run_test(suite, test_load_module, NULL); abts_run_test(suite, test_dso_sym, NULL); abts_run_test(suite, test_dso_sym_return_value, NULL); @@ -248,7 +248,7 @@ abts_suite *testdso(abts_suite *suite) #ifdef LIB_NAME apr_filepath_merge(&libname, NULL, LIB_NAME, 0, p); - + abts_run_test(suite, test_load_library, NULL); abts_run_test(suite, test_dso_sym_library, NULL); abts_run_test(suite, test_dso_sym_return_value_library, NULL); diff --git a/test/testdup.c b/test/testdup.c index 2a261f2d7..31a196db9 100644 --- a/test/testdup.c +++ b/test/testdup.c @@ -33,7 +33,7 @@ static void test_file_dup(abts_case *tc, void *data) apr_finfo_t finfo; /* First, create a new file, empty... */ - rv = apr_file_open(&file1, FILEPATH "testdup.file", + rv = apr_file_open(&file1, FILEPATH "testdup.file", APR_FOPEN_READ | APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_DELONCLOSE, APR_FPROT_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -51,7 +51,7 @@ static void test_file_dup(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); rv = apr_stat(&finfo, FILEPATH "testdup.file", APR_FINFO_NORM, p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ENOENT(rv)); -} +} static void test_file_readwrite(abts_case *tc, void *data) { @@ -64,7 +64,7 @@ static void test_file_readwrite(abts_case *tc, void *data) apr_off_t fpos; /* First, create a new file, empty... */ - rv = apr_file_open(&file1, FILEPATH "testdup.readwrite.file", + rv = apr_file_open(&file1, FILEPATH "testdup.readwrite.file", APR_FOPEN_READ | APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_DELONCLOSE, APR_FPROT_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -96,7 +96,7 @@ static void test_file_readwrite(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); rv = apr_stat(&finfo, FILEPATH "testdup.readwrite.file", APR_FINFO_NORM, p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ENOENT(rv)); -} +} static void test_dup2(abts_case *tc, void *data) { @@ -105,7 +105,7 @@ static void test_dup2(abts_case *tc, void *data) apr_file_t *saveerr = NULL; apr_status_t rv; - rv = apr_file_open(&testfile, FILEPATH "testdup2.file", + rv = apr_file_open(&testfile, FILEPATH "testdup2.file", APR_FOPEN_READ | APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_DELONCLOSE, APR_FPROT_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -142,7 +142,7 @@ static void test_dup2_readwrite(abts_case *tc, void *data) char buff[50]; apr_off_t fpos; - rv = apr_file_open(&testfile, FILEPATH "testdup2.readwrite.file", + rv = apr_file_open(&testfile, FILEPATH "testdup2.readwrite.file", APR_FOPEN_READ | APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_DELONCLOSE, APR_FPROT_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -174,7 +174,7 @@ static void test_dup2_readwrite(abts_case *tc, void *data) rv = apr_file_read(testfile, buff, &txtlen); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, TEST2, buff); - + apr_file_close(testfile); rv = apr_file_dup2(errfile, saveerr, p); diff --git a/test/testfile.c b/test/testfile.c index 591f7acb5..34654521a 100644 --- a/test/testfile.c +++ b/test/testfile.c @@ -44,7 +44,7 @@ static void test_open_noreadwrite(abts_case *tc, void *data) APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_GREAD, p); ABTS_TRUE(tc, rv != APR_SUCCESS); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_EACCES(rv)); - ABTS_PTR_EQUAL(tc, NULL, thefile); + ABTS_PTR_EQUAL(tc, NULL, thefile); } static void test_open_excl(abts_case *tc, void *data) @@ -57,7 +57,7 @@ static void test_open_excl(abts_case *tc, void *data) APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_GREAD, p); ABTS_TRUE(tc, rv != APR_SUCCESS); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_EEXIST(rv)); - ABTS_PTR_EQUAL(tc, NULL, thefile); + ABTS_PTR_EQUAL(tc, NULL, thefile); } static void test_open_read(abts_case *tc, void *data) @@ -65,7 +65,7 @@ static void test_open_read(abts_case *tc, void *data) apr_status_t rv; apr_file_t *filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = apr_file_open(&filetest, FILENAME, APR_FOPEN_READ, APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_GREAD, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -76,7 +76,7 @@ static void test_open_read(abts_case *tc, void *data) static void link_existing(abts_case *tc, void *data) { apr_status_t rv; - + rv = apr_file_link("data/file_datafile.txt", "data/file_datafile2.txt"); apr_file_remove("data/file_datafile2.txt", p); ABTS_ASSERT(tc, "Couldn't create hardlink to file", rv == APR_SUCCESS); @@ -85,7 +85,7 @@ static void link_existing(abts_case *tc, void *data) static void link_nonexisting(abts_case *tc, void *data) { apr_status_t rv; - + rv = apr_file_link("data/does_not_exist.txt", "data/fake.txt"); ABTS_ASSERT(tc, "", rv != APR_SUCCESS); } @@ -96,8 +96,8 @@ static void test_read(abts_case *tc, void *data) apr_size_t nbytes = 256; char *str = apr_pcalloc(p, nbytes + 1); apr_file_t *filetest = NULL; - - rv = apr_file_open(&filetest, FILENAME, + + rv = apr_file_open(&filetest, FILENAME, APR_FOPEN_READ, APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_GREAD, p); @@ -116,7 +116,7 @@ static void test_readzero(abts_case *tc, void *data) apr_size_t nbytes = 0; char *str = NULL; apr_file_t *filetest; - + rv = apr_file_open(&filetest, FILENAME, APR_FOPEN_READ, APR_FPROT_OS_DEFAULT, p); APR_ASSERT_SUCCESS(tc, "Opening test file " FILENAME, rv); @@ -132,8 +132,8 @@ static void test_filename(abts_case *tc, void *data) const char *str; apr_status_t rv; apr_file_t *filetest = NULL; - - rv = apr_file_open(&filetest, FILENAME, + + rv = apr_file_open(&filetest, FILENAME, APR_FOPEN_READ, APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_GREAD, p); APR_ASSERT_SUCCESS(tc, "Opening test file " FILENAME, rv); @@ -144,15 +144,15 @@ static void test_filename(abts_case *tc, void *data) apr_file_close(filetest); } - + static void test_fileclose(abts_case *tc, void *data) { char str; apr_status_t rv; apr_size_t one = 1; apr_file_t *filetest = NULL; - - rv = apr_file_open(&filetest, FILENAME, + + rv = apr_file_open(&filetest, FILENAME, APR_FOPEN_READ, APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_GREAD, p); APR_ASSERT_SUCCESS(tc, "Opening test file " FILENAME, rv); @@ -183,7 +183,7 @@ static void test_open_write(abts_case *tc, void *data) apr_file_t *filetest = NULL; filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = apr_file_open(&filetest, FILENAME, APR_FOPEN_WRITE, APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_GREAD, p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ENOENT(rv)); @@ -196,7 +196,7 @@ static void test_open_writecreate(abts_case *tc, void *data) apr_file_t *filetest = NULL; filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = apr_file_open(&filetest, FILENAME, APR_FOPEN_WRITE | APR_FOPEN_CREATE, APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_GREAD, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -210,7 +210,7 @@ static void test_write(abts_case *tc, void *data) apr_size_t bytes = strlen(TESTSTR); apr_file_t *filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = apr_file_open(&filetest, FILENAME, APR_FOPEN_WRITE | APR_FOPEN_CREATE, APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_GREAD, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -227,7 +227,7 @@ static void test_open_readwrite(abts_case *tc, void *data) apr_file_t *filetest = NULL; filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = apr_file_open(&filetest, FILENAME, APR_FOPEN_READ | APR_FOPEN_WRITE, APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_GREAD, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -244,7 +244,7 @@ static void test_seek(abts_case *tc, void *data) char *str = apr_pcalloc(p, nbytes + 1); apr_file_t *filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = apr_file_open(&filetest, FILENAME, APR_FOPEN_READ, APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_GREAD, p); APR_ASSERT_SUCCESS(tc, "Open test file " FILENAME, rv); @@ -258,7 +258,7 @@ static void test_seek(abts_case *tc, void *data) rv = apr_file_seek(filetest, SEEK_SET, &offset); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - + rv = apr_file_read(filetest, str, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_SIZE_EQUAL(tc, strlen(TESTSTR) - 5, nbytes); @@ -286,14 +286,14 @@ static void test_seek(abts_case *tc, void *data) ABTS_STR_EQUAL(tc, &TESTSTR[strlen(TESTSTR) - 5], str); apr_file_close(filetest); -} +} static void test_userdata_set(abts_case *tc, void *data) { apr_status_t rv; apr_file_t *filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = apr_file_open(&filetest, FILENAME, APR_FOPEN_WRITE, APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_GREAD, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -311,7 +311,7 @@ static void test_userdata_get(abts_case *tc, void *data) char *teststr; apr_file_t *filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = apr_file_open(&filetest, FILENAME, APR_FOPEN_WRITE, APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_GREAD, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -334,7 +334,7 @@ static void test_userdata_getnokey(abts_case *tc, void *data) void *teststr; apr_file_t *filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = apr_file_open(&filetest, FILENAME, APR_FOPEN_WRITE, APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_GREAD, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -352,27 +352,27 @@ static void test_buffer_set_get(abts_case *tc, void *data) apr_file_t *filetest = NULL; char * buffer; - rv = apr_file_open(&filetest, FILENAME, + rv = apr_file_open(&filetest, FILENAME, APR_FOPEN_WRITE | APR_FOPEN_BUFFERED, APR_FPROT_UREAD | APR_FPROT_UWRITE | APR_FPROT_GREAD, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); bufsize = apr_file_buffer_size_get(filetest); ABTS_SIZE_EQUAL(tc, APR_BUFFERSIZE, bufsize); - + buffer = apr_pcalloc(p, 10240); rv = apr_file_buffer_set(filetest, buffer, 10240); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - + bufsize = apr_file_buffer_size_get(filetest); ABTS_SIZE_EQUAL(tc, 10240, bufsize); - + rv = apr_file_buffer_set(filetest, buffer, 12); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - + bufsize = apr_file_buffer_size_get(filetest); ABTS_SIZE_EQUAL(tc, 12, bufsize); - + apr_file_close(filetest); } static void test_getc(abts_case *tc, void *data) @@ -679,7 +679,7 @@ static void test_bigread(abts_case *tc, void *data) /* Create a test file with known content. */ - rv = apr_file_open(&f, "data/created_file", + rv = apr_file_open(&f, "data/created_file", APR_FOPEN_CREATE | APR_FOPEN_WRITE | APR_FOPEN_TRUNCATE, APR_FPROT_UREAD | APR_FPROT_UWRITE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -724,7 +724,7 @@ static void test_mod_neg(abts_case *tc, void *data) apr_off_t cur; const char *fname = "data/modneg.dat"; - rv = apr_file_open(&f, fname, + rv = apr_file_open(&f, fname, APR_FOPEN_CREATE | APR_FOPEN_WRITE, APR_FPROT_UREAD | APR_FPROT_UWRITE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -734,7 +734,7 @@ static void test_mod_neg(abts_case *tc, void *data) rv = apr_file_write(f, s, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_SIZE_EQUAL(tc, strlen(s), nbytes); - + for (i = 0; i < 7980; i++) { s = "0"; nbytes = strlen(s); @@ -742,7 +742,7 @@ static void test_mod_neg(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_SIZE_EQUAL(tc, strlen(s), nbytes); } - + s = "end456789\n"; nbytes = strlen(s); rv = apr_file_write(f, s, &nbytes); @@ -756,7 +756,7 @@ static void test_mod_neg(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_SIZE_EQUAL(tc, strlen(s), nbytes); } - + rv = apr_file_close(f); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -808,7 +808,7 @@ static void file_contents_equal(abts_case *tc, 0, p)); APR_ASSERT_SUCCESS(tc, "read from file", apr_file_read_full(f, actual, expectlen, NULL)); - + ABTS_ASSERT(tc, "matched expected file contents", memcmp(expect, actual, expectlen) == 0); @@ -824,15 +824,15 @@ static void test_puts(abts_case *tc, void *data) const char *fname = "data/testputs.dat"; APR_ASSERT_SUCCESS(tc, "open file for writing", - apr_file_open(&f, fname, + apr_file_open(&f, fname, APR_FOPEN_WRITE|APR_FOPEN_CREATE|APR_FOPEN_TRUNCATE, APR_FPROT_OS_DEFAULT, p)); - - APR_ASSERT_SUCCESS(tc, "write line to file", + + APR_ASSERT_SUCCESS(tc, "write line to file", apr_file_puts(LINE1, f)); - APR_ASSERT_SUCCESS(tc, "write second line to file", + APR_ASSERT_SUCCESS(tc, "write second line to file", apr_file_puts(LINE2, f)); - + APR_ASSERT_SUCCESS(tc, "close for writing", apr_file_close(f)); @@ -847,10 +847,10 @@ static void test_writev(abts_case *tc, void *data) const char *fname = "data/testwritev.dat"; APR_ASSERT_SUCCESS(tc, "open file for writing", - apr_file_open(&f, fname, + apr_file_open(&f, fname, APR_FOPEN_WRITE|APR_FOPEN_CREATE|APR_FOPEN_TRUNCATE, APR_FPROT_OS_DEFAULT, p)); - + vec[0].iov_base = LINE1; vec[0].iov_len = strlen(LINE1); @@ -858,7 +858,7 @@ static void test_writev(abts_case *tc, void *data) apr_file_writev(f, vec, 1, &nbytes)); file_contents_equal(tc, fname, LINE1, strlen(LINE1)); - + vec[0].iov_base = LINE1; vec[0].iov_len = strlen(LINE1); vec[1].iov_base = LINE2; @@ -876,7 +876,7 @@ static void test_writev(abts_case *tc, void *data) APR_ASSERT_SUCCESS(tc, "close for writing", apr_file_close(f)); - file_contents_equal(tc, fname, LINE1 LINE1 LINE2 LINE1 LINE1 LINE2, + file_contents_equal(tc, fname, LINE1 LINE1 LINE2 LINE1 LINE1 LINE2, strlen(LINE1)*4 + strlen(LINE2)*2); } @@ -889,10 +889,10 @@ static void test_writev_full(abts_case *tc, void *data) const char *fname = "data/testwritev_full.dat"; APR_ASSERT_SUCCESS(tc, "open file for writing", - apr_file_open(&f, fname, + apr_file_open(&f, fname, APR_FOPEN_WRITE|APR_FOPEN_CREATE|APR_FOPEN_TRUNCATE, APR_FPROT_OS_DEFAULT, p)); - + vec[0].iov_base = LINE1; vec[0].iov_len = strlen(LINE1); vec[1].iov_base = LINE2; @@ -912,7 +912,7 @@ static void test_writev_full(abts_case *tc, void *data) APR_ASSERT_SUCCESS(tc, "close for writing", apr_file_close(f)); - file_contents_equal(tc, fname, LINE1 LINE2 LINE1 LINE1 LINE2, + file_contents_equal(tc, fname, LINE1 LINE2 LINE1 LINE1 LINE2, strlen(LINE1)*3 + strlen(LINE2)*2); } @@ -1002,7 +1002,7 @@ static void test_truncate(abts_case *tc, void *data) APR_FOPEN_CREATE | APR_FOPEN_WRITE, APR_FPROT_UREAD | APR_FPROT_UWRITE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - + s = "some data"; nbytes = strlen(s); rv = apr_file_write(f, s, &nbytes); @@ -1232,7 +1232,7 @@ static void test_bigfprintf(abts_case *tc, void *data) apr_file_open(&f, fname, APR_FOPEN_CREATE|APR_FOPEN_WRITE, APR_FPROT_UREAD|APR_FPROT_UWRITE, p)); - + to_write = malloc(HUGE_STRING_LEN + 3); @@ -1335,7 +1335,7 @@ static void test_xthread(abts_case *tc, void *data) apr_int32_t flags = APR_FOPEN_CREATE|APR_FOPEN_READ|APR_FOPEN_WRITE|APR_FOPEN_APPEND|APR_FOPEN_XTHREAD; char buf[128] = { 0 }; - /* Test for bug 38438, opening file with append + xthread and seeking to + /* Test for bug 38438, opening file with append + xthread and seeking to the end of the file resulted in writes going to the beginning not the end. */ @@ -1349,7 +1349,7 @@ static void test_xthread(abts_case *tc, void *data) apr_file_puts("hello", f)); apr_file_close(f); - + APR_ASSERT_SUCCESS(tc, "open test file", apr_file_open(&f, fname, flags, APR_FPROT_UREAD|APR_FPROT_UWRITE, p)); @@ -1368,11 +1368,11 @@ static void test_xthread(abts_case *tc, void *data) /* Back to the beginning. */ { 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); ABTS_STR_EQUAL(tc, "helloworld", buf); @@ -2258,8 +2258,8 @@ abts_suite *testfile(abts_suite *suite) abts_run_test(suite, test_open_readwrite, NULL); abts_run_test(suite, link_existing, NULL); abts_run_test(suite, link_nonexisting, NULL); - abts_run_test(suite, test_read, NULL); - abts_run_test(suite, test_readzero, NULL); + abts_run_test(suite, test_read, NULL); + abts_run_test(suite, test_readzero, NULL); abts_run_test(suite, test_seek, NULL); abts_run_test(suite, test_filename, NULL); abts_run_test(suite, test_fileclose, NULL); diff --git a/test/testfilecopy.c b/test/testfilecopy.c index fc2dea48b..3cec04967 100644 --- a/test/testfilecopy.c +++ b/test/testfilecopy.c @@ -28,9 +28,9 @@ static void copy_helper(abts_case *tc, const char *from, const char * to, apr_finfo_t copy; apr_finfo_t orig; apr_finfo_t dest; - + dest_rv = apr_stat(&dest, to, APR_FINFO_SIZE, p); - + if (!append) { rv = apr_file_copy(from, to, perms, p); } @@ -49,8 +49,8 @@ static void copy_helper(abts_case *tc, const char *from, const char * to, ABTS_ASSERT(tc, "File size differs", orig.size == copy.size); } else { - ABTS_ASSERT(tc, "File size differs", - ((dest_rv == APR_SUCCESS) + ABTS_ASSERT(tc, "File size differs", + ((dest_rv == APR_SUCCESS) ? dest.size : 0) + orig.size == copy.size); } } @@ -61,8 +61,8 @@ static void copy_short_file(abts_case *tc, void *data) /* make absolutely sure that the dest file doesn't exist. */ apr_file_remove("data/file_copy.txt", p); - - copy_helper(tc, "data/file_datafile.txt", "data/file_copy.txt", + + copy_helper(tc, "data/file_datafile.txt", "data/file_copy.txt", APR_FPROT_FILE_SOURCE_PERMS, 0, p); rv = apr_file_remove("data/file_copy.txt", p); APR_ASSERT_SUCCESS(tc, "Couldn't remove copy file", rv); @@ -71,20 +71,20 @@ static void copy_short_file(abts_case *tc, void *data) static void copy_over_existing(abts_case *tc, void *data) { apr_status_t rv; - + /* make absolutely sure that the dest file doesn't exist. */ apr_file_remove("data/file_copy.txt", p); - + /* This is a cheat. I don't want to create a new file, so I just copy * one file, then I copy another. If the second copy succeeds, then * this works. */ - copy_helper(tc, "data/file_datafile.txt", "data/file_copy.txt", + copy_helper(tc, "data/file_datafile.txt", "data/file_copy.txt", APR_FPROT_FILE_SOURCE_PERMS, 0, p); - - copy_helper(tc, "data/mmap_datafile.txt", "data/file_copy.txt", + + copy_helper(tc, "data/mmap_datafile.txt", "data/file_copy.txt", APR_FPROT_FILE_SOURCE_PERMS, 0, p); - + rv = apr_file_remove("data/file_copy.txt", p); APR_ASSERT_SUCCESS(tc, "Couldn't remove copy file", rv); } @@ -96,7 +96,7 @@ static void append_nonexist(abts_case *tc, void *data) /* make absolutely sure that the dest file doesn't exist. */ apr_file_remove("data/file_copy.txt", p); - copy_helper(tc, "data/file_datafile.txt", "data/file_copy.txt", + copy_helper(tc, "data/file_datafile.txt", "data/file_copy.txt", APR_FPROT_FILE_SOURCE_PERMS, 0, p); rv = apr_file_remove("data/file_copy.txt", p); APR_ASSERT_SUCCESS(tc, "Couldn't remove copy file", rv); @@ -105,20 +105,20 @@ static void append_nonexist(abts_case *tc, void *data) static void append_exist(abts_case *tc, void *data) { apr_status_t rv; - + /* make absolutely sure that the dest file doesn't exist. */ apr_file_remove("data/file_copy.txt", p); - + /* This is a cheat. I don't want to create a new file, so I just copy * one file, then I copy another. If the second copy succeeds, then * this works. */ - copy_helper(tc, "data/file_datafile.txt", "data/file_copy.txt", + copy_helper(tc, "data/file_datafile.txt", "data/file_copy.txt", APR_FPROT_FILE_SOURCE_PERMS, 0, p); - - copy_helper(tc, "data/mmap_datafile.txt", "data/file_copy.txt", + + copy_helper(tc, "data/mmap_datafile.txt", "data/file_copy.txt", APR_FPROT_FILE_SOURCE_PERMS, 1, p); - + rv = apr_file_remove("data/file_copy.txt", p); APR_ASSERT_SUCCESS(tc, "Couldn't remove copy file", rv); } diff --git a/test/testfileinfo.c b/test/testfileinfo.c index ce3f461fc..9f6d85239 100644 --- a/test/testfileinfo.c +++ b/test/testfileinfo.c @@ -40,13 +40,13 @@ static const struct view_fileinfo {APR_FINFO_INODE, "INODE"}, {APR_FINFO_NLINK, "NLINK"}, {APR_FINFO_TYPE, "TYPE"}, - {APR_FINFO_USER, "USER"}, - {APR_FINFO_GROUP, "GROUP"}, - {APR_FINFO_UPROT, "UPROT"}, + {APR_FINFO_USER, "USER"}, + {APR_FINFO_GROUP, "GROUP"}, + {APR_FINFO_UPROT, "UPROT"}, {APR_FINFO_GPROT, "GPROT"}, {APR_FINFO_WPROT, "WPROT"}, {0, NULL} -}; +}; static void finfo_equal(abts_case *tc, apr_finfo_t *f1, apr_finfo_t *f2) { @@ -160,7 +160,7 @@ static void test_stat_eq_finfo(abts_case *tc, void *data) rv = apr_file_info_get(&finfo, APR_FINFO_NORM, thefile); /* Opening the file may have toggled the atime member (time last - * accessed), so fetch our apr_stat() after getting the fileinfo + * accessed), so fetch our apr_stat() after getting the fileinfo * of the open file... */ rv = apr_stat(&stat_finfo, FILENAME, APR_FINFO_NORM, p); diff --git a/test/testflock.c b/test/testflock.c index 2cf9f358e..82ecf848c 100644 --- a/test/testflock.c +++ b/test/testflock.c @@ -62,7 +62,7 @@ static void test_withlock(abts_case *tc, void *data) apr_file_t *file; apr_status_t rv; int code; - + rv = apr_file_open(&file, TESTFILE, APR_FOPEN_WRITE|APR_FOPEN_CREATE, APR_FPROT_OS_DEFAULT, p); APR_ASSERT_SUCCESS(tc, "Could not create file.", rv); @@ -81,7 +81,7 @@ static void test_withlock(abts_case *tc, void *data) static void test_withoutlock(abts_case *tc, void *data) { int code; - + code = launch_reader(tc); ABTS_INT_EQUAL(tc, SUCCESSFUL_READ, code); } @@ -91,7 +91,7 @@ static void remove_lockfile(abts_case *tc, void *data) APR_ASSERT_SUCCESS(tc, "Couldn't remove lock file.", apr_file_remove(TESTFILE, p)); } - + abts_suite *testflock(abts_suite *suite) { suite = ADD_SUITE(suite) diff --git a/test/testfnmatch.c b/test/testfnmatch.c index 572fd4b3e..1303d5571 100644 --- a/test/testfnmatch.c +++ b/test/testfnmatch.c @@ -192,7 +192,7 @@ static void test_fnmatch_test(abts_case *tc, void *data) for (t = ft_tests; t->pattern != NULL; t++) { int res = apr_fnmatch_test(t->pattern); - + if (res != t->result) { char buf[128]; @@ -208,7 +208,7 @@ static void test_glob(abts_case *tc, void *data) int i; char **list; apr_array_header_t *result; - + APR_ASSERT_SUCCESS(tc, "glob match against data/*.txt", apr_match_glob("data\\*.txt", &result, p)); @@ -227,7 +227,7 @@ static void test_glob_currdir(abts_case *tc, void *data) char **list; apr_array_header_t *result; apr_filepath_set("data", p); - + APR_ASSERT_SUCCESS(tc, "glob match against *.txt with data as current", apr_match_glob("*.txt", &result, p)); diff --git a/test/testglobalmutex.c b/test/testglobalmutex.c index c79884cfc..8460396e6 100644 --- a/test/testglobalmutex.c +++ b/test/testglobalmutex.c @@ -82,7 +82,7 @@ static void test_exclusive(abts_case *tc, void *data) int x = 0; abts_log_message("lock mechanism is: "); abts_log_message(mutexname(mech)); - + rv = apr_global_mutex_create(&global_lock, LOCKNAME, mech, p); if (rv == APR_ENOTIMPL) { /* MacOS lacks TIMED implementation, so don't fail for ENOTIMPL */ @@ -95,7 +95,7 @@ static void test_exclusive(abts_case *tc, void *data) launch_child(tc, mech, &p2, p); launch_child(tc, mech, &p3, p); launch_child(tc, mech, &p4, p); - + x += wait_child(tc, &p1); x += wait_child(tc, &p2); x += wait_child(tc, &p3); diff --git a/test/testhash.c b/test/testhash.c index 9dd5804b8..3ce255787 100644 --- a/test/testhash.c +++ b/test/testhash.c @@ -29,7 +29,7 @@ static int comp_string(const void *str1, const void *str2) return strcmp(str1,str2); } -static void dump_hash(apr_pool_t *p, apr_hash_t *h, char str[][MAX_LTH]) +static void dump_hash(apr_pool_t *p, apr_hash_t *h, char str[][MAX_LTH]) { apr_hash_index_t *hi; int i = 0; @@ -58,7 +58,7 @@ static void dump_hash(apr_pool_t *p, apr_hash_t *h, char str[][MAX_LTH]) ); } -static void sum_hash(apr_pool_t *p, apr_hash_t *h, int *pcount, int *keySum, int *valSum) +static void sum_hash(apr_pool_t *p, apr_hash_t *h, int *pcount, int *keySum, int *valSum) { apr_hash_index_t *hi; void *val, *key; @@ -218,7 +218,7 @@ static void hash_clear(abts_case *tc, void *data) } /* This is kind of a hack, but I am just keeping an existing test. This is - * really testing apr_hash_first, apr_hash_next, and apr_hash_this which + * really testing apr_hash_first, apr_hash_next, and apr_hash_this which * should be tested in three separate tests, but this will do for now. */ static void hash_traverse(abts_case *tc, void *data) @@ -252,7 +252,7 @@ static void hash_traverse(abts_case *tc, void *data) } /* This is kind of a hack, but I am just keeping an existing test. This is - * really testing apr_hash_first, apr_hash_next, and apr_hash_this which + * really testing apr_hash_first, apr_hash_next, and apr_hash_this which * should be tested in three separate tests, but this will do for now. */ static void summation_test(abts_case *tc, void *data) diff --git a/test/testhooks.c b/test/testhooks.c index b2b16d4c1..ab73f7164 100644 --- a/test/testhooks.c +++ b/test/testhooks.c @@ -152,7 +152,7 @@ static void test_basic_ordering(abts_case *tc, void *data) probe_buf_pool = p; test_run_toyhook(buf, sizeof buf); - + ABTS_STR_EQUAL(tc, "12345", buf); ABTS_STR_EQUAL(tc, "EI1CI2CI3CI4CI5CR", probe_buf); } @@ -179,7 +179,7 @@ static void test_pred_ordering(abts_case *tc, void *data) probe_buf_pool = p; test_run_toyhook(buf, sizeof buf); - + /* FAILS ABTS_STR_EQUAL(tc, "1223", buf); */ } diff --git a/test/testipsub.c b/test/testipsub.c index 1182d7a47..692ad4dd0 100644 --- a/test/testipsub.c +++ b/test/testipsub.c @@ -77,7 +77,7 @@ static void test_singleton_subnets(abts_case *tc, void *data) { const char *v4addrs[] = { "127.0.0.1", "129.42.18.99", "63.161.155.20", "207.46.230.229", "64.208.42.36", - "198.144.203.195", "192.18.97.241", "198.137.240.91", "62.156.179.119", + "198.144.203.195", "192.18.97.241", "198.137.240.91", "62.156.179.119", "204.177.92.181" }; apr_ipsubnet_t *ipsub; @@ -201,14 +201,14 @@ static void test_parse_addr_port(abts_case *tc, void *data) /* ,{ "localhost:-1", APR_EINVAL, NULL, NULL, 0 } <- should fail, doesn't */ }; unsigned i; - + for (i = 0; i < (sizeof testcases / sizeof testcases[0]); i++) { char *addr, *scope_id; apr_port_t port; apr_status_t rv; test = &testcases[i]; - + rv = apr_parse_addr_port(&addr, &scope_id, &port, test->input, p); ABTS_INT_EQUAL(tc, test->rv, rv); diff --git a/test/testlfs.c b/test/testlfs.c index aa5357389..0475fb4f9 100644 --- a/test/testlfs.c +++ b/test/testlfs.c @@ -78,7 +78,7 @@ static void test_open(abts_case *tc, void *data) ABTS_NOT_IMPL(tc, "Creation of large file (apparently not sparse)"); madefile = 0; - } + } else { /* Proceed with our 8GB sparse file now */ rv = apr_file_trunc(f, eightGB); @@ -91,7 +91,7 @@ static void test_open(abts_case *tc, void *data) #endif ) { ABTS_NOT_IMPL(tc, "Creation of large file (rlimit, quota or fs)"); - } + } else { APR_ASSERT_SUCCESS(tc, "truncate file to 8gb", rv); } @@ -112,14 +112,14 @@ static void test_reopen(abts_case *tc, void *data) apr_status_t rv; PRECOND; - + rv = apr_file_open(&fh, TESTFN, APR_FOPEN_SPARSE | APR_FOPEN_READ, APR_FPROT_OS_DEFAULT, p); APR_ASSERT_SUCCESS(tc, "re-open 8GB file", rv); APR_ASSERT_SUCCESS(tc, "file_info_get failed", apr_file_info_get(&finfo, APR_FINFO_NORM, fh)); - + ABTS_ASSERT(tc, "file_info_get gave incorrect size", finfo.size == eightGB); @@ -132,9 +132,9 @@ static void test_stat(abts_case *tc, void *data) PRECOND; - APR_ASSERT_SUCCESS(tc, "stat large file", + APR_ASSERT_SUCCESS(tc, "stat large file", apr_stat(&finfo, TESTFN, APR_FINFO_NORM, p)); - + ABTS_ASSERT(tc, "stat gave incorrect size", finfo.size == eightGB); } @@ -145,25 +145,25 @@ static void test_readdir(abts_case *tc, void *data) PRECOND; - APR_ASSERT_SUCCESS(tc, "open test directory", + APR_ASSERT_SUCCESS(tc, "open test directory", apr_dir_open(&dh, TESTDIR, p)); do { apr_finfo_t finfo; - + rv = apr_dir_read(&finfo, APR_FINFO_MIN, dh); - + if (rv == APR_SUCCESS && strcmp(finfo.name, TESTFILE) == 0) { - ABTS_ASSERT(tc, "apr_dir_read gave incorrect size for large file", + ABTS_ASSERT(tc, "apr_dir_read gave incorrect size for large file", finfo.size == eightGB); } } while (rv == APR_SUCCESS); - + if (!APR_STATUS_IS_ENOENT(rv)) { APR_ASSERT_SUCCESS(tc, "apr_dir_read failed", rv); } - + APR_ASSERT_SUCCESS(tc, "close test directory", apr_dir_close(dh)); } @@ -175,11 +175,11 @@ static void test_append(abts_case *tc, void *data) apr_file_t *fh; apr_finfo_t finfo; apr_status_t rv; - + PRECOND; - rv = apr_file_open(&fh, TESTFN, APR_FOPEN_SPARSE | APR_FOPEN_WRITE - | APR_FOPEN_APPEND, + rv = apr_file_open(&fh, TESTFN, APR_FOPEN_SPARSE | APR_FOPEN_WRITE + | APR_FOPEN_APPEND, APR_FPROT_OS_DEFAULT, p); APR_ASSERT_SUCCESS(tc, "open 8GB file for append", rv); @@ -188,7 +188,7 @@ static void test_append(abts_case *tc, void *data) APR_ASSERT_SUCCESS(tc, "file_info_get failed", apr_file_info_get(&finfo, APR_FINFO_NORM, fh)); - + ABTS_ASSERT(tc, "file_info_get gave incorrect size", finfo.size == eightGB + strlen(TESTSTR)); @@ -202,16 +202,16 @@ static void test_seek(abts_case *tc, void *data) apr_status_t rv; PRECOND; - + rv = apr_file_open(&fh, TESTFN, APR_FOPEN_SPARSE | APR_FOPEN_WRITE, APR_FPROT_OS_DEFAULT, p); APR_ASSERT_SUCCESS(tc, "open 8GB file for writing", rv); pos = 0; - APR_ASSERT_SUCCESS(tc, "relative seek to end", + APR_ASSERT_SUCCESS(tc, "relative seek to end", apr_file_seek(fh, APR_END, &pos)); ABTS_ASSERT(tc, "seek to END gave 8GB", pos == eightGB); - + pos = eightGB; APR_ASSERT_SUCCESS(tc, "seek to 8GB", apr_file_seek(fh, APR_SET, &pos)); ABTS_ASSERT(tc, "seek gave 8GB offset", pos == eightGB); @@ -235,7 +235,7 @@ static void test_write(abts_case *tc, void *data) APR_FPROT_OS_DEFAULT, p); APR_ASSERT_SUCCESS(tc, "re-open 8GB file", rv); - APR_ASSERT_SUCCESS(tc, "seek to 8GB - 4", + APR_ASSERT_SUCCESS(tc, "seek to 8GB - 4", apr_file_seek(fh, APR_SET, &pos)); ABTS_ASSERT(tc, "seek gave 8GB-4 offset", pos == eightGB - 4); @@ -252,7 +252,7 @@ static void test_mmap(abts_case *tc, void *data) apr_mmap_t *map; apr_file_t *fh; apr_size_t len = 65536; /* hopefully a multiple of the page size */ - apr_off_t off = eightGB - len; + apr_off_t off = eightGB - len; apr_status_t rv; void *ptr; @@ -261,14 +261,14 @@ static void test_mmap(abts_case *tc, void *data) rv = apr_file_open(&fh, TESTFN, APR_FOPEN_SPARSE | APR_FOPEN_READ, APR_FPROT_OS_DEFAULT, p); APR_ASSERT_SUCCESS(tc, "open 8gb file for mmap", rv); - + APR_ASSERT_SUCCESS(tc, "mmap 8GB file", apr_mmap_create(&map, fh, off, len, APR_MMAP_READ, p)); APR_ASSERT_SUCCESS(tc, "close file", apr_file_close(fh)); ABTS_ASSERT(tc, "mapped a 64K block", map->size == len); - + APR_ASSERT_SUCCESS(tc, "get pointer into mmaped region", apr_mmap_offset(&ptr, map, len - 4)); ABTS_ASSERT(tc, "pointer was not NULL", ptr != NULL); diff --git a/test/testlock.c b/test/testlock.c index c5479d678..2851d4361 100644 --- a/test/testlock.c +++ b/test/testlock.c @@ -81,7 +81,7 @@ static void *APR_THREAD_FUNC thread_rwlock_func(apr_thread_t *thd, void *data) apr_thread_rwlock_unlock(rwlock); } return NULL; -} +} static void *APR_THREAD_FUNC thread_mutex_function(apr_thread_t *thd, void *data) { @@ -89,10 +89,10 @@ static void *APR_THREAD_FUNC thread_mutex_function(apr_thread_t *thd, void *data /* slight delay to allow things to settle */ apr_sleep (1); - + while (1) { apr_status_t rv; - + if (data) { rv = apr_thread_mutex_timedlock(thread_mutex, *(apr_interval_time_t *)data); } @@ -105,10 +105,10 @@ static void *APR_THREAD_FUNC thread_mutex_function(apr_thread_t *thd, void *data apr_thread_exit(thd, rv); break; } - + if (i == MAX_ITER) exitLoop = 0; - else + else { i++; x++; @@ -156,7 +156,7 @@ static void *APR_THREAD_FUNC thread_mutex_sleep_function(apr_thread_t *thd, void apr_thread_exit(thd, APR_SUCCESS); return NULL; -} +} static void *APR_THREAD_FUNC thread_cond_producer(apr_thread_t *thd, void *data) { @@ -231,7 +231,7 @@ static void test_thread_mutex(abts_case *tc, void *data) JOIN_WITH_SUCCESS(tc, t2); JOIN_WITH_SUCCESS(tc, t3); JOIN_WITH_SUCCESS(tc, t4); - + ABTS_INT_EQUAL(tc, MAX_ITER, x); } @@ -308,14 +308,14 @@ static void test_cond(abts_case *tc, void *data) apr_status_t s0, s1, s2, s3, s4; int count1, count2, count3, count4; int sum; - + APR_ASSERT_SUCCESS(tc, "create put mutex", - apr_thread_mutex_create(&put.mutex, + apr_thread_mutex_create(&put.mutex, APR_THREAD_MUTEX_DEFAULT, p)); ABTS_PTR_NOTNULL(tc, put.mutex); APR_ASSERT_SUCCESS(tc, "create nready mutex", - apr_thread_mutex_create(&nready.mutex, + apr_thread_mutex_create(&nready.mutex, APR_THREAD_MUTEX_DEFAULT, p)); ABTS_PTR_NOTNULL(tc, nready.mutex); @@ -346,7 +346,7 @@ static void test_cond(abts_case *tc, void *data) apr_thread_join(&s3, p4); apr_thread_join(&s4, c1); - APR_ASSERT_SUCCESS(tc, "destroy condvar", + APR_ASSERT_SUCCESS(tc, "destroy condvar", apr_thread_cond_destroy(nready.cond)); sum = count1 + count2 + count3 + count4; @@ -381,7 +381,7 @@ static void test_timeoutcond(abts_case *tc, void *data) s = apr_thread_cond_timedwait(timeout_cond, timeout_mutex, timeout); end = apr_time_now(); apr_thread_mutex_unlock(timeout_mutex); - + if (s != APR_SUCCESS && !APR_STATUS_IS_TIMEUP(s)) { continue; } @@ -419,7 +419,7 @@ static void test_timeoutmutex(abts_case *tc, void *data) wait_for_flag(flag, 1); /* the thread will set flag to 1 once the * timeout_mutex is locked. */ - + timeout = apr_time_from_sec(5); for (i = 0; i < MAX_RETRY; i++) { diff --git a/test/testlockperf.c b/test/testlockperf.c index f89d7900b..077aced52 100644 --- a/test/testlockperf.c +++ b/test/testlockperf.c @@ -104,7 +104,7 @@ int test_thread_mutex(int num_threads) apr_thread_mutex_lock(thread_lock); /* set_concurrency(4)? -aaron */ - printf(" Starting %d threads ", num_threads); + printf(" Starting %d threads ", num_threads); for (i = 0; i < num_threads; ++i) { s[i] = apr_thread_create(&t[i], NULL, thread_mutex_func, NULL, pool); if (s[i] != APR_SUCCESS) { @@ -152,7 +152,7 @@ int test_thread_mutex_nested(int num_threads) apr_thread_mutex_lock(thread_lock); /* set_concurrency(4)? -aaron */ - printf(" Starting %d threads ", num_threads); + printf(" Starting %d threads ", num_threads); for (i = 0; i < num_threads; ++i) { s[i] = apr_thread_create(&t[i], NULL, thread_mutex_func, NULL, pool); if (s[i] != APR_SUCCESS) { @@ -203,7 +203,7 @@ static int test_thread_mutex_timed(int num_threads) apr_thread_mutex_lock(thread_lock); /* set_concurrency(4)? -aaron */ - printf(" Starting %d threads ", num_threads); + printf(" Starting %d threads ", num_threads); for (i = 0; i < num_threads; ++i) { s[i] = apr_thread_create(&t[i], NULL, thread_mutex_func, &timeout, pool); if (s[i] != APR_SUCCESS) { @@ -251,7 +251,7 @@ int test_thread_rwlock(int num_threads) apr_thread_rwlock_wrlock(thread_rwlock); /* set_concurrency(4)? -aaron */ - printf(" Starting %d threads ", num_threads); + printf(" Starting %d threads ", num_threads); for (i = 0; i < num_threads; ++i) { s[i] = apr_thread_create(&t[i], NULL, thread_rwlock_func, NULL, pool); if (s[i] != APR_SUCCESS) { @@ -288,7 +288,7 @@ int main(int argc, const char * const *argv) const char *optarg; printf("APR Lock Performance Test\n==============\n\n"); - + apr_initialize(); atexit(apr_terminate); @@ -300,7 +300,7 @@ int main(int argc, const char * const *argv) rv, apr_strerror(rv, errmsg, sizeof errmsg)); exit(-1); } - + while ((rv = apr_getopt(opt, "c:v", &optchar, &optarg)) == APR_SUCCESS) { if (optchar == 'c') { max_counter = atol(optarg); diff --git a/test/testmd4.c b/test/testmd4.c index eb80408fa..734c2c67e 100644 --- a/test/testmd4.c +++ b/test/testmd4.c @@ -42,9 +42,9 @@ static struct { const char *string; const char *md4sum; -} md4sums[] = +} md4sums[] = { -/* +/* * Taken from the old md4 test suite. * MD4 ("") = 31d6cfe0d16ae931b73c59d7e0c089c0 * MD4 ("a") = bde52cb31de33e46245e05fbdbd6fb24 @@ -53,25 +53,25 @@ static struct { * MD4 ("abcdefghijklmnopqrstuvwxyz") = d79e1c308aa5bbcdeea8ed63df412da9 * MD4 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") * MD4 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = e33b4ddc9c38f2199c3e7b164fcc0536 -* +* */ - {"", + {"", "\x31\xd6\xcf\xe0\xd1\x6a\xe9\x31\xb7\x3c\x59\xd7\xe0\xc0\x89\xc0"}, - {"a", + {"a", "\xbd\xe5\x2c\xb3\x1d\xe3\x3e\x46\x24\x5e\x05\xfb\xdb\xd6\xfb\x24"}, - {"abc", + {"abc", "\xa4\x48\x01\x7a\xaf\x21\xd8\x52\x5f\xc1\x0a\xe8\x7a\xa6\x72\x9d"}, - {"message digest", + {"message digest", "\xd9\x13\x0a\x81\x64\x54\x9f\xe8\x18\x87\x48\x06\xe1\xc7\x01\x4b"}, - {"abcdefghijklmnopqrstuvwxyz", + {"abcdefghijklmnopqrstuvwxyz", "\xd7\x9e\x1c\x30\x8a\xa5\xbb\xcd\xee\xa8\xed\x63\xdf\x41\x2d\xa9"}, - {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "\x04\x3f\x85\x82\xf2\x41\xdb\x35\x1c\xe6\x27\xe1\x53\xe7\xf0\xe4"}, - {"12345678901234567890123456789012345678901234567890123456789012345678901234567890", + {"12345678901234567890123456789012345678901234567890123456789012345678901234567890", "\xe3\x3b\x4d\xdc\x9c\x38\xf2\x19\x9c\x3e\x7b\x16\x4f\xcc\x05\x36"} }; -static int num_sums = sizeof(md4sums) / sizeof(md4sums[0]); +static int num_sums = sizeof(md4sums) / sizeof(md4sums[0]); static int count; #if 0 @@ -98,12 +98,12 @@ static void test_md4sum(abts_case *tc, void *data) size_t len = strlen(string); ABTS_ASSERT(tc, "apr_md4_init", (apr_md4_init(&context) == 0)); - ABTS_ASSERT(tc, "apr_md4_update", - (apr_md4_update(&context, + ABTS_ASSERT(tc, "apr_md4_update", + (apr_md4_update(&context, (unsigned char *)string, len) == 0)); - + ABTS_ASSERT(tc, "apr_md4_final", (apr_md4_final(digest, &context) ==0)); - ABTS_ASSERT(tc, "check for correct md4 digest", + ABTS_ASSERT(tc, "check for correct md4 digest", (memcmp(digest, sum, APR_MD4_DIGESTSIZE) == 0)); } diff --git a/test/testmd5.c b/test/testmd5.c index a9355d20d..6d149d983 100644 --- a/test/testmd5.c +++ b/test/testmd5.c @@ -28,7 +28,7 @@ static struct { const char *string; const char *digest; -} md5sums[] = +} md5sums[] = { {"Jeff was here!", "\xa5\x25\x8a\x89\x11\xb2\x9d\x1f\x81\x75\x96\x3b\x60\x94\x49\xc0"}, @@ -58,7 +58,7 @@ static void test_md5sum(abts_case *tc, void *data) unsigned int len = (unsigned int)strlen(string); ABTS_ASSERT(tc, "apr_md5_init", (apr_md5_init(&context) == 0)); - ABTS_ASSERT(tc, "apr_md5_update", + ABTS_ASSERT(tc, "apr_md5_update", (apr_md5_update(&context, string, len) == 0)); ABTS_ASSERT(tc, "apr_md5_final", (apr_md5_final(digest, &context) == 0)); @@ -93,7 +93,7 @@ static void test_md5sum_unaligned(abts_case *tc, void *data) abts_suite *testmd5(abts_suite *suite) { suite = ADD_SUITE(suite); - + for (count=0; count < num_sums; count++) { abts_run_test(suite, test_md5sum, NULL); } diff --git a/test/testmemcache.c b/test/testmemcache.c index d9d3f4034..33e0e7c45 100644 --- a/test/testmemcache.c +++ b/test/testmemcache.c @@ -424,7 +424,7 @@ static void test_memcache_addreplace(abts_case * tc, void *data) ABTS_SKIP(tc, data, "Memcache server not found."); return; } - + rv = apr_memcache_create(pool, 1, 0, &memcache); ABTS_ASSERT(tc, "memcache create failed", rv == APR_SUCCESS); @@ -488,7 +488,7 @@ static void test_memcache_incrdecr(abts_case * tc, void *data) ABTS_SKIP(tc, data, "Memcache server not found."); return; } - + rv = apr_memcache_create(pool, 1, 0, &memcache); ABTS_ASSERT(tc, "memcache create failed", rv == APR_SUCCESS); diff --git a/test/testmmap.c b/test/testmmap.c index a50569c41..a54866438 100644 --- a/test/testmmap.c +++ b/test/testmmap.c @@ -81,7 +81,7 @@ static void test_file_close(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); thefile = NULL; } - + static void test_file_open(abts_case *tc, void *data) { apr_status_t rv; @@ -91,7 +91,7 @@ static void test_file_open(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, thefile); } - + static void test_get_filesize(abts_case *tc, void *data) { apr_status_t rv; diff --git a/test/testmutexscope.c b/test/testmutexscope.c index 8dc1afcaf..13950f5cd 100644 --- a/test/testmutexscope.c +++ b/test/testmutexscope.c @@ -121,7 +121,7 @@ static void test_mech_mode(apr_lockmech_e mech, const char *mech_name, assert(apr_thread_mutex_create(&thread_mutex, 0, p) == APR_SUCCESS); assert(apr_thread_mutex_lock(thread_mutex) == APR_SUCCESS); - + rv = lock_init(mech, test_mode); if (rv != APR_SUCCESS) { char errmsg[256]; @@ -170,7 +170,7 @@ static void test_mech_mode(apr_lockmech_e mech, const char *mech_name, printf(" no problem encountered...\n"); } } - + assert(apr_thread_mutex_unlock(thread_mutex) == APR_SUCCESS); i = 0; @@ -220,13 +220,13 @@ int main(void) ,{APR_LOCK_DEFAULT_TIMED, "default_timed"} }; int i; - + assert(apr_initialize() == APR_SUCCESS); for (i = 0; i < sizeof(lockmechs) / sizeof(lockmechs[0]); i++) { test_mech(lockmechs[i].mech, lockmechs[i].mech_name); } - + apr_terminate(); return 0; } diff --git a/test/testnames.c b/test/testnames.c index 4fcd3c033..00ec4116b 100644 --- a/test/testnames.c +++ b/test/testnames.c @@ -54,7 +54,7 @@ static void merge_belowroot(abts_case *tc, void *data) apr_status_t rv; char *dstpath = NULL; - rv = apr_filepath_merge(&dstpath, ABS_ROOT"foo", ABS_ROOT"foo/bar", + rv = apr_filepath_merge(&dstpath, ABS_ROOT"foo", ABS_ROOT"foo/bar", APR_FILEPATH_NOTABOVEROOT, p); ABTS_PTR_NOTNULL(tc, dstpath); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -101,13 +101,13 @@ static void merge_dotdot_dotdot_dotdot(abts_case *tc, void *data) apr_status_t rv; char *dstpath = NULL; - rv = apr_filepath_merge(&dstpath, "", + rv = apr_filepath_merge(&dstpath, "", "../../..", APR_FILEPATH_TRUENAME, p); ABTS_PTR_NOTNULL(tc, dstpath); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, "../../..", dstpath); - rv = apr_filepath_merge(&dstpath, "", + rv = apr_filepath_merge(&dstpath, "", "../../../", APR_FILEPATH_TRUENAME, p); ABTS_PTR_NOTNULL(tc, dstpath); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -143,7 +143,7 @@ static void merge_notrelfail(abts_case *tc, void *data) char *dstpath = NULL; char errmsg[256]; - rv = apr_filepath_merge(&dstpath, "foo/bar", "../baz", + rv = apr_filepath_merge(&dstpath, "foo/bar", "../baz", APR_FILEPATH_NOTRELATIVE, p); apr_strerror(rv, errmsg, sizeof(errmsg)); @@ -158,7 +158,7 @@ static void merge_notabsfail(abts_case *tc, void *data) char *dstpath = NULL; char errmsg[256]; - rv = apr_filepath_merge(&dstpath, ABS_ROOT"foo/bar", "../baz", + rv = apr_filepath_merge(&dstpath, ABS_ROOT"foo/bar", "../baz", APR_FILEPATH_NOTABSOLUTE, p); apr_strerror(rv, errmsg, sizeof(errmsg)); @@ -172,7 +172,7 @@ static void merge_notabs(abts_case *tc, void *data) apr_status_t rv; char *dstpath = NULL; - rv = apr_filepath_merge(&dstpath, "foo/bar", "../baz", + rv = apr_filepath_merge(&dstpath, "foo/bar", "../baz", APR_FILEPATH_NOTABSOLUTE, p); ABTS_PTR_NOTNULL(tc, dstpath); @@ -338,7 +338,7 @@ static void root_from_cwd_and_back(abts_case *tc, void *data) ABTS_STR_EQUAL(tc, origpath + 1, path); #endif - rv = apr_filepath_merge(&testpath, root, path, + rv = apr_filepath_merge(&testpath, root, path, APR_FILEPATH_TRUENAME | APR_FILEPATH_NOTABOVEROOT | APR_FILEPATH_NOTRELATIVE, p); @@ -346,7 +346,7 @@ static void root_from_cwd_and_back(abts_case *tc, void *data) #if defined(WIN32) || defined(OS2) || defined(NETWARE) hadfailed = tc->failed; #endif - /* The API doesn't promise equality!!! + /* 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, * but translate this back to success. diff --git a/test/testoc.c b/test/testoc.c index 923bd4b6d..a98fba78a 100644 --- a/test/testoc.c +++ b/test/testoc.c @@ -29,19 +29,19 @@ static void ocmaint(int reason, void *data, int status) { switch (reason) { case APR_OC_REASON_DEATH: - apr_cpystrn(reasonstr, "APR_OC_REASON_DEATH", + apr_cpystrn(reasonstr, "APR_OC_REASON_DEATH", strlen("APR_OC_REASON_DEATH") + 1); break; case APR_OC_REASON_LOST: - apr_cpystrn(reasonstr, "APR_OC_REASON_LOST", + apr_cpystrn(reasonstr, "APR_OC_REASON_LOST", strlen("APR_OC_REASON_LOST") + 1); break; case APR_OC_REASON_UNWRITABLE: - apr_cpystrn(reasonstr, "APR_OC_REASON_UNWRITEABLE", + apr_cpystrn(reasonstr, "APR_OC_REASON_UNWRITEABLE", strlen("APR_OC_REASON_UNWRITEABLE") + 1); break; case APR_OC_REASON_RESTART: - apr_cpystrn(reasonstr, "APR_OC_REASON_RESTART", + apr_cpystrn(reasonstr, "APR_OC_REASON_RESTART", strlen("APR_OC_REASON_RESTART") + 1); break; } @@ -69,7 +69,7 @@ static void test_child_kill(abts_case *tc, void *data) rv = apr_procattr_create(&procattr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_procattr_io_set(procattr, APR_FULL_BLOCK, APR_NO_PIPE, + rv = apr_procattr_io_set(procattr, APR_FULL_BLOCK, APR_NO_PIPE, APR_NO_PIPE); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -89,13 +89,13 @@ static void test_child_kill(abts_case *tc, void *data) apr_sleep(apr_time_from_sec(1)); rv = apr_proc_kill(&newproc, SIGKILL); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - + /* allow time for things to settle... */ apr_sleep(apr_time_from_sec(3)); - + apr_proc_other_child_refresh_all(APR_OC_REASON_RUNNING); ABTS_STR_EQUAL(tc, "APR_OC_REASON_DEATH", reasonstr); -} +} #else static void oc_not_impl(abts_case *tc, void *data) @@ -112,7 +112,7 @@ abts_suite *testoc(abts_suite *suite) abts_run_test(suite, oc_not_impl, NULL); #else - abts_run_test(suite, test_child_kill, NULL); + abts_run_test(suite, test_child_kill, NULL); #endif return suite; diff --git a/test/testpass.c b/test/testpass.c index e11fe81cb..069f5fbd7 100644 --- a/test/testpass.c +++ b/test/testpass.c @@ -48,7 +48,7 @@ static struct { { /* passwords and hashes created with Apache's htpasswd utility like this: - + htpasswd -c -b passwords pass1 pass1 htpasswd -b passwords pass2 pass2 htpasswd -b passwords pass3 pass3 @@ -183,7 +183,7 @@ static void test_bcryptpass(abts_case *tc, void *data) const char *hash2 = "$2a$08$qipUJiI9fySUN38hcbz.lucXvAmtgowKOWYtB9y3CXyl6lTknruou"; const char *pass3 = "foobar"; - APR_ASSERT_SUCCESS(tc, "bcrypt encode password", + APR_ASSERT_SUCCESS(tc, "bcrypt encode password", apr_bcrypt_encode(pass, 5, salt, sizeof(salt), hash, sizeof(hash))); @@ -200,7 +200,7 @@ abts_suite *testpass(abts_suite *suite) { suite = ADD_SUITE(suite); -#if CRYPT_ALGO_SUPPORTED +#if CRYPT_ALGO_SUPPORTED abts_run_test(suite, test_crypt, NULL); #if APR_HAS_THREADS abts_run_test(suite, test_threadsafe, NULL); @@ -212,6 +212,6 @@ abts_suite *testpass(abts_suite *suite) #ifdef GLIBCSHA_ALGO_SUPPORTED abts_run_test(suite, test_glibc_shapass, NULL); #endif - + return suite; } diff --git a/test/testpipe.c b/test/testpipe.c index 4965d57de..2f9dafbfa 100644 --- a/test/testpipe.c +++ b/test/testpipe.c @@ -35,7 +35,7 @@ static void create_pipe(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, readp); ABTS_PTR_NOTNULL(tc, writep); -} +} static void close_pipe(abts_case *tc, void *data) { @@ -49,7 +49,7 @@ static void close_pipe(abts_case *tc, void *data) rv = apr_file_read(readp, buf, &nbytes); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_EBADF(rv)); -} +} static void set_timeout(abts_case *tc, void *data) { @@ -70,7 +70,7 @@ static void set_timeout(abts_case *tc, void *data) rv = apr_file_pipe_timeout_get(readp, &timeout); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - ABTS_ASSERT(tc, "Timeout mismatch, expected 1 second", + ABTS_ASSERT(tc, "Timeout mismatch, expected 1 second", timeout == apr_time_from_sec(1)); } @@ -79,7 +79,7 @@ static void read_write(abts_case *tc, void *data) apr_status_t rv; char *buf; apr_size_t nbytes; - + nbytes = strlen("this is a test"); buf = (char *)apr_palloc(p, nbytes + 1); @@ -104,7 +104,7 @@ static void read_write_notimeout(abts_case *tc, void *data) char *buf = "this is a test"; char *input; apr_size_t nbytes; - + nbytes = strlen("this is a test"); rv = apr_file_pipe_create(&readp, &writep, p); @@ -138,7 +138,7 @@ static void test_pipe_writefull(abts_case *tc, void *data) const char *args[2]; apr_status_t rv; apr_exit_why_e why; - + rv = apr_procattr_create(&procattr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -173,7 +173,7 @@ static void test_pipe_writefull(abts_case *tc, void *data) rv = apr_file_close(proc.in); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - + nbytes = sizeof(responsebuf); rv = apr_file_read(proc.out, responsebuf, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -182,7 +182,7 @@ static void test_pipe_writefull(abts_case *tc, void *data) ABTS_ASSERT(tc, "wait for child process", apr_proc_wait(&proc, NULL, &why, APR_WAIT) == APR_CHILD_DONE); - + ABTS_ASSERT(tc, "child terminated normally", why == APR_PROC_EXIT); } diff --git a/test/testpoll.c b/test/testpoll.c index fe3520137..f22ec9253 100644 --- a/test/testpoll.c +++ b/test/testpoll.c @@ -47,7 +47,7 @@ static apr_pollfd_t *pollarray_large; */ static int default_pollset_impl = APR_POLLSET_DEFAULT; -static void make_socket(apr_socket_t **sock, apr_sockaddr_t **sa, +static void make_socket(apr_socket_t **sock, apr_sockaddr_t **sa, apr_port_t port, apr_pool_t *p, abts_case *tc) { apr_status_t rv; @@ -63,15 +63,15 @@ static void make_socket(apr_socket_t **sock, apr_sockaddr_t **sa, } #ifdef OLD_POLL_INTERFACE -static void check_sockets(const apr_pollfd_t *pollarray, - apr_socket_t **sockarray, int which, int pollin, +static void check_sockets(const apr_pollfd_t *pollarray, + apr_socket_t **sockarray, int which, int pollin, abts_case *tc) { apr_status_t rv; apr_int16_t event; char *str; - rv = apr_poll_revents_get(&event, sockarray[which], + rv = apr_poll_revents_get(&event, sockarray[which], (apr_pollfd_t *)pollarray); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); if (pollin) { @@ -99,7 +99,7 @@ static void send_msg(apr_socket_t **sockarray, apr_sockaddr_t **sas, int which, ABTS_SIZE_EQUAL(tc, strlen("hello"), len); } -static void recv_msg(apr_socket_t **sockarray, int which, apr_pool_t *p, +static void recv_msg(apr_socket_t **sockarray, int which, apr_pool_t *p, abts_case *tc) { apr_size_t buflen = 5; @@ -117,7 +117,7 @@ static void recv_msg(apr_socket_t **sockarray, int which, apr_pool_t *p, ABTS_STR_EQUAL(tc, "hello", buffer); } - + static void create_all_sockets(abts_case *tc, void *data) { int i; @@ -126,7 +126,7 @@ static void create_all_sockets(abts_case *tc, void *data) make_socket(&s[i], &sa[i], 7777 + i, p, tc); } } - + #ifdef OLD_POLL_INTERFACE static void setup_small_poll(abts_case *tc, void *data) { @@ -135,7 +135,7 @@ static void setup_small_poll(abts_case *tc, void *data) rv = apr_poll_setup(&pollarray, SMALL_NUM_SOCKETS, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - + for (i = 0; i < SMALL_NUM_SOCKETS;i++){ ABTS_INT_EQUAL(tc, 0, pollarray[i].reqevents); ABTS_INT_EQUAL(tc, 0, pollarray[i].rtnevents); @@ -153,7 +153,7 @@ static void setup_large_poll(abts_case *tc, void *data) rv = apr_poll_setup(&pollarray_large, LARGE_NUM_SOCKETS, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - + for (i = 0; i < LARGE_NUM_SOCKETS;i++){ ABTS_INT_EQUAL(tc, 0, pollarray_large[i].reqevents); ABTS_INT_EQUAL(tc, 0, pollarray_large[i].rtnevents); @@ -257,7 +257,7 @@ static void send_large_pollarray(abts_case *tc, void *data) send_msg(s, sa, LARGE_NUM_SOCKETS - 1, tc); - rv = apr_poll(pollarray_large, LARGE_NUM_SOCKETS, &lrv, + rv = apr_poll(pollarray_large, LARGE_NUM_SOCKETS, &lrv, 2 * APR_USEC_PER_SEC); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -279,7 +279,7 @@ static void recv_large_pollarray(abts_case *tc, void *data) recv_msg(s, LARGE_NUM_SOCKETS - 1, p, tc); - rv = apr_poll(pollarray_large, LARGE_NUM_SOCKETS, &lrv, + rv = apr_poll(pollarray_large, LARGE_NUM_SOCKETS, &lrv, 2 * APR_USEC_PER_SEC); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv)); @@ -350,7 +350,7 @@ static void multi_event_pollset(abts_case *tc, void *data) rv = apr_pollset_remove(pollset, &socket_pollfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } - + static void add_sockets_pollset(abts_case *tc, void *data) { apr_status_t rv; @@ -416,7 +416,7 @@ static void send_middle_pollset(abts_case *tc, void *data) apr_status_t rv; const apr_pollfd_t *descs = NULL; int num; - + send_msg(s, sa, 2, tc); send_msg(s, sa, 5, tc); rv = apr_pollset_poll(pollset, -1, &num, &descs); @@ -454,7 +454,7 @@ static void send_last_pollset(abts_case *tc, void *data) apr_status_t rv; const apr_pollfd_t *descs = NULL; int num; - + send_msg(s, sa, LARGE_NUM_SOCKETS - 1, tc); rv = apr_pollset_poll(pollset, -1, &num, &descs); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -546,7 +546,7 @@ static void pollset_remove(abts_case *tc, void *data) ABTS_PTR_EQUAL(tc, s[2], hot_files[1].desc.s); ABTS_PTR_EQUAL(tc, (void *)4, hot_files[2].client_data); ABTS_PTR_EQUAL(tc, s[3], hot_files[2].desc.s); - + /* now remove the pollset elements referring to desc s[2] */ pfd.desc.s = s[2]; pfd.client_data = (void *)999; /* not used on this call */ @@ -607,7 +607,7 @@ static void trigger_pollcb(abts_case *tc, void *data) apr_status_t rv; apr_pollfd_t socket_pollfd; pollcb_baton_t pcb; - + POLLCB_PREREQ; ABTS_PTR_NOTNULL(tc, s[0]); @@ -617,7 +617,7 @@ static void trigger_pollcb(abts_case *tc, void *data) socket_pollfd.client_data = s[0]; rv = apr_pollcb_add(pollcb, &socket_pollfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - + send_msg(s, sa, 0, tc); pcb.tc = tc; pcb.count = 0; @@ -639,7 +639,7 @@ static void timeout_pollcb(abts_case *tc, void *data) pcb.count = 0; pcb.tc = tc; - rv = apr_pollcb_poll(pollcb, 1, trigger_pollcb_cb, &pcb); + rv = apr_pollcb_poll(pollcb, 1, trigger_pollcb_cb, &pcb); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv)); ABTS_INT_EQUAL(tc, 0, pcb.count); } @@ -653,7 +653,7 @@ static void timeout_pollin_pollcb(abts_case *tc, void *data) POLLCB_PREREQ; recv_msg(s, 0, p, tc); - + ABTS_PTR_NOTNULL(tc, s[0]); socket_pollfd.desc_type = APR_POLL_SOCKET; socket_pollfd.reqevents = APR_POLLIN; @@ -661,11 +661,11 @@ static void timeout_pollin_pollcb(abts_case *tc, void *data) socket_pollfd.client_data = s[0]; rv = apr_pollcb_add(pollcb, &socket_pollfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - + pcb.count = 0; pcb.tc = tc; - - rv = apr_pollcb_poll(pollcb, 1, trigger_pollcb_cb, &pcb); + + rv = apr_pollcb_poll(pollcb, 1, trigger_pollcb_cb, &pcb); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv)); ABTS_INT_EQUAL(tc, 0, pcb.count); @@ -688,7 +688,7 @@ static void pollset_default(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, APR_SUCCESS, rv1); ABTS_PTR_NOTNULL(tc, pollset); - + rv1 = apr_pollset_create_ex(&pollset, 1, p, 0, APR_POLLSET_KQUEUE); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv1); ABTS_PTR_NOTNULL(tc, pollset); @@ -705,13 +705,13 @@ static void pollset_default(abts_case *tc, void *data) if (rv1 == APR_SUCCESS) { ABTS_PTR_NOTNULL(tc, pollset); } - + rv2 = apr_pollset_create_ex(&pollset, 1, p, APR_POLLSET_NODEFAULT, APR_POLLSET_KQUEUE); if (rv2 == APR_SUCCESS) { ABTS_PTR_NOTNULL(tc, pollset); } - + ABTS_ASSERT(tc, "failure using APR_POLLSET_NODEFAULT with unsupported method", rv1 != APR_SUCCESS || rv2 != APR_SUCCESS); @@ -736,7 +736,7 @@ static void pollcb_default(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, APR_SUCCESS, rv1); ABTS_PTR_NOTNULL(tc, pollcb); - + rv1 = apr_pollcb_create_ex(&pollcb, 1, p, 0, APR_POLLSET_KQUEUE); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv1); ABTS_PTR_NOTNULL(tc, pollcb); @@ -753,13 +753,13 @@ static void pollcb_default(abts_case *tc, void *data) if (rv1 == APR_SUCCESS) { ABTS_PTR_NOTNULL(tc, pollcb); } - + rv2 = apr_pollcb_create_ex(&pollcb, 1, p, APR_POLLSET_NODEFAULT, APR_POLLSET_KQUEUE); if (rv2 == APR_SUCCESS) { ABTS_PTR_NOTNULL(tc, pollcb); } - + ABTS_ASSERT(tc, "failure using APR_POLLSET_NODEFAULT with unsupported method", rv1 != APR_SUCCESS || rv2 != APR_SUCCESS); diff --git a/test/testpools.c b/test/testpools.c index c92a3f95a..3a633b1ca 100644 --- a/test/testpools.c +++ b/test/testpools.c @@ -36,7 +36,7 @@ static void alloc_bytes(abts_case *tc, void *data) { int i; char *alloc; - + alloc = apr_palloc(pmain, ALLOC_BYTES); ABTS_PTR_NOTNULL(tc, alloc); @@ -54,7 +54,7 @@ static void calloc_bytes(abts_case *tc, void *data) { int i; char *alloc; - + alloc = apr_pcalloc(pmain, ALLOC_BYTES); ABTS_PTR_NOTNULL(tc, alloc); @@ -109,7 +109,7 @@ static char *another_data = "Hello again, world."; static apr_status_t another_cleanup(void *data) { return data == another_data ? APR_SUCCESS : APR_EGENERAL; -} +} /* A few places in httpd modify the cleanup list for a pool while * cleanups are being run. An example is close_listeners_on_exec -> @@ -121,7 +121,7 @@ static apr_status_t another_cleanup(void *data) static apr_status_t dodgy_cleanup(void *data) { apr_pool_t *p = data; - + return apr_pool_cleanup_run(p, another_data, another_cleanup); } @@ -136,7 +136,7 @@ static void test_cleanups(abts_case *tc, void *data) success_cleanup); apr_pool_cleanup_register(pchild, checker_data, checker_cleanup, success_cleanup); - apr_pool_cleanup_register(pchild, NULL, checker_cleanup, + apr_pool_cleanup_register(pchild, NULL, checker_cleanup, success_cleanup); apr_pool_cleanup_register(pchild, another_data, another_cleanup, another_cleanup); diff --git a/test/testproc.c b/test/testproc.c index f62a5f9a8..cd8ccf9c2 100644 --- a/test/testproc.c +++ b/test/testproc.c @@ -41,7 +41,7 @@ static void test_create_proc(abts_case *tc, void *data) rv = apr_procattr_create(&attr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_procattr_io_set(attr, APR_FULL_BLOCK, APR_FULL_BLOCK, + rv = apr_procattr_io_set(attr, APR_FULL_BLOCK, APR_FULL_BLOCK, APR_NO_PIPE); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -53,8 +53,8 @@ static void test_create_proc(abts_case *tc, void *data) args[0] = "proc_child" EXTENSION; args[1] = NULL; - - rv = apr_proc_create(&newproc, proc_child, args, NULL, + + rv = apr_proc_create(&newproc, proc_child, args, NULL, attr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -130,7 +130,7 @@ static void test_file_redir(abts_case *tc, void *data) args[0] = "proc_child"; args[1] = NULL; - rv = apr_proc_create(&newproc, proc_child, args, NULL, + rv = apr_proc_create(&newproc, proc_child, args, NULL, attr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); diff --git a/test/testprocmutex.c b/test/testprocmutex.c index 24cc44189..573942bca 100644 --- a/test/testprocmutex.c +++ b/test/testprocmutex.c @@ -106,7 +106,7 @@ static void make_child(abts_case *tc, int trylock, apr_proc_t **proc, apr_pool_t exit(1); } while (i < MAX_ITER); exit(0); - } + } ABTS_ASSERT(tc, "fork failed", rv == APR_INPARENT); } @@ -123,22 +123,22 @@ static void await_child(abts_case *tc, apr_proc_t *proc) rv == APR_CHILD_DONE && why == APR_PROC_EXIT && code == 0); } -static void test_exclusive(abts_case *tc, const char *lockname, +static void test_exclusive(abts_case *tc, const char *lockname, lockmech_t *mech) { apr_proc_t *child[CHILDREN]; apr_status_t rv; int n; - + rv = apr_proc_mutex_create(&proc_lock, lockname, mech->num, p); APR_ASSERT_SUCCESS(tc, "create the mutex", rv); - + for (n = 0; n < CHILDREN; n++) make_child(tc, 0, &child[n], p); for (n = 0; n < CHILDREN; n++) await_child(tc, child[n]); - + ABTS_ASSERT(tc, "Locks don't appear to work", *x == MAX_COUNTER); rv = apr_proc_mutex_trylock(proc_lock); @@ -174,7 +174,7 @@ static void test_exclusive(abts_case *tc, const char *lockname, for (n = 0; n < CHILDREN; n++) await_child(tc, child[n]); - + ABTS_ASSERT(tc, "Locks don't appear to work with trylock", *x == MAX_COUNTER); } @@ -211,7 +211,7 @@ static void test_exclusive(abts_case *tc, const char *lockname, for (n = 0; n < CHILDREN; n++) await_child(tc, child[n]); - + ABTS_ASSERT(tc, "Locks don't appear to work with timedlock", *x == MAX_COUNTER); } diff --git a/test/testredis.c b/test/testredis.c index c91fa6fc8..c7fc7dda5 100644 --- a/test/testredis.c +++ b/test/testredis.c @@ -61,7 +61,7 @@ static const char txt[] = * this datatype is for our custom server determination function. this might * be useful if you don't want to rely on simply hashing keys to determine * where a key belongs, but instead want to write something fancy, or use some - * other kind of configuration data, i.e. a hash plus some data about a + * other kind of configuration data, i.e. a hash plus some data about a * namespace, or whatever. see my_server_func, and test_redis_user_funcs * for the examples. */ @@ -71,7 +71,7 @@ typedef struct { } my_hash_server_baton; -/* this could do something fancy and return some hash result. +/* this could do something fancy and return some hash result. * for simplicity, just return the same value, so we can test it later on. * if you wanted to use some external hashing library or functions for * consistent hashing, for example, this would be a good place to do it. @@ -86,7 +86,7 @@ static apr_uint32_t my_hash_func(void *baton, const char *data, /* * a fancy function to determine which server to use given some kind of data * and a hash value. this example actually ignores the hash value itself - * and pulls some number from the *baton, which is a struct that has some + * and pulls some number from the *baton, which is a struct that has some * kind of meaningful stuff in it. */ static apr_redis_server_t *my_server_func(void *baton, @@ -98,7 +98,7 @@ static apr_redis_server_t *my_server_func(void *baton, if(mc->ntotal == 0) { return NULL; - } + } if(mc->ntotal < mhsb->which_server) { return NULL; @@ -238,40 +238,40 @@ static void test_redis_create(abts_case * tc, void *data) rv = apr_redis_create(pool, max_servers, 0, &redis); ABTS_ASSERT(tc, "redis create failed", rv == APR_SUCCESS); - + for (i = 1; i <= max_servers; i++) { apr_port_t port; - + port = PORT + i; rv = apr_redis_server_create(pool, HOST, PORT + i, 0, 1, 1, 60, 60, &server); ABTS_ASSERT(tc, "server create failed", rv == APR_SUCCESS); - + rv = apr_redis_add_server(redis, server); ABTS_ASSERT(tc, "server add failed", rv == APR_SUCCESS); - + s = apr_redis_find_server(redis, HOST, port); ABTS_PTR_EQUAL(tc, server, s); - + rv = apr_redis_disable_server(redis, s); ABTS_ASSERT(tc, "server disable failed", rv == APR_SUCCESS); - + rv = apr_redis_enable_server(redis, s); ABTS_ASSERT(tc, "server enable failed", rv == APR_SUCCESS); - + hash = apr_redis_hash(redis, prefix, strlen(prefix)); ABTS_ASSERT(tc, "hash failed", hash > 0); - + s = apr_redis_find_server_hash(redis, hash); ABTS_PTR_NOTNULL(tc, s); } rv = apr_redis_server_create(pool, HOST, PORT, 0, 1, 1, 60, 60, &server); ABTS_ASSERT(tc, "server create failed", rv == APR_SUCCESS); - + rv = apr_redis_add_server(redis, server); ABTS_ASSERT(tc, "server add should have failed", rv != APR_SUCCESS); - + } /* install our own custom hashing and server selection routines. */ @@ -279,13 +279,13 @@ static void test_redis_create(abts_case * tc, void *data) static int create_test_hash(apr_pool_t *p, apr_hash_t *h) { int i; - + for (i = 0; i < TDATA_SIZE; i++) { char *k, *v; - + k = apr_pstrcat(p, prefix, apr_itoa(p, i), NULL); v = apr_pstrndup(p, txt, randval((apr_uint32_t)strlen(txt))); - + apr_hash_set(h, k, APR_HASH_KEY_STRING, v); } @@ -301,7 +301,7 @@ static void test_redis_user_funcs(abts_case * tc, void *data) apr_uint32_t max_servers = 10; apr_uint32_t hres; apr_uint32_t i; - my_hash_server_baton *baton = + my_hash_server_baton *baton = apr_pcalloc(pool, sizeof(my_hash_server_baton)); if (!has_redis_server()) { @@ -312,7 +312,7 @@ static void test_redis_user_funcs(abts_case * tc, void *data) rv = apr_redis_create(pool, max_servers, 0, &redis); ABTS_ASSERT(tc, "redis create failed", rv == APR_SUCCESS); - /* as noted above, install our custom hash function, and call + /* as noted above, install our custom hash function, and call * apr_redis_hash. the return value should be our predefined number, * and our function just ignores the other args, for simplicity. */ @@ -320,20 +320,20 @@ static void test_redis_user_funcs(abts_case * tc, void *data) hres = apr_redis_hash(redis, "whatever", sizeof("whatever") - 1); ABTS_INT_EQUAL(tc, HASH_FUNC_RESULT, hres); - + /* add some servers */ for(i = 1; i <= 10; i++) { apr_redis_server_t *ms; rv = apr_redis_server_create(pool, HOST, i, 0, 1, 1, 60, 60, &ms); ABTS_ASSERT(tc, "server create failed", rv == APR_SUCCESS); - + rv = apr_redis_add_server(redis, ms); ABTS_ASSERT(tc, "server add failed", rv == APR_SUCCESS); } - /* - * set 'which_server' in our server_baton to find the third server + /* + * set 'which_server' in our server_baton to find the third server * which should have the same port. */ baton->which_server = 3; @@ -373,7 +373,7 @@ static void test_redis_meta(abts_case * tc, void *data) apr_redis_stats(server, p, &stats); ABTS_PTR_NOTNULL(tc, stats); - /* + /* * no way to know exactly what will be in most of these, so * just make sure there is something. */ @@ -418,19 +418,19 @@ static void test_redis_incrdecr(abts_case * tc, void *data) ABTS_SKIP(tc, data, "Redis server not found."); return; } - + rv = apr_redis_create(pool, 1, 0, &redis); ABTS_ASSERT(tc, "redis create failed", rv == APR_SUCCESS); - + rv = apr_redis_server_create(pool, HOST, PORT, 0, 1, 1, 60, 60, &server); ABTS_ASSERT(tc, "server create failed", rv == APR_SUCCESS); - + rv = apr_redis_add_server(redis, server); ABTS_ASSERT(tc, "server add failed", rv == APR_SUCCESS); rv = apr_redis_set(redis, prefix, "271", sizeof("271") - 1, 27); ABTS_ASSERT(tc, "set failed", rv == APR_SUCCESS); - + for( i = 1; i <= TDATA_SIZE; i++) { apr_uint32_t expect; diff --git a/test/testshm.c b/test/testshm.c index 12b6f3542..c04ec1848 100644 --- a/test/testshm.c +++ b/test/testshm.c @@ -182,7 +182,7 @@ static void test_named(abts_case *tc, void *data) APR_ASSERT_SUCCESS(tc, "Couldn't set copy environment", rv); args[0] = apr_pstrdup(p, "testshmconsumer" EXTENSION); - rv = apr_proc_create(&pidconsumer, TESTBINPATH "testshmconsumer" EXTENSION, args, + rv = apr_proc_create(&pidconsumer, TESTBINPATH "testshmconsumer" EXTENSION, args, NULL, attr2, p); APR_ASSERT_SUCCESS(tc, "Couldn't launch consumer", rv); @@ -198,9 +198,9 @@ static void test_named(abts_case *tc, void *data) * This way, if they didn't succeed, we can just run this test again * without having to cleanup manually. */ - APR_ASSERT_SUCCESS(tc, "Error destroying shared memory", + APR_ASSERT_SUCCESS(tc, "Error destroying shared memory", apr_shm_destroy(shm)); - + ABTS_INT_EQUAL(tc, sent, received); } @@ -298,9 +298,9 @@ abts_suite *testshm(abts_suite *suite) #if APR_HAS_FORK abts_run_test(suite, test_anon, NULL); #endif - abts_run_test(suite, test_named, NULL); - abts_run_test(suite, test_named_remove, NULL); - abts_run_test(suite, test_named_delete, NULL); + abts_run_test(suite, test_named, NULL); + abts_run_test(suite, test_named_remove, NULL); + abts_run_test(suite, test_named_delete, NULL); #endif return suite; diff --git a/test/testshmconsumer.c b/test/testshmconsumer.c index bf70e728c..adde4fc16 100644 --- a/test/testshmconsumer.c +++ b/test/testshmconsumer.c @@ -38,7 +38,7 @@ int main(void) int recvd; apr_initialize(); - + if (apr_pool_create(&pool, NULL) != APR_SUCCESS) { exit(-1); } @@ -66,7 +66,7 @@ int main(void) int main(void) { /* Just return, this program will never be called, so we don't need - * to print a message + * to print a message */ return 0; } diff --git a/test/testshmproducer.c b/test/testshmproducer.c index eb61e76b9..ad8cff898 100644 --- a/test/testshmproducer.c +++ b/test/testshmproducer.c @@ -39,7 +39,7 @@ int main(void) int sent = 0; apr_initialize(); - + if (apr_pool_create(&pool, NULL) != APR_SUCCESS) { exit(-1); } diff --git a/test/testskiplist.c b/test/testskiplist.c index e698dfc0a..9101c0ec1 100644 --- a/test/testskiplist.c +++ b/test/testskiplist.c @@ -337,7 +337,7 @@ static int ecomp(void *a, void *b) * Using apr_skiplist_remove_compare(..., scomp, NULL) would not work because * it will likely remove any duplicate (the first one) encountered on the path, * hence possibly not the expected one. - * + * * Using apr_skiplist_remove_compare(..., ecomp, NULL) works provided all the * duplicates (same a) don't also have the same b (which is the case in the * test below), hence uniqueness is cooked in the elem itself. @@ -385,7 +385,7 @@ static void skiplist_test(abts_case *tc, void *data) { ABTS_INT_EQUAL(tc, APR_SUCCESS, apr_skiplist_init(&list, ptmp)); apr_skiplist_set_compare(list, comp, comp); - + /* insert 10 objects */ for (i = 0; i < test_elems; ++i){ add_int_to_skiplist(tc, list, i); @@ -412,7 +412,7 @@ static void skiplist_test(abts_case *tc, void *data) { add_int_to_skiplist(tc, list, 42); val = apr_skiplist_pop(list, NULL); - ABTS_INT_EQUAL(tc, *val, 42); + ABTS_INT_EQUAL(tc, *val, 42); /* empty */ val = apr_skiplist_pop(list, NULL); diff --git a/test/testsock.c b/test/testsock.c index 23a0073fe..74bb66c7e 100644 --- a/test/testsock.c +++ b/test/testsock.c @@ -59,7 +59,7 @@ static void launch_child(abts_case *tc, apr_proc_t *proc, const char *arg1, apr_ APR_ASSERT_SUCCESS(tc, "Couldn't launch program", rv); } -static int wait_child(abts_case *tc, apr_proc_t *proc) +static int wait_child(abts_case *tc, apr_proc_t *proc) { int exitcode; apr_exit_why_e why; @@ -181,11 +181,11 @@ static apr_socket_t *setup_socket(abts_case *tc) rv = apr_socket_opt_set(sock, APR_SO_REUSEADDR, 1); APR_ASSERT_SUCCESS(tc, "Could not set REUSEADDR on socket", rv); - + rv = apr_socket_bind(sock, sa); APR_ASSERT_SUCCESS(tc, "Problem binding to port", rv); if (rv) return NULL; - + rv = apr_socket_listen(sock, 5); APR_ASSERT_SUCCESS(tc, "Problem listening on socket", rv); @@ -196,9 +196,9 @@ static void test_create_bind_listen(abts_case *tc, void *data) { apr_status_t rv; apr_socket_t *sock = setup_socket(tc); - + if (!sock) return; - + rv = apr_socket_close(sock); APR_ASSERT_SUCCESS(tc, "Problem closing socket", rv); } @@ -216,13 +216,13 @@ static void test_send(abts_case *tc, void *data) if (!sock) return; launch_child(tc, &proc, "read", p); - + rv = apr_socket_accept(&sock2, sock, p); APR_ASSERT_SUCCESS(tc, "Problem with receiving connection", rv); apr_socket_protocol_get(sock2, &protocol); ABTS_INT_EQUAL(tc, APR_PROTO_TCP, protocol); - + length = strlen(DATASTR); apr_socket_send(sock2, DATASTR, &length); @@ -244,18 +244,18 @@ static void test_recv(abts_case *tc, void *data) int protocol; apr_size_t length = STRLEN; char datastr[STRLEN]; - + sock = setup_socket(tc); if (!sock) return; launch_child(tc, &proc, "write", p); - + rv = apr_socket_accept(&sock2, sock, p); APR_ASSERT_SUCCESS(tc, "Problem with receiving connection", rv); apr_socket_protocol_get(sock2, &protocol); ABTS_INT_EQUAL(tc, APR_PROTO_TCP, protocol); - + memset(datastr, 0, STRLEN); apr_socket_recv(sock2, datastr, &length); @@ -338,19 +338,19 @@ static void test_timeout(abts_case *tc, void *data) apr_proc_t proc; int protocol; int exit; - + sock = setup_socket(tc); if (!sock) return; launch_child(tc, &proc, "read", p); - + rv = apr_socket_accept(&sock2, sock, p); APR_ASSERT_SUCCESS(tc, "Problem with receiving connection", rv); apr_socket_protocol_get(sock2, &protocol); ABTS_INT_EQUAL(tc, APR_PROTO_TCP, protocol); - - exit = wait_child(tc, &proc); + + exit = wait_child(tc, &proc); ABTS_INT_EQUAL(tc, SOCKET_TIMEOUT, exit); /* We didn't write any data, so make sure the child program returns @@ -389,10 +389,10 @@ static void test_print_addr(abts_case *tc, void *data) ABTS_INT_NEQUAL(tc, 0, rc); memset(buf, 'z', sizeof buf); - + APR_ASSERT_SUCCESS(tc, "could not get IP address", apr_sockaddr_ip_getbuf(buf, 22, sa)); - + ABTS_STR_EQUAL(tc, "0.0.0.0", buf); } #endif @@ -443,7 +443,7 @@ static void test_get_addr(abts_case *tc, void *data) APR_ASSERT_SUCCESS(tc, "accept connection", apr_socket_accept(&sd, ld, subp)); - + { /* wait for writability */ apr_pollfd_t pfd; @@ -488,7 +488,7 @@ static void test_get_addr(abts_case *tc, void *data) ABTS_PTR_EQUAL(tc, subp, sa->pool); ABTS_PTR_EQUAL(tc, subp, ca->pool); - + apr_socket_close(cd); apr_socket_close(sd); apr_socket_close(ld); @@ -614,11 +614,11 @@ static void test_freebind(abts_case *tc, void *data) apr_socket_t *sock; apr_sockaddr_t *sa; apr_int32_t on; - + /* RFC 5737 address */ rv = apr_sockaddr_info_get(&sa, "192.0.2.1", APR_INET, 8080, 0, p); APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv); - + rv = apr_socket_create(&sock, sa->family, SOCK_STREAM, APR_PROTO_TCP, p); APR_ASSERT_SUCCESS(tc, "Problem creating socket", rv); @@ -627,14 +627,14 @@ static void test_freebind(abts_case *tc, void *data) rv = apr_socket_opt_set(sock, APR_SO_FREEBIND, 1); APR_ASSERT_SUCCESS(tc, "Could not enable FREEBIND option", rv); - + rv = apr_socket_opt_get(sock, APR_SO_FREEBIND, &on); APR_ASSERT_SUCCESS(tc, "Could not retrieve FREEBIND option", rv); ABTS_INT_EQUAL(tc, 1, on); - + rv = apr_socket_bind(sock, sa); APR_ASSERT_SUCCESS(tc, "Problem binding to port with FREEBIND", rv); - + rv = apr_socket_close(sock); APR_ASSERT_SUCCESS(tc, "Problem closing socket", rv); #endif @@ -648,7 +648,7 @@ static void test_freebind(abts_case *tc, void *data) /* ... fill in other platforms here */ #endif -#ifdef TEST_ZONE_NAME +#ifdef TEST_ZONE_NAME #define TEST_ZONE_FULLADDR TEST_ZONE_ADDR "%" TEST_ZONE_NAME #endif @@ -659,7 +659,7 @@ static void test_zone(abts_case *tc, void *data) apr_status_t rv; const char *name = NULL; apr_uint32_t id = 0; - + rv = apr_sockaddr_info_get(&sa, "127.0.0.1", APR_INET, 8080, 0, p); APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv); @@ -668,7 +668,7 @@ static void test_zone(abts_case *tc, void *data) apr_sockaddr_zone_set(sa, "1")); ABTS_INT_EQUAL(tc, APR_EBADIP, apr_sockaddr_zone_get(sa, &name, &id, p)); - + rv = apr_sockaddr_info_get(&sa, "::1", APR_INET6, 8080, 0, p); APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv); @@ -684,13 +684,13 @@ static void test_zone(abts_case *tc, void *data) { apr_sockaddr_t *sa2; char buf[50]; - + APR_ASSERT_SUCCESS(tc, "Set zone to " TEST_ZONE_NAME, apr_sockaddr_zone_set(sa, TEST_ZONE_NAME)); - + APR_ASSERT_SUCCESS(tc, "Get zone", apr_sockaddr_zone_get(sa, NULL, NULL, p)); - + APR_ASSERT_SUCCESS(tc, "Get zone", apr_sockaddr_zone_get(sa, &name, &id, p)); ABTS_STR_EQUAL(tc, TEST_ZONE_NAME, name); @@ -704,12 +704,12 @@ static void test_zone(abts_case *tc, void *data) memset(buf, 'A', sizeof buf); ABTS_INT_EQUAL(tc, APR_ENOSPC, apr_sockaddr_ip_getbuf(buf, strlen(TEST_ZONE_ADDR), sa)); ABTS_INT_EQUAL(tc, APR_ENOSPC, apr_sockaddr_ip_getbuf(buf, strlen(TEST_ZONE_FULLADDR), sa)); - + APR_ASSERT_SUCCESS(tc, "get IP address", apr_sockaddr_ip_getbuf(buf, strlen(TEST_ZONE_FULLADDR) + 1, sa)); /* Check for overflow. */ ABTS_INT_EQUAL(tc, 'A', buf[strlen(buf) + 1]); - + rv = apr_sockaddr_info_copy(&sa2, sa, p); APR_ASSERT_SUCCESS(tc, "Problem copying sockaddr", rv); @@ -733,7 +733,7 @@ static void test_zone(abts_case *tc, void *data) #endif /* TEST_ZONE_NAME */ #endif /* APR_HAVE_IPV6 */ } - + abts_suite *testsock(abts_suite *suite) { suite = ADD_SUITE(suite) diff --git a/test/testsockets.c b/test/testsockets.c index 5b0db3e0b..8be857963 100644 --- a/test/testsockets.c +++ b/test/testsockets.c @@ -234,7 +234,7 @@ abts_suite *testsockets(abts_suite *suite) #endif abts_run_test(suite, socket_userdata, NULL); - + return suite; } diff --git a/test/testsockopt.c b/test/testsockopt.c index 203e2c39f..0a53e9af5 100644 --- a/test/testsockopt.c +++ b/test/testsockopt.c @@ -48,7 +48,7 @@ static void set_debug(abts_case *tc, void *data) { apr_status_t rv1, rv2; apr_int32_t ck; - + /* On some platforms APR_SO_DEBUG can only be set as root; just test * for get/set consistency of this option. */ rv1 = apr_socket_opt_set(sock, APR_SO_DEBUG, 1); @@ -108,7 +108,7 @@ static void corkable(abts_case *tc, void *data) rv = apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - + rv = apr_socket_opt_get(sock, APR_TCP_NODELAY, &ck); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 1, ck); diff --git a/test/teststr.c b/test/teststr.c index 432fb6b21..baa9b9d68 100644 --- a/test/teststr.c +++ b/test/teststr.c @@ -106,7 +106,7 @@ static void snprintf_noNULL(abts_case *tc, void *data) testing[4] = 'i'; testing[5] = 'n'; testing[6] = 'g'; - + /* If this test fails, we are going to seg fault. */ apr_snprintf(buff, sizeof(buff), "%.*s", 7, testing); ABTS_STR_NEQUAL(tc, buff, testing, 7); @@ -138,11 +138,11 @@ static void snprintf_underflow(abts_case *tc, void *data) rv = apr_snprintf(buf, sizeof buf, "%.2f", (double)0.0001); ABTS_INT_EQUAL(tc, 4, rv); ABTS_STR_EQUAL(tc, "0.00", buf); - + rv = apr_snprintf(buf, sizeof buf, "%.2f", (double)0.001); ABTS_INT_EQUAL(tc, 4, rv); ABTS_STR_EQUAL(tc, "0.00", buf); - + rv = apr_snprintf(buf, sizeof buf, "%.2f", (double)0.01); ABTS_INT_EQUAL(tc, 4, rv); ABTS_STR_EQUAL(tc, "0.01", buf); @@ -161,7 +161,7 @@ static void string_error(abts_case *tc, void *data) rv = apr_strerror(APR_TIMEUP, buf, sizeof buf); ABTS_PTR_EQUAL(tc, buf, rv); ABTS_STR_EQUAL(tc, "The timeout specified has expired", buf); - + /* throw some randomish numbers at it to check for robustness */ for (n = 1; n < 1000000; n *= 2) { apr_strerror(n, buf, sizeof buf); @@ -190,7 +190,7 @@ static void string_strtoi64(abts_case *tc, void *data) const char *in, *end; apr_int64_t result; } ts[] = { - + /* base 10 tests */ { 0, 10, "123545", NULL, APR_INT64_C(123545) }, { 0, 10, " 123545", NULL, APR_INT64_C(123545) }, @@ -245,17 +245,17 @@ static void string_strtoi64(abts_case *tc, void *data) char *end = "end ptr not changed"; apr_int64_t result; int errnum; - + errno = 0; result = apr_strtoi64(ts[n].in, &end, ts[n].base); errnum = errno; ABTS_ASSERT(tc, - apr_psprintf(p, "for '%s': result was %" APR_INT64_T_FMT + apr_psprintf(p, "for '%s': result was %" APR_INT64_T_FMT " not %" APR_INT64_T_FMT, ts[n].in, result, ts[n].result), result == ts[n].result); - + if (ts[n].errnum != -1) { ABTS_ASSERT(tc, apr_psprintf(p, "for '%s': errno was %d not %d", ts[n].in, @@ -339,7 +339,7 @@ static void string_strfsize(abts_case *tc, void *data) for (n = 0; n < sizeof(ts)/sizeof(ts[0]); n++) { char buf[6], *ret; - + buf[5] = '%'; ret = apr_strfsize(ts[n].size, buf); @@ -353,7 +353,7 @@ static void string_strfsize(abts_case *tc, void *data) static void string_cpystrn(abts_case *tc, void *data) { char buf[6], *ret; - + buf[5] = 'Z'; ret = apr_cpystrn(buf, "123456", 5); @@ -368,7 +368,7 @@ static void snprintf_overflow(abts_case *tc, void *data) { char buf[4]; int rv; - + buf[2] = '4'; buf[3] = '2'; diff --git a/test/teststrmatch.c b/test/teststrmatch.c index b6a4a1226..959b0e35d 100644 --- a/test/teststrmatch.c +++ b/test/teststrmatch.c @@ -43,7 +43,7 @@ static void test_str(abts_case *tc, void *data) pattern = apr_strmatch_precompile(pool, "pattern", 1); ABTS_PTR_NOTNULL(tc, pattern); - + pattern_nocase = apr_strmatch_precompile(pool, "pattern", 0); ABTS_PTR_NOTNULL(tc, pattern_nocase); diff --git a/test/testtable.c b/test/testtable.c index 0a9960f12..c0eda9c02 100644 --- a/test/testtable.c +++ b/test/testtable.c @@ -160,7 +160,7 @@ static void table_overlap(abts_case *tc, void *data) apr_table_addn(t2, "b", "2."); apr_table_addn(t2, "f", "6"); apr_table_overlap(t1, t2, APR_OVERLAP_TABLES_SET); - + ABTS_INT_EQUAL(tc, 7, apr_table_elts(t1)->nelts); val = apr_table_get(t1, "a"); ABTS_STR_EQUAL(tc, "1", val); @@ -189,11 +189,11 @@ static void table_overlap2(abts_case *tc, void *data) t2 = apr_table_make(p, 1); apr_table_addn(t1, "t1", "one"); apr_table_addn(t2, "t2", "two"); - + apr_table_overlap(t1, t2, APR_OVERLAP_TABLES_SET); - + ABTS_INT_EQUAL(tc, 2, apr_table_elts(t1)->nelts); - + ABTS_STR_EQUAL(tc, "one", apr_table_get(t1, "t1")); ABTS_STR_EQUAL(tc, "two", apr_table_get(t1, "t2")); diff --git a/test/testtemp.c b/test/testtemp.c index 1f1143ee3..a642292e8 100644 --- a/test/testtemp.c +++ b/test/testtemp.c @@ -37,7 +37,7 @@ static void test_mktemp(abts_case *tc, void *data) rv = apr_temp_dir_get(&tempdir, p); APR_ASSERT_SUCCESS(tc, "Error finding Temporary Directory", rv); - + filetemplate = apr_pstrcat(p, tempdir, "/tempfileXXXXXX", NULL); rv = apr_file_mktemp(&f, filetemplate, 0, p); APR_ASSERT_SUCCESS(tc, "Error opening Temporary file", rv); diff --git a/test/testthread.c b/test/testthread.c index e64bdd4b7..6eb8ebc6d 100644 --- a/test/testthread.c +++ b/test/testthread.c @@ -56,7 +56,7 @@ static void * APR_THREAD_FUNC thread_func1(apr_thread_t *thd, void *data) } apr_thread_exit(thd, exit_ret_val); return NULL; -} +} static void thread_init(abts_case *tc, void *data) { @@ -65,7 +65,7 @@ static void thread_init(abts_case *tc, void *data) rv = apr_thread_once_init(&control, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_thread_mutex_create(&thread_lock, APR_THREAD_MUTEX_DEFAULT, p); + rv = apr_thread_mutex_create(&thread_lock, APR_THREAD_MUTEX_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } diff --git a/test/testuri.c b/test/testuri.c index 4c5405aef..bb77b2818 100644 --- a/test/testuri.c +++ b/test/testuri.c @@ -228,7 +228,7 @@ static void show_info(apr_status_t rv, apr_status_t expected, const apr_uri_t *i fprintf(stderr, " actual rv: %d expected rv: %d\n", rv, expected); } else { - fprintf(stderr, + fprintf(stderr, " scheme: %s\n" " hostinfo: %s\n" " user: %s\n" diff --git a/test/testuser.c b/test/testuser.c index e75782e90..3ecf25495 100644 --- a/test/testuser.c +++ b/test/testuser.c @@ -39,7 +39,7 @@ static void username(abts_case *tc, void *data) APR_ASSERT_SUCCESS(tc, "apr_uid_current failed", apr_uid_current(&uid, &gid, p)); - + APR_ASSERT_SUCCESS(tc, "apr_uid_name_get failed", apr_uid_name_get(&uname, uid, p)); ABTS_PTR_NOTNULL(tc, uname); @@ -65,7 +65,7 @@ static void username(abts_case *tc, void *data) } else { ABTS_NOT_IMPL(tc, "Groups from apr_uid_get"); - } + } } else { #endif diff --git a/test/testutil.c b/test/testutil.c index 3a9e25cb4..db11dacdd 100644 --- a/test/testutil.c +++ b/test/testutil.c @@ -26,8 +26,8 @@ apr_pool_t *p; -void apr_assert_success(abts_case* tc, const char* context, apr_status_t rv, - int lineno) +void apr_assert_success(abts_case* tc, const char* context, apr_status_t rv, + int lineno) { if (rv == APR_ENOTIMPL) { abts_not_impl(tc, context, lineno); @@ -54,7 +54,7 @@ void apr_assert_failure(abts_case* tc, const char* context, apr_status_t rv, void initialize(void) { apr_initialize(); atexit(apr_terminate); - + apr_pool_create(&p, NULL); #if _MSC_VER >= 1400 diff --git a/test/testxml.c b/test/testxml.c index a50c9f196..fd3ba262b 100644 --- a/test/testxml.c +++ b/test/testxml.c @@ -155,7 +155,7 @@ static void test_billion_laughs(abts_case *tc, void *data) apr_xml_doc *doc; apr_status_t rv; - rv = apr_file_open(&fd, "data/billion-laughs.xml", + rv = apr_file_open(&fd, "data/billion-laughs.xml", APR_FOPEN_READ, 0, p); APR_ASSERT_SUCCESS(tc, "open billion-laughs.xml", rv); diff --git a/test/tryread.c b/test/tryread.c index 843abe70a..3225750c8 100644 --- a/test/tryread.c +++ b/test/tryread.c @@ -35,7 +35,7 @@ int main(int argc, const char * const *argv) if (apr_file_open(&file, TESTFILE, APR_FOPEN_WRITE, APR_FPROT_OS_DEFAULT, p) != APR_SUCCESS) { - + exit(UNEXPECTED_ERROR); } status = apr_file_lock(file, APR_FLOCK_EXCLUSIVE | APR_FLOCK_NONBLOCK); -- cgit v1.2.1