You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2006/02/10 00:13:41 UTC
svn commit: r376479 - in /apr/apr/branches/1.2.x/test: testdup.c testfile.c
testfilecopy.c testpipe.c testproc.c testtime.c
Author: wrowe
Date: Thu Feb 9 15:13:39 2006
New Revision: 376479
URL: http://svn.apache.org/viewcvs?rev=376479&view=rev
Log:
Fix a host of tests that were using ABTS_INT_EQUAL to compare non-int
results, which caused mass quantities of compile warnings that don't
reflect well on a 'test suite'.
Backports 376406, 376472 from wrowe, jorton
Modified:
apr/apr/branches/1.2.x/test/testdup.c
apr/apr/branches/1.2.x/test/testfile.c
apr/apr/branches/1.2.x/test/testfilecopy.c
apr/apr/branches/1.2.x/test/testpipe.c
apr/apr/branches/1.2.x/test/testproc.c
apr/apr/branches/1.2.x/test/testtime.c
Modified: apr/apr/branches/1.2.x/test/testdup.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/test/testdup.c?rev=376479&r1=376478&r2=376479&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/test/testdup.c (original)
+++ apr/apr/branches/1.2.x/test/testdup.c Thu Feb 9 15:13:39 2006
@@ -81,7 +81,7 @@
fpos = 0;
rv = apr_file_seek(file1, APR_SET, &fpos);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
- ABTS_INT_EQUAL(tc, 0, fpos);
+ ABTS_ASSERT(tc, "File position mismatch, expected 0", fpos == 0);
txtlen = 50;
rv = apr_file_read(file1, buff, &txtlen);
@@ -166,7 +166,7 @@
fpos = 0;
rv = apr_file_seek(testfile, APR_SET, &fpos);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
- ABTS_INT_EQUAL(tc, 0, fpos);
+ ABTS_ASSERT(tc, "File position mismatch, expected 0", fpos == 0);
txtlen = 50;
rv = apr_file_read(testfile, buff, &txtlen);
Modified: apr/apr/branches/1.2.x/test/testfile.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/test/testfile.c?rev=376479&r1=376478&r2=376479&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/test/testfile.c (original)
+++ apr/apr/branches/1.2.x/test/testfile.c Thu Feb 9 15:13:39 2006
@@ -485,7 +485,7 @@
cur = 0;
rv = apr_file_seek(f, APR_CUR, &cur);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
- ABTS_INT_EQUAL(tc, 10, cur);
+ ABTS_ASSERT(tc, "File Pointer Mismatch, expected 10", cur == 10);
nbytes = sizeof(buf);
rv = apr_file_read(f, buf, &nbytes);
@@ -495,7 +495,7 @@
cur = -((apr_off_t)nbytes - 7980);
rv = apr_file_seek(f, APR_CUR, &cur);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
- ABTS_INT_EQUAL(tc, 7990, cur);
+ ABTS_ASSERT(tc, "File Pointer Mismatch, expected 7990", cur == 7990);
rv = apr_file_gets(buf, 11, f);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
@@ -665,7 +665,7 @@
rv = apr_stat(&finfo, fname, APR_FINFO_SIZE, p);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
- ABTS_INT_EQUAL(tc, 0, finfo.size);
+ ABTS_ASSERT(tc, "File size mismatch, expected 0 (empty)", finfo.size == 0);
rv = apr_file_remove(fname, p);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
Modified: apr/apr/branches/1.2.x/test/testfilecopy.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/test/testfilecopy.c?rev=376479&r1=376478&r2=376479&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/test/testfilecopy.c (original)
+++ apr/apr/branches/1.2.x/test/testfilecopy.c Thu Feb 9 15:13:39 2006
@@ -46,12 +46,12 @@
APR_ASSERT_SUCCESS(tc, "Couldn't stat copy file", rv);
if (!append) {
- ABTS_INT_EQUAL(tc, orig.size, copy.size);
+ ABTS_ASSERT(tc, "File size differs", orig.size == copy.size);
}
else {
- ABTS_INT_EQUAL(tc,
- ((dest_rv == APR_SUCCESS) ? dest.size : 0) + orig.size,
- copy.size);
+ ABTS_ASSERT(tc, "File size differs",
+ ((dest_rv == APR_SUCCESS)
+ ? dest.size : 0) + orig.size == copy.size);
}
}
Modified: apr/apr/branches/1.2.x/test/testpipe.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/test/testpipe.c?rev=376479&r1=376478&r2=376479&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/test/testpipe.c (original)
+++ apr/apr/branches/1.2.x/test/testpipe.c Thu Feb 9 15:13:39 2006
@@ -63,14 +63,15 @@
rv = apr_file_pipe_timeout_get(readp, &timeout);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
- ABTS_INT_EQUAL(tc, -1, timeout);
+ ABTS_ASSERT(tc, "Timeout mismatch, expected -1", timeout == -1);
rv = apr_file_pipe_timeout_set(readp, apr_time_from_sec(1));
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
rv = apr_file_pipe_timeout_get(readp, &timeout);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
- ABTS_INT_EQUAL(tc, apr_time_from_sec(1), timeout);
+ ABTS_ASSERT(tc, "Timeout mismatch, expected 1 second",
+ timeout == apr_time_from_sec(1));
}
static void read_write(abts_case *tc, void *data)
Modified: apr/apr/branches/1.2.x/test/testproc.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/test/testproc.c?rev=376479&r1=376478&r2=376479&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/test/testproc.c (original)
+++ apr/apr/branches/1.2.x/test/testproc.c Thu Feb 9 15:13:39 2006
@@ -108,7 +108,7 @@
offset = 0;
rv = apr_file_seek(testfile, APR_SET, &offset);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
- ABTS_INT_EQUAL(tc, 0, offset);
+ ABTS_ASSERT(tc, "File position mismatch, expected 0", offset == 0);
rv = apr_procattr_create(&attr, p);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
Modified: apr/apr/branches/1.2.x/test/testtime.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/test/testtime.c?rev=376479&r1=376478&r2=376479&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/test/testtime.c (original)
+++ apr/apr/branches/1.2.x/test/testtime.c Thu Feb 9 15:13:39 2006
@@ -86,8 +86,8 @@
{
apr_status_t rv;
apr_time_exp_t xt;
- struct tm *libc_exp;
- time_t now_secs = apr_time_sec(now);
+ time_t posix_secs = (time_t)apr_time_sec(now);
+ struct tm *posix_exp = localtime(&posix_secs);
rv = apr_time_exp_lt(&xt, now);
if (rv == APR_ENOTIMPL) {
@@ -95,10 +95,8 @@
}
ABTS_TRUE(tc, rv == APR_SUCCESS);
- libc_exp = localtime(&now_secs);
-
#define CHK_FIELD(f) \
- ABTS_INT_EQUAL(tc, libc_exp->f, xt.f)
+ ABTS_ASSERT(tc, "Mismatch in " #f, posix_exp->f == xt.f)
CHK_FIELD(tm_sec);
CHK_FIELD(tm_min);
@@ -182,14 +180,15 @@
apr_status_t rv;
char apr_str[STR_SIZE];
char libc_str[STR_SIZE];
- time_t now_sec = apr_time_sec(now);
+ apr_time_t now_sec = apr_time_sec(now);
+ time_t posix_sec = (time_t) now_sec;
rv = apr_ctime(apr_str, now);
if (rv == APR_ENOTIMPL) {
ABTS_NOT_IMPL(tc, "apr_ctime");
}
ABTS_TRUE(tc, rv == APR_SUCCESS);
- strcpy(libc_str, ctime(&now_sec));
+ strcpy(libc_str, ctime(&posix_sec));
*strchr(libc_str, '\n') = '\0';
ABTS_STR_EQUAL(tc, libc_str, apr_str);