2006-06-26 15:33:37 +04:00
/*
Unix SMB / CIFS implementation .
local testing of torture
Copyright ( C ) Jelmer Vernooij 2006
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
2007-07-10 06:07:03 +04:00
the Free Software Foundation ; either version 3 of the License , or
2006-06-26 15:33:37 +04:00
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
2007-07-10 06:07:03 +04:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2006-06-26 15:33:37 +04:00
*/
# include "includes.h"
# include "torture/torture.h"
2006-06-26 23:30:00 +04:00
# include "system/wait.h"
2006-07-12 06:02:07 +04:00
# include "lib/events/events.h"
# include "libcli/raw/libcliraw.h"
2008-02-15 17:53:06 +03:00
# include "torture/util.h"
2006-06-26 15:33:37 +04:00
2006-10-16 17:06:41 +04:00
static bool test_tempdir ( struct torture_context * tctx )
2006-06-26 15:33:37 +04:00
{
char * location = NULL ;
2006-10-16 17:06:41 +04:00
TALLOC_CTX * mem_ctx = tctx ;
2006-06-26 15:33:37 +04:00
2006-10-16 17:06:41 +04:00
torture_assert_ntstatus_ok ( tctx , torture_temp_dir ( mem_ctx , " tempdir " , & location ) ,
2006-06-26 15:33:37 +04:00
" torture_temp_dir should return NT_STATUS_OK " ) ;
2006-10-16 17:06:41 +04:00
torture_assert ( tctx , directory_exist ( location ) ,
2006-06-26 15:33:37 +04:00
" created dir doesn't exist " ) ;
2006-10-16 17:06:41 +04:00
return true ;
2006-06-26 15:33:37 +04:00
}
2008-02-15 03:37:57 +03:00
static bool test_provision ( struct torture_context * tctx )
{
NTSTATUS status ;
2008-02-15 17:14:55 +03:00
struct provision_settings settings ;
2008-02-15 03:37:57 +03:00
2008-02-15 17:14:55 +03:00
settings . dns_name = " example.com " ;
settings . site_name = " SOME-SITE-NAME " ;
settings . root_dn_str = " DC=EXAMPLE,DC=COM " ;
settings . domain_dn_str = " DC=EXAMPLE,DC=COM " ;
settings . config_dn_str = NULL ;
settings . schema_dn_str = NULL ;
settings . invocation_id = NULL ;
settings . netbios_name = " FOO " ;
settings . realm = " EXAMPLE.COM " ;
settings . domain = " EXAMPLE " ;
settings . ntds_guid = NULL ;
settings . ntds_dn_str = NULL ;
settings . machine_password = " geheim " ;
settings . samdb_ldb = NULL ;
settings . secrets_ldb = NULL ;
settings . secrets_keytab = NULL ;
settings . schemadn_ldb = NULL ;
settings . configdn_ldb = NULL ;
settings . domaindn_ldb = NULL ;
settings . templates_ldb = NULL ;
settings . dns_keytab = NULL ;
2008-02-15 03:37:57 +03:00
2008-02-15 17:14:55 +03:00
status = provision_bare ( tctx , tctx - > lp_ctx , & settings ) ;
2008-02-15 03:37:57 +03:00
torture_assert_ntstatus_ok ( tctx , status , " provision " ) ;
return true ;
}
2006-06-26 15:33:37 +04:00
struct torture_suite * torture_local_torture ( TALLOC_CTX * mem_ctx )
{
struct torture_suite * suite = torture_suite_create ( mem_ctx ,
2006-10-16 17:06:41 +04:00
" TORTURE " ) ;
2006-06-26 15:33:37 +04:00
2006-10-16 17:06:41 +04:00
torture_suite_add_simple_test ( suite , " tempdir " , test_tempdir ) ;
2008-02-15 03:37:57 +03:00
torture_suite_add_simple_test ( suite , " provision " , test_provision ) ;
2006-06-26 15:33:37 +04:00
return suite ;
}