You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by jo...@apache.org on 2011/05/19 04:35:52 UTC
svn commit: r1124517 - in /httpd/apreq/trunk/library/t: at.c at.h cookie.c
error.c params.c parsers.c util.c version.c
Author: joes
Date: Thu May 19 02:35:51 2011
New Revision: 1124517
URL: http://svn.apache.org/viewvc?rev=1124517&view=rev
Log:
pass void * ptr to test fcns
Modified:
httpd/apreq/trunk/library/t/at.c
httpd/apreq/trunk/library/t/at.h
httpd/apreq/trunk/library/t/cookie.c
httpd/apreq/trunk/library/t/error.c
httpd/apreq/trunk/library/t/params.c
httpd/apreq/trunk/library/t/parsers.c
httpd/apreq/trunk/library/t/util.c
httpd/apreq/trunk/library/t/version.c
Modified: httpd/apreq/trunk/library/t/at.c
URL: http://svn.apache.org/viewvc/httpd/apreq/trunk/library/t/at.c?rev=1124517&r1=1124516&r2=1124517&view=diff
==============================================================================
--- httpd/apreq/trunk/library/t/at.c (original)
+++ httpd/apreq/trunk/library/t/at.c Thu May 19 02:35:51 2011
@@ -352,7 +352,7 @@ int at_run(at_t *AT, const at_test_t *te
AT->abort = &j;
if (setjmp(j) == 0) {
- test->func(AT);
+ test->func(AT, test->ctx);
at_free_lists;
return AT_SUCCESS;
}
Modified: httpd/apreq/trunk/library/t/at.h
URL: http://svn.apache.org/viewvc/httpd/apreq/trunk/library/t/at.h?rev=1124517&r1=1124516&r2=1124517&view=diff
==============================================================================
--- httpd/apreq/trunk/library/t/at.h (original)
+++ httpd/apreq/trunk/library/t/at.h Thu May 19 02:35:51 2011
@@ -31,13 +31,14 @@ typedef struct at_t at_t;
typedef struct at_report_t at_report_t;
typedef int (*at_report_function_t)(at_report_t *r, const char *msg);
-typedef void(*at_test_function_t)(at_t *t);
+typedef void(*at_test_function_t)(at_t *t, void *ctx);
typedef struct at_test_t at_test_t;
struct at_test_t {
const char *name;
at_test_function_t func;
int plan;
+ void *ctx;
const char *fatals;
const char *skips;
const char *todos;
@@ -165,6 +166,20 @@ void at_check(at_t *t, int is_ok, const
at_comment(t, format, vp);
}
}
+ else if (AT_FLAG_DEBUG(t->flags) && !is_ok) {
+ char format[32] = "testing: %s (%s:%d)";
+ at_debug(t, format, label, file, line);
+
+ if (fmt != NULL) {
+ char *f;
+ at_snprintf(format, sizeof format, " format: %s", fmt);
+ at_debug(t, "%s", format);
+ memcpy(format, " left:", 8);
+ f = format + strlen(format);
+ at_snprintf(f, sizeof format - strlen(format), "\n right: %s", fmt);
+ at_comment(t, format, vp);
+ }
+ }
va_end(vp);
at_ok(t, is_ok, label, file, line);
}
Modified: httpd/apreq/trunk/library/t/cookie.c
URL: http://svn.apache.org/viewvc/httpd/apreq/trunk/library/t/cookie.c?rev=1124517&r1=1124516&r2=1124517&view=diff
==============================================================================
--- httpd/apreq/trunk/library/t/cookie.c (original)
+++ httpd/apreq/trunk/library/t/cookie.c Thu May 19 02:35:51 2011
@@ -69,7 +69,7 @@ static const char cgcookies4[] = "SID=66
static apr_table_t *jar, *jar2, *jar3, *jar4, *jar5, *jar6, *jar7;
static apr_pool_t *p;
-static void jar_make(dAT)
+static void jar_make(dAT, void *ctx)
{
jar = apr_table_make(p, APREQ_DEFAULT_NELTS);
AT_not_null(jar);
@@ -94,7 +94,7 @@ static void jar_make(dAT)
AT_int_eq(apreq_parse_cookie_header(p, jar7, cgcookies4), APR_SUCCESS);
}
-static void jar_get_rfc(dAT)
+static void jar_get_rfc(dAT, void *ctx)
{
const char *val;
AT_not_null(val = apr_table_get(jar2, "first"));
@@ -105,7 +105,7 @@ static void jar_get_rfc(dAT)
AT_str_eq(val, "cie");
}
-static void jar_get_ns(dAT)
+static void jar_get_ns(dAT, void *ctx)
{
AT_str_eq(apr_table_get(jar, "a"), "1");
@@ -126,7 +126,7 @@ static void jar_get_ns(dAT)
}
-static void netscape_cookie(dAT)
+static void netscape_cookie(dAT, void *ctx)
{
char expires[APR_RFC822_DATE_LEN];
char *val;
@@ -160,7 +160,7 @@ static void netscape_cookie(dAT)
}
-static void rfc_cookie(dAT)
+static void rfc_cookie(dAT, void *ctx)
{
apreq_cookie_t *c = apreq_cookie_make(p,"rfc",3,"out",3);
const char *expected;
@@ -210,7 +210,7 @@ static void rfc_cookie(dAT)
}
-#define dT(func, plan) #func, func, plan
+#define dT(func, plan) #func, func, plan, NULL
int main(int argc, char *argv[])
Modified: httpd/apreq/trunk/library/t/error.c
URL: http://svn.apache.org/viewvc/httpd/apreq/trunk/library/t/error.c?rev=1124517&r1=1124516&r2=1124517&view=diff
==============================================================================
--- httpd/apreq/trunk/library/t/error.c (original)
+++ httpd/apreq/trunk/library/t/error.c Thu May 19 02:35:51 2011
@@ -20,7 +20,7 @@
#include "at.h"
-static void test_strerror(dAT)
+static void test_strerror(dAT, void *ctx)
{
char buf[256], *str;
@@ -60,7 +60,7 @@ static void test_strerror(dAT)
}
-#define dT(func, plan) #func, func, plan
+#define dT(func, plan) #func, func, plan, NULL
int main(int argc, char *argv[])
Modified: httpd/apreq/trunk/library/t/params.c
URL: http://svn.apache.org/viewvc/httpd/apreq/trunk/library/t/params.c?rev=1124517&r1=1124516&r2=1124517&view=diff
==============================================================================
--- httpd/apreq/trunk/library/t/params.c (original)
+++ httpd/apreq/trunk/library/t/params.c Thu May 19 02:35:51 2011
@@ -29,7 +29,7 @@ static apr_table_t *args;
static apr_pool_t *p;
-static void request_make(dAT)
+static void request_make(dAT, void *ctx)
{
apr_status_t s;
args = apr_table_make(p, APREQ_DEFAULT_NELTS);
@@ -40,7 +40,7 @@ static void request_make(dAT)
}
-static void request_args_get(dAT)
+static void request_args_get(dAT, void *ctx)
{
const char *val;
const apreq_param_t *param;
@@ -59,7 +59,7 @@ static void request_args_get(dAT)
AT_str_eq(apr_table_get(args,"novalue2"),"");
}
-static void params_as(dAT)
+static void params_as(dAT, void *ctx)
{
const char *val;
apr_array_header_t *arr;
@@ -71,7 +71,7 @@ static void params_as(dAT)
AT_str_eq(val, "");
}
-static void string_decoding_in_place(dAT)
+static void string_decoding_in_place(dAT, void *ctx)
{
char *s1 = apr_palloc(p,4096);
char *s2 = apr_palloc(p,4096);
@@ -97,7 +97,7 @@ static void string_decoding_in_place(dAT
AT_str_eq(s3,"dandy >dons");
}
-static void header_attributes(dAT)
+static void header_attributes(dAT, void *ctx)
{
const char *hdr = "text/plain; boundary=\"-foo-\", charset=ISO-8859-1";
const char *val;
@@ -136,7 +136,7 @@ static void header_attributes(dAT)
}
-static void make_param(dAT)
+static void make_param(dAT, void *ctx)
{
apreq_param_t *param, *decode;
apr_status_t s;
@@ -162,7 +162,7 @@ static void make_param(dAT)
AT_str_eq(decode->v.data, val);
}
-static void quote_strings(dAT)
+static void quote_strings(dAT, void *ctx)
{
apr_size_t exp_len, res_len, res_quote_len;
char *res = apr_palloc(p,24);
Modified: httpd/apreq/trunk/library/t/parsers.c
URL: http://svn.apache.org/viewvc/httpd/apreq/trunk/library/t/parsers.c?rev=1124517&r1=1124516&r2=1124517&view=diff
==============================================================================
--- httpd/apreq/trunk/library/t/parsers.c (original)
+++ httpd/apreq/trunk/library/t/parsers.c Thu May 19 02:35:51 2011
@@ -113,7 +113,7 @@ static char mix_data[] =
#define MR_ENCTYPE "multipart/related"
#define XML_ENCTYPE "application/xml"
-static void locate_default_parsers(dAT)
+static void locate_default_parsers(dAT, void *ctx)
{
#ifdef __ELF__
@@ -137,7 +137,7 @@ static void locate_default_parsers(dAT)
}
-static void parse_urlencoded(dAT)
+static void parse_urlencoded(dAT, void *ctx)
{
apr_status_t rv;
apr_bucket_alloc_t *ba;
@@ -173,7 +173,7 @@ static void parse_urlencoded(dAT)
}
-static void parse_multipart(dAT)
+static void parse_multipart(dAT, void *ctx)
{
apr_size_t i, j;
apr_bucket_alloc_t *ba;
@@ -266,7 +266,7 @@ static void parse_multipart(dAT)
}
}
-static void parse_disable_uploads(dAT)
+static void parse_disable_uploads(dAT, void *ctx)
{
const char *val;
apr_table_t *t, *body;
@@ -309,7 +309,7 @@ static void parse_disable_uploads(dAT)
}
-static void parse_generic(dAT)
+static void parse_generic(dAT, void *ctx)
{
char *val;
apr_size_t vlen;
@@ -341,7 +341,7 @@ static void parse_generic(dAT)
AT_mem_eq(val, xml_data, vlen);
}
-static void hook_discard(dAT)
+static void hook_discard(dAT, void *ctx)
{
apr_status_t rv;
apreq_param_t *dummy;
@@ -373,7 +373,7 @@ static void hook_discard(dAT)
}
-static void parse_related(dAT)
+static void parse_related(dAT, void *ctx)
{
char ct[] = "multipart/related; boundary=f93dcbA3; "
"type=application/xml; start=\"<98...@example.com>\"";
@@ -451,7 +451,7 @@ typedef struct {
} array_elt;
-static void parse_mixed(dAT)
+static void parse_mixed(dAT, void *ctx)
{
const char *val;
char *val2;
Modified: httpd/apreq/trunk/library/t/util.c
URL: http://svn.apache.org/viewvc/httpd/apreq/trunk/library/t/util.c?rev=1124517&r1=1124516&r2=1124517&view=diff
==============================================================================
--- httpd/apreq/trunk/library/t/util.c (original)
+++ httpd/apreq/trunk/library/t/util.c Thu May 19 02:35:51 2011
@@ -21,7 +21,7 @@
#include "at.h"
-static void test_atoi64f(dAT)
+static void test_atoi64f(dAT, void *ctx)
{
AT_int_eq(apreq_atoi64f("0"), 0);
AT_int_eq(apreq_atoi64f("-1"), -1);
@@ -36,7 +36,7 @@ static void test_atoi64f(dAT)
"hex test");
}
-static void test_atoi64t(dAT)
+static void test_atoi64t(dAT, void *ctx)
{
AT_int_eq(apreq_atoi64t("0"), 0);
AT_int_eq(apreq_atoi64t("-1"), -1);
@@ -50,7 +50,7 @@ static void test_atoi64t(dAT)
}
-static void test_index(dAT)
+static void test_index(dAT, void *ctx)
{
const char haystack[] = "Four score and seven years ago";
apr_size_t hlen = sizeof haystack - 1;
@@ -71,7 +71,7 @@ static void test_index(dAT)
#define A_GRAVE 0xE5
#define KATAKANA_A 0xFF71
-static void test_decode(dAT)
+static void test_decode(dAT, void *ctx)
{
apr_size_t elen;
char src1[] = "%C3%80%E3%82%a2"; /* A_GRAVE KATAKANA_A as utf8 */
@@ -87,7 +87,7 @@ static void test_decode(dAT)
AT_int_eq(expect[4], 0xA2);
}
-static void test_charset_divine(dAT)
+static void test_charset_divine(dAT, void *ctx)
{
apr_size_t elen;
char src1[] = "%C3%80%E3%82%a2"; /* A_GRAVE KATAKANA_A as utf8 */
@@ -112,7 +112,7 @@ static void test_charset_divine(dAT)
}
-static void test_decodev(dAT)
+static void test_decodev(dAT, void *ctx)
{
char src1[] = "%2540%2";
char src2[] = "0%u0";
@@ -144,12 +144,12 @@ static void test_decodev(dAT)
}
-static void test_encode(dAT)
+static void test_encode(dAT, void *ctx)
{
}
-static void test_cp1252_to_utf8(dAT)
+static void test_cp1252_to_utf8(dAT, void *ctx)
{
char src1[] = "%C3%80%E3%82%a2"; /* A_GRAVE KATAKANA_A as utf8 */
char src2[5];
@@ -186,7 +186,7 @@ static void test_cp1252_to_utf8(dAT)
}
-static void test_quote(dAT)
+static void test_quote(dAT, void *ctx)
{
size_t len;
char dst[64];
@@ -208,7 +208,7 @@ static void test_quote(dAT)
AT_str_eq(dst, "\"foo\\0bar\"");
}
-static void test_quote_once(dAT)
+static void test_quote_once(dAT, void *ctx)
{
size_t len;
char dst[64];
@@ -252,23 +252,23 @@ static void test_quote_once(dAT)
AT_str_eq(dst, "\"\\\"foo\\\"bar\\\"\"");
}
-static void test_join(dAT)
+static void test_join(dAT, void *ctx)
{
}
-static void test_brigade_fwrite(dAT)
+static void test_brigade_fwrite(dAT, void *ctx)
{
}
-static void test_file_mktemp(dAT)
+static void test_file_mktemp(dAT, void *ctx)
{
}
-static void test_header_attribute(dAT)
+static void test_header_attribute(dAT, void *ctx)
{
const char hdr[] = "filename=\"filename=foo\" filename=\"quux.txt\"";
const char *val;
@@ -286,14 +286,14 @@ static void test_header_attribute(dAT)
}
-static void test_brigade_concat(dAT)
+static void test_brigade_concat(dAT, void *ctx)
{
}
-#define dT(func, plan) #func, func, plan
+#define dT(func, plan) #func, func, plan, NULL
int main(int argc, char *argv[])
Modified: httpd/apreq/trunk/library/t/version.c
URL: http://svn.apache.org/viewvc/httpd/apreq/trunk/library/t/version.c?rev=1124517&r1=1124516&r2=1124517&view=diff
==============================================================================
--- httpd/apreq/trunk/library/t/version.c (original)
+++ httpd/apreq/trunk/library/t/version.c Thu May 19 02:35:51 2011
@@ -18,13 +18,13 @@
#include "apreq_version.h"
#include "at.h"
-static void version_string(dAT)
+static void version_string(dAT, void *ctx)
{
const char *vstring = apreq_version_string();
AT_not_null(vstring);
AT_str_eq(vstring, APREQ_VERSION_STRING);
}
-static void version_type(dAT)
+static void version_type(dAT, void *ctx)
{
apr_version_t v;
apreq_version(&v);
@@ -44,7 +44,7 @@ int main(int argc, char *argv[])
unsigned i, plan = 0;
dAT;
at_test_t test_list [] = {
- {"version_string", version_string, 2, "1"},
+ {"version_string", version_string, 2, NULL, "1"},
{"version_type", version_type, 4}
};