2 Unix SMB/CIFS implementation.
4 local testing of torture
6 Copyright (C) Jelmer Vernooij 2006
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "torture/torture.h"
24 #include "system/wait.h"
25 #include "lib/events/events.h"
26 #include "libcli/raw/libcliraw.h"
27 #include "torture/util.h"
28 #include "param/provision.h"
30 static bool test_tempdir(struct torture_context *tctx)
32 char *location = NULL;
33 TALLOC_CTX *mem_ctx = tctx;
35 torture_assert_ntstatus_ok(tctx, torture_temp_dir(mem_ctx, "tempdir", &location),
36 "torture_temp_dir should return NT_STATUS_OK" );
38 torture_assert(tctx, directory_exist(location),
39 "created dir doesn't exist");
43 static bool test_provision(struct torture_context *tctx)
46 struct provision_settings *settings = talloc(tctx, struct provision_settings);
47 struct provision_result result;
48 char *targetdir = NULL;
50 torture_assert_ntstatus_ok(tctx, torture_temp_dir(tctx, "torture_provision", &targetdir),
51 "torture_temp_dir should return NT_STATUS_OK" );
52 settings->targetdir = talloc_steal(settings, targetdir);
54 settings->dns_name = "example.com";
55 settings->site_name = "SOME-SITE-NAME";
56 settings->root_dn_str = "DC=EXAMPLE,DC=COM";
57 settings->domain_dn_str = "DC=EXAMPLE,DC=COM";
58 settings->config_dn_str = NULL;
59 settings->schema_dn_str = NULL;
60 settings->invocation_id = NULL;
61 settings->netbios_name = "FOO";
62 settings->realm = "EXAMPLE.COM";
63 settings->domain = "EXAMPLE";
64 settings->ntds_guid = NULL;
65 settings->ntds_dn_str = NULL;
66 settings->machine_password = "geheim";
68 status = provision_bare(settings, tctx->lp_ctx, settings, &result);
70 torture_assert_ntstatus_ok(tctx, status, "provision");
72 torture_assert_str_equal(tctx, result.domaindn, "DC=EXAMPLE,DC=COM",
73 "domaindn incorrect");
78 struct torture_suite *torture_local_torture(TALLOC_CTX *mem_ctx)
80 struct torture_suite *suite = torture_suite_create(mem_ctx,
83 torture_suite_add_simple_test(suite, "tempdir", test_tempdir);
84 torture_suite_add_simple_test(suite, "provision", test_provision);