1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

lib/util/charset Run charset sets with and without the system iconv

We need to know that we can load the samba-provided modules, and that
they are correct.  However, we must mark a number of tests as
knownfail due to errors in our internal iconv modules.

Andrew Bartlett
This commit is contained in:
Andrew Bartlett 2011-09-10 09:53:29 +10:00
parent fc6bb5d47a
commit 2085dffddb
5 changed files with 37 additions and 14 deletions

View File

@ -182,7 +182,8 @@ extern struct smb_iconv_handle *global_iconv_handle;
struct smb_iconv_handle *get_iconv_handle(void); struct smb_iconv_handle *get_iconv_handle(void);
struct smb_iconv_handle *get_iconv_testing_handle(TALLOC_CTX *mem_ctx, struct smb_iconv_handle *get_iconv_testing_handle(TALLOC_CTX *mem_ctx,
const char *dos_charset, const char *dos_charset,
const char *unix_charset); const char *unix_charset,
bool native_iconv);
smb_iconv_t get_conv_handle(struct smb_iconv_handle *ic, smb_iconv_t get_conv_handle(struct smb_iconv_handle *ic,
charset_t from, charset_t to); charset_t from, charset_t to);
const char *charset_name(struct smb_iconv_handle *ic, charset_t ch); const char *charset_name(struct smb_iconv_handle *ic, charset_t ch);

View File

