diff options
author | Kai Blin <kai@samba.org> | 2007-12-24 13:06:57 -0600 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-26 11:57:05 -0600 |
commit | a6caca9abcf4de57901ba8ecc610cf8c13cd2821 (patch) | |
tree | b298814fca08df37aaba6fa3802944dfd57771ad /source4/torture | |
parent | 3c744ddd2c33a9a06013f357261b8ea86804e8e8 (diff) | |
download | samba-a6caca9abcf4de57901ba8ecc610cf8c13cd2821.tar.gz samba-a6caca9abcf4de57901ba8ecc610cf8c13cd2821.tar.bz2 samba-a6caca9abcf4de57901ba8ecc610cf8c13cd2821.zip |
r26589: torture: Add non-const version of torture_tcase_add_simple_test
(This used to be commit 1ae9cde5105cc4349a44e6098e9393e06acaf95d)
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/ui.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/source4/torture/ui.c b/source4/torture/ui.c index ce72dd5b08..66722a4cae 100644 --- a/source4/torture/ui.c +++ b/source4/torture/ui.c @@ -531,4 +531,36 @@ struct torture_test *torture_tcase_add_simple_test_const( return test; } +static bool wrap_test_with_simple_test(struct torture_context *torture_ctx, + struct torture_tcase *tcase, + struct torture_test *test) +{ + bool (*fn) (struct torture_context *, void *tcase_data); + + fn = test->fn; + + return fn(torture_ctx, tcase->data); +} + +struct torture_test *torture_tcase_add_simple_test(struct torture_tcase *tcase, + const char *name, + bool (*run) (struct torture_context *test, void *tcase_data)) +{ + struct torture_test *test; + + test = talloc(tcase, struct torture_test); + + test->name = talloc_strdup(test, name); + test->description = NULL; + test->run = wrap_test_with_simple_test; + test->fn = run; + test->data = NULL; + test->dangerous = false; + + DLIST_ADD_END(tcase->tests, test, struct torture_test *); + + return test; +} + + |