summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2006-02-11 18:36:25 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2006-02-11 18:36:25 +0000
commit8dfa385738cd832a161421584d6e8ebfc8a3ec5c (patch)
tree24a69e0ac173229e6474fe2b4893afacdaabaff7
parent6446dc1e1b63d91188bcdcd4516aae912035473f (diff)
downloadlibapr-8dfa385738cd832a161421584d6e8ebfc8a3ec5c.tar.gz
svn:ignore's to hide obj/exe's from svn status for win32
Backport rev's 376406, 376407, 376408 to the old test framework, with some feedbacks from list and some special cases for APR 0.9, to ensure the testsuite builds clean. (wasn't intended to be a recursive commit) git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/0.9.x@377009 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--test/occhild.c22
-rw-r--r--test/testdso.c9
-rw-r--r--test/testdup.c4
-rw-r--r--test/testfile.c6
-rw-r--r--test/testmmap.c5
-rw-r--r--test/testpipe.c5
-rw-r--r--test/testproc.c2
-rw-r--r--test/testtime.c13
8 files changed, 37 insertions, 29 deletions
diff --git a/test/occhild.c b/test/occhild.c
index 05df4ae7d..a96885d82 100644
--- a/test/occhild.c
+++ b/test/occhild.c
@@ -1,16 +1,26 @@
#include "apr.h"
-#include <stdio.h>
-#if APR_HAVE_UNISTD_H
-#include <unistd.h>
-#endif
+#include "apr_file_io.h"
+#include "apr.h"
+
+#if APR_HAVE_STDLIB_H
#include <stdlib.h>
+#endif
int main(void)
{
char buf[256];
+ apr_file_t *err;
+ apr_pool_t *p;
+
+ apr_initialize();
+ atexit(apr_terminate);
+
+ apr_pool_create(&p, NULL);
+ apr_file_open_stdin(&err, p);
while (1) {
- read(STDERR_FILENO, buf, 256);
+ apr_size_t length = 256;
+ apr_file_read(err, buf, &length);
}
- return 0; /* just to keep the compiler happy */
+ exit(0); /* just to keep the compiler happy */
}
diff --git a/test/testdso.c b/test/testdso.c
index 5753a6773..3e37e2d8e 100644
--- a/test/testdso.c
+++ b/test/testdso.c
@@ -21,6 +21,7 @@
#include "apr_errno.h"
#include "apr_dso.h"
#include "apr_strings.h"
+#include "apr_file_info.h"
#include "apr.h"
#if APR_HAVE_UNISTD_H
#include <unistd.h>
@@ -223,9 +224,7 @@ CuSuite *testdso(void)
{
CuSuite *suite = CuSuiteNew("DSO");
- modname = apr_pcalloc(p, 256);
- getcwd(modname, 256);
- modname = apr_pstrcat(p, modname, "/", MOD_NAME, NULL);
+ apr_filepath_merge(&modname, NULL, MOD_NAME, 0, p);
SUITE_ADD_TEST(suite, test_load_module);
SUITE_ADD_TEST(suite, test_dso_sym);
@@ -233,9 +232,7 @@ CuSuite *testdso(void)
SUITE_ADD_TEST(suite, test_unload_module);
#ifdef LIB_NAME
- libname = apr_pcalloc(p, 256);
- getcwd(libname, 256);
- libname = apr_pstrcat(p, libname, "/", LIB_NAME, NULL);
+ apr_filepath_merge(&libname, NULL, LIB_NAME, 0, p);
SUITE_ADD_TEST(suite, test_load_library);
SUITE_ADD_TEST(suite, test_dso_sym_library);
diff --git a/test/testdup.c b/test/testdup.c
index 2e0d0e7e0..d57a47b35 100644
--- a/test/testdup.c
+++ b/test/testdup.c
@@ -81,7 +81,7 @@ static void test_file_readwrite(CuTest *tc)
fpos = 0;
rv = apr_file_seek(file1, APR_SET, &fpos);
CuAssertIntEquals(tc, APR_SUCCESS, rv);
- CuAssertIntEquals(tc, 0, fpos);
+ CuAssert(tc, "File position mismatch, expected 0", fpos == 0);
txtlen = 50;
rv = apr_file_read(file1, buff, &txtlen);
@@ -166,7 +166,7 @@ static void test_dup2_readwrite(CuTest *tc)
fpos = 0;
rv = apr_file_seek(testfile, APR_SET, &fpos);
CuAssertIntEquals(tc, APR_SUCCESS, rv);
- CuAssertIntEquals(tc, 0, fpos);
+ CuAssert(tc, "File position mismatch, expected 0", fpos == 0);
txtlen = 50;
rv = apr_file_read(testfile, buff, &txtlen);
diff --git a/test/testfile.c b/test/testfile.c
index 811a1b787..502bf7217 100644
--- a/test/testfile.c
+++ b/test/testfile.c
@@ -466,7 +466,7 @@ static void test_mod_neg(CuTest *tc)
cur = 0;
rv = apr_file_seek(f, APR_CUR, &cur);
CuAssertIntEquals(tc, APR_SUCCESS, rv);
- CuAssertIntEquals(tc, 10, cur);
+ CuAssert(tc, "File Pointer Mismatch, expected 10", cur == 10);
nbytes = sizeof(buf);
rv = apr_file_read(f, buf, &nbytes);
@@ -476,7 +476,7 @@ static void test_mod_neg(CuTest *tc)
cur = -((apr_off_t)nbytes - 7980);
rv = apr_file_seek(f, APR_CUR, &cur);
CuAssertIntEquals(tc, APR_SUCCESS, rv);
- CuAssertIntEquals(tc, 7990, cur);
+ CuAssert(tc, "File Pointer Mismatch, expected 7990", cur == 7990);
rv = apr_file_gets(buf, 11, f);
CuAssertIntEquals(tc, APR_SUCCESS, rv);
@@ -522,7 +522,7 @@ static void test_truncate(CuTest *tc)
rv = apr_stat(&finfo, fname, APR_FINFO_SIZE, p);
CuAssertIntEquals(tc, APR_SUCCESS, rv);
- CuAssertIntEquals(tc, 0, finfo.size);
+ CuAssert(tc, "File size mismatch, expected 0 (empty)", finfo.size == 0);
rv = apr_file_remove(fname, p);
CuAssertIntEquals(tc, APR_SUCCESS, rv);
diff --git a/test/testmmap.c b/test/testmmap.c
index 96782fb72..d2171e3ad 100644
--- a/test/testmmap.c
+++ b/test/testmmap.c
@@ -84,14 +84,15 @@ static void test_get_filesize(CuTest *tc)
rv = apr_file_info_get(&finfo, APR_FINFO_NORM, thefile);
CuAssertIntEquals(tc, rv, APR_SUCCESS);
- CuAssertIntEquals(tc, fsize, finfo.size);
+ CuAssert(tc, "File size mismatch", fsize == finfo.size);
}
static void test_mmap_create(CuTest *tc)
{
apr_status_t rv;
- rv = apr_mmap_create(&themmap, thefile, 0, finfo.size, APR_MMAP_READ, p);
+ rv = apr_mmap_create(&themmap, thefile, 0, (apr_size_t)finfo.size,
+ APR_MMAP_READ, p);
CuAssertPtrNotNull(tc, themmap);
CuAssertIntEquals(tc, rv, APR_SUCCESS);
}
diff --git a/test/testpipe.c b/test/testpipe.c
index ca45a699b..f0d53212c 100644
--- a/test/testpipe.c
+++ b/test/testpipe.c
@@ -65,14 +65,15 @@ static void set_timeout(CuTest *tc)
rv = apr_file_pipe_timeout_get(readp, &timeout);
CuAssertIntEquals(tc, APR_SUCCESS, rv);
- CuAssertIntEquals(tc, -1, timeout);
+ CuAssert(tc, "Timeout mismatch, expected -1", timeout == -1);
rv = apr_file_pipe_timeout_set(readp, apr_time_from_sec(1));
CuAssertIntEquals(tc, APR_SUCCESS, rv);
rv = apr_file_pipe_timeout_get(readp, &timeout);
CuAssertIntEquals(tc, APR_SUCCESS, rv);
- CuAssertIntEquals(tc, apr_time_from_sec(1), timeout);
+ CuAssert(tc, "Timeout mismatch, expected 1 second",
+ timeout == apr_time_from_sec(1));
}
static void read_write(CuTest *tc)
diff --git a/test/testproc.c b/test/testproc.c
index 1f611245e..269102b86 100644
--- a/test/testproc.c
+++ b/test/testproc.c
@@ -117,7 +117,7 @@ static void test_file_redir(CuTest *tc)
offset = 0;
rv = apr_file_seek(testfile, APR_SET, &offset);
CuAssertIntEquals(tc, APR_SUCCESS, rv);
- CuAssertIntEquals(tc, 0, offset);
+ CuAssert(tc, "File position mismatch, expected 0", offset == 0);
rv = apr_procattr_create(&attr, p);
CuAssertIntEquals(tc, APR_SUCCESS, rv);
diff --git a/test/testtime.c b/test/testtime.c
index c8fca097c..2be3ccdc6 100644
--- a/test/testtime.c
+++ b/test/testtime.c
@@ -86,8 +86,9 @@ static void test_exp_lt(CuTest *tc)
{
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);
+ apr_time_t now_secs = apr_time_sec(now);
+ struct tm *posix_exp = localtime(&posix_secs);
rv = apr_time_exp_lt(&xt, now);
if (rv == APR_ENOTIMPL) {
@@ -95,10 +96,8 @@ static void test_exp_lt(CuTest *tc)
}
CuAssertTrue(tc, rv == APR_SUCCESS);
- libc_exp = localtime(&now_secs);
-
#define CHK_FIELD(f) \
- CuAssertIntEquals(tc, libc_exp->f, xt.f)
+ CuAssert(tc, "Mismatch in " #f, posix_exp->f == xt.f)
CHK_FIELD(tm_sec);
CHK_FIELD(tm_min);
@@ -182,14 +181,14 @@ static void test_ctime(CuTest *tc)
apr_status_t rv;
char apr_str[STR_SIZE];
char libc_str[STR_SIZE];
- time_t now_sec = apr_time_sec(now);
+ time_t posix_sec = (time_t)apr_time_sec(now);
rv = apr_ctime(apr_str, now);
if (rv == APR_ENOTIMPL) {
CuNotImpl(tc, "apr_ctime");
}
CuAssertTrue(tc, rv == APR_SUCCESS);
- strcpy(libc_str, ctime(&now_sec));
+ strcpy(libc_str, ctime(&posix_sec));
*strchr(libc_str, '\n') = '\0';
CuAssertStrEquals(tc, libc_str, apr_str);