summaryrefslogtreecommitdiff
path: root/source3/lib/smbconf
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-04-09 22:23:12 +0200
committerMichael Adam <obnox@samba.org>2008-04-10 01:29:01 +0200
commit3201155e009f25c606e5ac809f5759cbda7771f4 (patch)
tree38239ab95b4d578ffa1b7b339363a68c74c9ea71 /source3/lib/smbconf
parent30fedf28557b71367ed16279353f781280e1bf69 (diff)
downloadsamba-3201155e009f25c606e5ac809f5759cbda7771f4.tar.gz
samba-3201155e009f25c606e5ac809f5759cbda7771f4.tar.bz2
samba-3201155e009f25c606e5ac809f5759cbda7771f4.zip
libsmbconf: testsuite: add test for delete_includes
Michael (This used to be commit 757601ec830f4a08c5fdcbe2d9bfac86fdc6602c)
Diffstat (limited to 'source3/lib/smbconf')
-rw-r--r--source3/lib/smbconf/testsuite.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/source3/lib/smbconf/testsuite.c b/source3/lib/smbconf/testsuite.c
index 2e833d9e26..af24dff715 100644
--- a/source3/lib/smbconf/testsuite.c
+++ b/source3/lib/smbconf/testsuite.c
@@ -118,6 +118,61 @@ done:
return ret;
}
+static bool test_delete_includes(struct smbconf_ctx *ctx)
+{
+ WERROR werr;
+ bool ret = false;
+ const char *set_includes[] = {
+ "/path/to/include",
+ };
+ uint32_t set_num_includes = 1;
+ char **get_includes = NULL;
+ uint32_t get_num_includes = 0;
+ TALLOC_CTX *mem_ctx = talloc_stackframe();
+
+ printf("test: delete_includes\n");
+
+ werr = smbconf_set_global_includes(ctx, set_num_includes, set_includes);
+ if (!W_ERROR_IS_OK(werr)) {
+ printf("failure: delete_includes (setting includes) - %s\n",
+ dos_errstr(werr));
+ goto done;
+ }
+
+ werr = smbconf_delete_global_includes(ctx);
+ if (!W_ERROR_IS_OK(werr)) {
+ printf("failure: delete_includes (deleting includes) - %s\n",
+ dos_errstr(werr));
+ goto done;
+ }
+
+ werr = smbconf_get_global_includes(ctx, mem_ctx, &get_num_includes,
+ &get_includes);
+ if (!W_ERROR_IS_OK(werr)) {
+ printf("failure: delete_includes (getting includes) - %s\n",
+ dos_errstr(werr));
+ goto done;
+ }
+
+ if (get_num_includes != 0) {
+ printf("failure: delete_includes (not empty after delete)\n");
+ goto done;
+ }
+
+ werr = smbconf_delete_global_includes(ctx);
+ if (!W_ERROR_IS_OK(werr)) {
+ printf("failuer: delete_includes (delete empty includes) - "
+ "%s\n", dos_errstr(werr));
+ goto done;
+ }
+
+ printf("success: delete_includes\n");
+ ret = true;
+
+done:
+ return ret;
+}
+
static bool torture_smbconf_txt(void)
{
WERROR werr;
@@ -167,6 +222,7 @@ static bool torture_smbconf_reg(void)
ret &= test_get_includes(conf_ctx);
ret &= test_set_get_includes(conf_ctx);
+ ret &= test_delete_includes(conf_ctx);
smbconf_shutdown(conf_ctx);