svn commit: samba r19437 - in branches/SAMBA_4_0/source/torture/local: .

tridge at samba.org tridge at samba.org
Sat Oct 21 08:27:18 GMT 2006


Author: tridge
Date: 2006-10-21 08:27:18 +0000 (Sat, 21 Oct 2006)
New Revision: 19437

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19437

Log:

don't run the LOCAL-ICONV test on systems that don't have CP850
support

Modified:
   branches/SAMBA_4_0/source/torture/local/iconv.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/local/iconv.c
===================================================================
--- branches/SAMBA_4_0/source/torture/local/iconv.c	2006-10-21 06:56:51 UTC (rev 19436)
+++ branches/SAMBA_4_0/source/torture/local/iconv.c	2006-10-21 08:27:18 UTC (rev 19437)
@@ -108,7 +108,7 @@
   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 @@
 	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 @@
 				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 @@
 	}
 	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);
 



More information about the samba-cvs mailing list