summaryrefslogtreecommitdiff
path: root/source4/torture/local/util_strlist.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-06-16 22:59:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:10 -0500
commit324583b28f739a545c63af235b9185a2f9b0345f (patch)
tree0e39a85c0f1f13d7611ff496c57f5f59d62beb44 /source4/torture/local/util_strlist.c
parent69270cfff6e9eaa527969ce805471b200cfbf7fb (diff)
downloadsamba-324583b28f739a545c63af235b9185a2f9b0345f.tar.gz
samba-324583b28f739a545c63af235b9185a2f9b0345f.tar.bz2
samba-324583b28f739a545c63af235b9185a2f9b0345f.zip
r16316: Convert to new torture UI API.
(This used to be commit ff87504c41e76a14b95a2063a4eb62d96fb02127)
Diffstat (limited to 'source4/torture/local/util_strlist.c')
-rw-r--r--source4/torture/local/util_strlist.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/source4/torture/local/util_strlist.c b/source4/torture/local/util_strlist.c
index 78ebcf44fb..5887c01c6a 100644
--- a/source4/torture/local/util_strlist.c
+++ b/source4/torture/local/util_strlist.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "torture/torture.h"
+#include "torture/ui.h"
static const char *test_lists_shell_strings[] = {
"",
@@ -33,38 +34,34 @@ static const char *test_lists_shell_strings[] = {
NULL
};
-static BOOL test_lists_shell(TALLOC_CTX *mem_ctx)
+static BOOL test_lists_shell(struct torture_context *test, const void *_data)
{
- int i;
- for (i = 0; test_lists_shell_strings[i]; i++) {
- const char **ret1, **ret2, *tmp;
- BOOL match = True;
+ const char *data = _data;
+ const char **ret1, **ret2, *tmp;
+ BOOL match = True;
- ret1 = str_list_make_shell(mem_ctx, test_lists_shell_strings[i], " ");
- tmp = str_list_join_shell(mem_ctx, ret1, ' ');
- ret2 = str_list_make_shell(mem_ctx, tmp, " ");
-
- if ((ret1 == NULL || ret2 == NULL) && ret2 != ret1) {
- match = False;
- } else {
- int j;
- for (j = 0; ret1[j] && ret2[j]; j++) {
- if (strcmp(ret1[j], ret2[j]) != 0) {
- match = False;
- break;
- }
- }
+ ret1 = str_list_make_shell(test, data, " ");
+ tmp = str_list_join_shell(test, ret1, ' ');
+ ret2 = str_list_make_shell(test, tmp, " ");
- if (ret1[j] || ret2[j])
+ if ((ret1 == NULL || ret2 == NULL) && ret2 != ret1) {
+ match = False;
+ } else {
+ int j;
+ for (j = 0; ret1[j] && ret2[j]; j++) {
+ if (strcmp(ret1[j], ret2[j]) != 0) {
match = False;
+ break;
+ }
}
- if (!match) {
- printf("str_list_{make,join}_shell: Error double parsing, first run:\n%s\nSecond run: \n%s\n",
- test_lists_shell_strings[i],
- tmp);
- return False;
- }
+ if (ret1[j] || ret2[j])
+ match = False;
+ }
+
+ if (!match) {
+ torture_fail(test, "str_list_{make,join}_shell: Error double parsing, first run:\n%s\nSecond run: \n%s", data, tmp);
+ return False;
}
return True;
@@ -72,11 +69,14 @@ static BOOL test_lists_shell(TALLOC_CTX *mem_ctx)
BOOL torture_local_util_strlist(struct torture_context *torture)
{
- BOOL ret = True;
- TALLOC_CTX *mem_ctx = talloc_init("test_util_strlist");
+ struct torture_suite *suite = torture_suite_create(torture, "util_strlist");
+ int i;
- ret &= test_lists_shell(mem_ctx);
- talloc_free(mem_ctx);
+ for (i = 0; test_lists_shell_strings[i]; i++) {
+ torture_suite_add_simple_tcase(suite,
+ "lists_shell", test_lists_shell,
+ &test_lists_shell_strings[i]);
+ }
- return ret;
+ return torture_run_suite(torture, suite);
}