2003-08-13 01:53:07 +00:00
/*
Unix SMB / CIFS implementation .
SMB torture tester
Copyright ( C ) Andrew Tridgell 1997 - 2003
2006-03-14 15:02:05 +00:00
Copyright ( C ) Jelmer Vernooij 2006
2003-08-13 01:53:07 +00:00
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 02:07:03 +00:00
the Free Software Foundation ; either version 3 of the License , or
2003-08-13 01:53:07 +00: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 02:07:03 +00:00
along with this program . If not , see < http : //www.gnu.org/licenses/>.
2003-08-13 01:53:07 +00:00
*/
# include "includes.h"
2004-11-02 00:24:21 +00:00
# include "system/time.h"
2006-03-25 16:01:28 +00:00
# include "torture/torture.h"
2006-03-13 21:21:44 +00:00
# include "build.h"
2006-08-30 11:29:34 +00:00
# include "lib/util/dlinklist.h"
2007-05-17 08:47:04 +00:00
# include "auth/credentials/credentials.h"
# include "lib/cmdline/popt_common.h"
2007-09-08 12:42:09 +00:00
# include "param/param.h"
2006-02-04 14:08:24 +00:00
2006-03-17 16:11:02 +00:00
_PUBLIC_ int torture_numops = 10 ;
_PUBLIC_ int torture_entries = 1000 ;
_PUBLIC_ int torture_failures = 1 ;
_PUBLIC_ int torture_seed = 0 ;
2006-05-05 09:52:12 +00:00
_PUBLIC_ int torture_numasync = 100 ;
2003-08-13 01:53:07 +00:00
2007-08-31 19:06:30 +00:00
struct torture_suite * torture_root = NULL ;
2006-03-13 21:21:44 +00:00
2006-10-16 23:09:15 +00:00
bool torture_register_suite ( struct torture_suite * suite )
2006-03-13 21:21:44 +00:00
{
2006-10-16 23:09:15 +00:00
if ( ! suite )
return true ;
2006-03-13 21:21:44 +00:00
2007-08-31 18:35:30 +00:00
if ( torture_root = = NULL )
torture_root = talloc_zero ( talloc_autofree_context ( ) , struct torture_suite ) ;
2006-10-16 23:09:15 +00:00
return torture_suite_add_suite ( torture_root , suite ) ;
2006-03-13 21:21:44 +00:00
}
2003-08-13 01:53:07 +00:00
2006-10-17 22:06:43 +00:00
struct torture_context * torture_context_init ( TALLOC_CTX * mem_ctx ,
2007-05-17 08:47:04 +00:00
const struct torture_ui_ops * ui_ops )
2006-10-17 22:06:43 +00:00
{
struct torture_context * torture = talloc_zero ( mem_ctx ,
2007-05-17 08:47:04 +00:00
struct torture_context ) ;
2006-10-17 22:06:43 +00:00
torture - > ui_ops = ui_ops ;
2007-01-31 00:30:52 +00:00
torture - > returncode = true ;
2007-05-17 08:47:04 +00:00
torture - > ev = cli_credentials_get_event_context ( cmdline_credentials ) ;
2006-10-17 22:06:43 +00:00
2007-03-05 21:28:55 +00:00
if ( ui_ops - > init )
ui_ops - > init ( torture ) ;
2006-10-17 22:06:43 +00:00
return torture ;
}
2006-03-17 16:27:22 +00:00
int torture_init ( void )
2003-08-13 01:53:07 +00:00
{
2006-03-17 16:27:22 +00:00
init_module_fn static_init [ ] = STATIC_torture_MODULES ;
2007-10-01 18:52:55 +00:00
init_module_fn * shared_init = load_samba_modules ( NULL , global_loadparm , " torture " ) ;
2006-10-16 23:09:15 +00:00
2006-03-13 21:21:44 +00:00
run_init_functions ( static_init ) ;
run_init_functions ( shared_init ) ;
talloc_free ( shared_init ) ;
2006-03-17 16:27:22 +00:00
return 0 ;
2003-08-13 01:53:07 +00:00
}