summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-10-21 08:27:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:21:31 -0500
commitce37cdb593f796fbd8778cb1a563bfa7bcc7befc (patch)
tree678c855dcc7401650ab7016035f8f6e54ff19029
parent1427d5012a353bd6d3a5448089a7b195ff391c39 (diff)
downloadsamba-ce37cdb593f796fbd8778cb1a563bfa7bcc7befc.tar.gz
samba-ce37cdb593f796fbd8778cb1a563bfa7bcc7befc.tar.bz2
samba-ce37cdb593f796fbd8778cb1a563bfa7bcc7befc.zip
r19437: don't run the LOCAL-ICONV test on systems that don't have CP850
support (This used to be commit bb8cdd7626ced37bb030c3474390275c433c88e0)
-rw-r--r--source4/torture/local/iconv.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/source4/torture/local/iconv.c b/source4/torture/local/iconv.c
index 8d66f4fd58..75a0945d93 100644
--- a/source4/torture/local/iconv.c
+++ b/source4/torture/local/iconv.c
@@ -108,7 +108,7 @@ static void show_buf(const char *name, uint8_t *buf, size_t size)
buffer back
*/
static bool test_buffer(struct torture_context *test,
- uint8_t *inbuf, size_t size, const char *charset)
+ uint8_t *inbuf, size_t size, const char *charset)
{
uint8_t buf1[1000], buf2[1000], buf3[1000];
size_t outsize1, outsize2, outsize3;
@@ -131,6 +131,10 @@ static bool test_buffer(struct torture_context *test,
if (!cd) {
cd = iconv_open(charset, "UTF-16LE");
if (cd == (iconv_t)-1) {
+ torture_fail(test,
+ talloc_asprintf(test,
+ "failed to open %s to UTF-16LE\n",
+ charset));
cd = NULL;
return false;
}
@@ -348,11 +352,15 @@ static bool test_random_5m(struct torture_context *tctx)
inbuf[c] |= 0xdc;
}
}
- if (!test_buffer(tctx, inbuf, size, "UTF-8"))
+ if (!test_buffer(tctx, inbuf, size, "UTF-8")) {
+ printf("i=%d failed UTF-8\n", i);
return false;
+ }
- if (!test_buffer(tctx, inbuf, size, "CP850"))
+ if (!test_buffer(tctx, inbuf, size, "CP850")) {
+ printf("i=%d failed CP850\n", i);
return false;
+ }
}
return true;
}
@@ -374,7 +382,15 @@ struct torture_suite *torture_local_iconv(TALLOC_CTX *mem_ctx)
}
iconv_close(cd);
+ cd = iconv_open("UTF-16LE", "CP850");
+ if (cd == (iconv_t)-1) {
+ printf("unable to test - system iconv library does not support UTF-16LE -> CP850\n");
+ return NULL;
+ }
+ iconv_close(cd);
+
srandom(time(NULL));
+
torture_suite_add_simple_test(suite, "next_codepoint()",
test_next_codepoint);