@ -174,10 +174,11 @@ struct smb_iconv_handle *get_iconv_handle(void)
struct smb_iconv_handle *get_iconv_testing_handle(TALLOC_CTX *mem_ctx, struct smb_iconv_handle *get_iconv_testing_handle(TALLOC_CTX *mem_ctx,
const char *dos_charset, const char *dos_charset,
const char *unix_charset) const char *unix_charset,
bool native_iconv)
{ {
return smb_iconv_handle_reinit(mem_ctx, return smb_iconv_handle_reinit(mem_ctx,
dos_charset, unix_charset, true, NULL); dos_charset, unix_charset, native_iconv, NULL);
} }
/** /**

View File

@ -21,6 +21,7 @@
#include "includes.h" #include "includes.h"
#include "torture/torture.h" #include "torture/torture.h"
#include "lib/util/charset/charset.h" #include "lib/util/charset/charset.h"
#include "param/param.h"
/* The text below is in ancient and a latin charset transliteration of /* The text below is in ancient and a latin charset transliteration of
* greek, and an english translation. It from Apology by Plato and sourced from * greek, and an english translation. It from Apology by Plato and sourced from
@ -105,7 +106,8 @@ static bool test_gd_iso8859_cp850_handle(struct torture_context *tctx)
talloc_steal(tctx, gd_iso8859_1.data); talloc_steal(tctx, gd_iso8859_1.data);
talloc_steal(tctx, gd_utf16le.data); talloc_steal(tctx, gd_utf16le.data);
iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850"); iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850",
lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
torture_assert(tctx, iconv_handle, "getting iconv handle"); torture_assert(tctx, iconv_handle, "getting iconv handle");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
@ -297,7 +299,8 @@ static bool test_gd_minus_1_handle(struct torture_context *tctx)
talloc_steal(tctx, gd_cp850.data); talloc_steal(tctx, gd_cp850.data);
talloc_steal(tctx, gd_utf16le.data); talloc_steal(tctx, gd_utf16le.data);
iconv_handle = get_iconv_testing_handle(tctx, "CP850", "CP850"); iconv_handle = get_iconv_testing_handle(tctx, "CP850", "CP850",
lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
torture_assert(tctx, iconv_handle, "getting iconv handle"); torture_assert(tctx, iconv_handle, "getting iconv handle");
gd_utf8_terminated = data_blob_talloc(tctx, NULL, gd_utf8.length + 1); gd_utf8_terminated = data_blob_talloc(tctx, NULL, gd_utf8.length + 1);
@ -481,7 +484,8 @@ static bool test_gd_ascii_handle(struct torture_context *tctx)
talloc_steal(tctx, gd_iso8859_1.data); talloc_steal(tctx, gd_iso8859_1.data);
talloc_steal(tctx, gd_utf16le.data); talloc_steal(tctx, gd_utf16le.data);
iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8"); iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8",
lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
torture_assert(tctx, iconv_handle, "getting iconv handle"); torture_assert(tctx, iconv_handle, "getting iconv handle");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
@ -550,7 +554,8 @@ static bool test_plato_english_iso8859_cp850_handle(struct torture_context *tctx
talloc_steal(tctx, plato_english_utf16le.data); talloc_steal(tctx, plato_english_utf16le.data);
iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850"); iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850",
lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
torture_assert(tctx, iconv_handle, "getting iconv handle"); torture_assert(tctx, iconv_handle, "getting iconv handle");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
@ -668,7 +673,8 @@ static bool test_plato_english_minus_1_handle(struct torture_context *tctx)
talloc_steal(tctx, plato_english_utf16le.data); talloc_steal(tctx, plato_english_utf16le.data);
iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850"); iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850",
lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
torture_assert(tctx, iconv_handle, "getting iconv handle"); torture_assert(tctx, iconv_handle, "getting iconv handle");
plato_english_utf8_terminated = data_blob_talloc(tctx, NULL, plato_english_utf8.length + 1); plato_english_utf8_terminated = data_blob_talloc(tctx, NULL, plato_english_utf8.length + 1);
@ -809,7 +815,8 @@ static bool test_plato_minus_1_handle(struct torture_context *tctx)
talloc_steal(tctx, plato_utf8.data); talloc_steal(tctx, plato_utf8.data);
talloc_steal(tctx, plato_utf16le.data); talloc_steal(tctx, plato_utf16le.data);
iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850"); iconv_handle = get_iconv_testing_handle(tctx, "ISO8859-1", "CP850",
lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
torture_assert(tctx, iconv_handle, "getting iconv handle"); torture_assert(tctx, iconv_handle, "getting iconv handle");
plato_utf8_terminated = data_blob_talloc(tctx, NULL, plato_utf8.length + 1); plato_utf8_terminated = data_blob_talloc(tctx, NULL, plato_utf8.length + 1);
@ -923,7 +930,8 @@ static bool test_plato_cp850_utf8_handle(struct torture_context *tctx)
talloc_steal(tctx, plato_utf8.data); talloc_steal(tctx, plato_utf8.data);
talloc_steal(tctx, plato_utf16le.data); talloc_steal(tctx, plato_utf16le.data);
iconv_handle = get_iconv_testing_handle(tctx, "CP850", "UTF8"); iconv_handle = get_iconv_testing_handle(tctx, "CP850", "UTF8",
lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
torture_assert(tctx, iconv_handle, "creating iconv handle"); torture_assert(tctx, iconv_handle, "creating iconv handle");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
@ -1114,7 +1122,8 @@ static bool test_plato_latin_cp850_utf8_handle(struct torture_context *tctx)
talloc_steal(tctx, plato_latin_utf8.data); talloc_steal(tctx, plato_latin_utf8.data);
talloc_steal(tctx, plato_latin_utf16le.data); talloc_steal(tctx, plato_latin_utf16le.data);
iconv_handle = get_iconv_testing_handle(tctx, "CP850", "UTF8"); iconv_handle = get_iconv_testing_handle(tctx, "CP850", "UTF8",
lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
torture_assert(tctx, iconv_handle, "creating iconv handle"); torture_assert(tctx, iconv_handle, "creating iconv handle");
torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle, torture_assert(tctx, convert_string_talloc_handle(tctx, iconv_handle,
@ -1182,7 +1191,8 @@ static bool test_gd_case_utf8_handle(struct torture_context *tctx)
char *gd_lower, *gd_upper; char *gd_lower, *gd_upper;
talloc_steal(tctx, gd_utf8.data); talloc_steal(tctx, gd_utf8.data);
iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8"); iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8",
lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
torture_assert(tctx, iconv_handle, "getting utf8 iconv handle"); torture_assert(tctx, iconv_handle, "getting utf8 iconv handle");
torture_assert(tctx, torture_assert(tctx,
@ -1245,7 +1255,8 @@ static bool test_gd_case_cp850_handle(struct torture_context *tctx)
char *gd_lower, *gd_upper; char *gd_lower, *gd_upper;
talloc_steal(tctx, gd_cp850.data); talloc_steal(tctx, gd_cp850.data);
iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "CP850"); iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "CP850",
lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
torture_assert(tctx, iconv_handle, "getting cp850 iconv handle"); torture_assert(tctx, iconv_handle, "getting cp850 iconv handle");
torture_assert(tctx, torture_assert(tctx,
@ -1306,7 +1317,8 @@ static bool test_plato_case_utf8_handle(struct torture_context *tctx)
char *plato_lower, *plato_upper; char *plato_lower, *plato_upper;
talloc_steal(tctx, plato_utf8.data); talloc_steal(tctx, plato_utf8.data);
iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8"); iconv_handle = get_iconv_testing_handle(tctx, "ASCII", "UTF8",
lpcfg_parm_bool(tctx->lp_ctx, NULL, "iconv", "native", true));
torture_assert(tctx, iconv_handle, "getting utf8 iconv handle"); torture_assert(tctx, iconv_handle, "getting utf8 iconv handle");
torture_assert(tctx, torture_assert(tctx,

View File

@ -5,6 +5,9 @@
# a successful run for any of these tests an error. # a successful run for any of these tests an error.
^samba4.local.resolve.*.async ^samba4.local.resolve.*.async
^samba4.local.iconv.*.next_codepoint() ^samba4.local.iconv.*.next_codepoint()
^samba4.local.iconv.5M random UTF-16LE sequences # Fails because our CP850 module returns the wrong error codes
^samba4.local.convert_string_handle.iconv.modules.plato_cp850_utf8
^samba4.local.convert_string.iconv.modules.plato
^samba4..*base.delete.*.deltest17 ^samba4..*base.delete.*.deltest17
^samba4..*base.delete.*.deltest20a ^samba4..*base.delete.*.deltest20a
^samba4..*base.delete.*.deltest20b ^samba4..*base.delete.*.deltest20b

View File

@ -267,6 +267,12 @@ plansmbtorturetestsuite('echo.udp', 'dc:local', '//$SERVER/whatever')
for t in smb4torture_testsuites("local."): for t in smb4torture_testsuites("local."):
plansmbtorturetestsuite(t, "none", "ncalrpc:") plansmbtorturetestsuite(t, "none", "ncalrpc:")
# Confirm these tests with the system iconv too
for t in ["local.convert_string_handle", "local.convert_string", "local.ndr"]:
modname = "samba4.%s.iconv.modules" % t
cmdline = "%s %s %s" % (valgrindify(smb4torture), "ncalrpc: --option='iconv:native=false'", t)
plantestsuite_loadlist(modname, env, cmdline)
tdbtorture4 = binpath("tdbtorture") tdbtorture4 = binpath("tdbtorture")
if os.path.exists(tdbtorture4): if os.path.exists(tdbtorture4):
plantestsuite("tdb.stress", "none", valgrindify(tdbtorture4)) plantestsuite("tdb.stress", "none", valgrindify(tdbtorture4))