mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
r16527: Add target argument for smbtorture.
Remove duplicate unc path separator conversion.
Add prefix for tempdirs.
(This used to be commit 3763ed3092
)
This commit is contained in:
parent
6b749f225e
commit
1afab0e36f
@ -62,7 +62,7 @@ TORTURE_INTERFACES='127.0.0.26/8,127.0.0.27/8,127.0.0.28/8,127.0.0.29/8,127.0.0.
|
|||||||
TORTURE_OPTIONS="--option=interfaces=$TORTURE_INTERFACES $CONFIGURATION"
|
TORTURE_OPTIONS="--option=interfaces=$TORTURE_INTERFACES $CONFIGURATION"
|
||||||
# ensure any one smbtorture call doesn't run too long
|
# ensure any one smbtorture call doesn't run too long
|
||||||
TORTURE_OPTIONS="$TORTURE_OPTIONS --maximum-runtime=$TORTURE_MAXTIME"
|
TORTURE_OPTIONS="$TORTURE_OPTIONS --maximum-runtime=$TORTURE_MAXTIME"
|
||||||
TORTURE_OPTIONS="$TORTURE_OPTIONS --option=target:samba4=yes"
|
TORTURE_OPTIONS="$TORTURE_OPTIONS --target=samba4"
|
||||||
export TORTURE_OPTIONS
|
export TORTURE_OPTIONS
|
||||||
|
|
||||||
if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
|
if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
|
||||||
|
@ -30,7 +30,7 @@ static BOOL test_tempdir(struct torture_context *torture,
|
|||||||
{
|
{
|
||||||
char *location = NULL;
|
char *location = NULL;
|
||||||
|
|
||||||
torture_assert_ntstatus_ok(torture, torture_temp_dir(torture, &location),
|
torture_assert_ntstatus_ok(torture, torture_temp_dir(torture, "tempdir", &location),
|
||||||
"torture_temp_dir should return NT_STATUS_OK" );
|
"torture_temp_dir should return NT_STATUS_OK" );
|
||||||
|
|
||||||
torture_assert(torture, directory_exist(location),
|
torture_assert(torture, directory_exist(location),
|
||||||
@ -45,6 +45,7 @@ static BOOL test_setup_server(struct torture_context *torture,
|
|||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
torture_assert_ntstatus_ok(torture, torture_setup_server(torture,
|
torture_assert_ntstatus_ok(torture, torture_setup_server(torture,
|
||||||
|
"setupserver-success",
|
||||||
"./script/tests/mktestsetup.sh",
|
"./script/tests/mktestsetup.sh",
|
||||||
"./bin/smbd", &pid),
|
"./bin/smbd", &pid),
|
||||||
"starting smbd failed");
|
"starting smbd failed");
|
||||||
@ -58,6 +59,7 @@ static BOOL test_setup_server(struct torture_context *torture,
|
|||||||
waitpid(pid, NULL, 0);
|
waitpid(pid, NULL, 0);
|
||||||
|
|
||||||
torture_assert_ntstatus_equal(torture, torture_setup_server(torture,
|
torture_assert_ntstatus_equal(torture, torture_setup_server(torture,
|
||||||
|
"setupserver-fail",
|
||||||
"./invalid-script",
|
"./invalid-script",
|
||||||
"./bin/smbd", &pid),
|
"./bin/smbd", &pid),
|
||||||
NT_STATUS_UNSUCCESSFUL,
|
NT_STATUS_UNSUCCESSFUL,
|
||||||
|
@ -371,13 +371,13 @@ const static struct torture_ui_ops quiet_ui_ops = {
|
|||||||
int main(int argc,char *argv[])
|
int main(int argc,char *argv[])
|
||||||
{
|
{
|
||||||
int opt, i;
|
int opt, i;
|
||||||
char *p;
|
|
||||||
BOOL correct = True;
|
BOOL correct = True;
|
||||||
int max_runtime=0;
|
int max_runtime=0;
|
||||||
int argc_new;
|
int argc_new;
|
||||||
struct torture_context *torture;
|
struct torture_context *torture;
|
||||||
char **argv_new;
|
char **argv_new;
|
||||||
poptContext pc;
|
poptContext pc;
|
||||||
|
static const char *target = "other";
|
||||||
static const char *ui_ops_name = "simple";
|
static const char *ui_ops_name = "simple";
|
||||||
enum {OPT_LOADFILE=1000,OPT_UNCLIST,OPT_TIMELIMIT,OPT_DNS,
|
enum {OPT_LOADFILE=1000,OPT_UNCLIST,OPT_TIMELIMIT,OPT_DNS,
|
||||||
OPT_DANGEROUS,OPT_SMB_PORTS,OPT_ASYNC};
|
OPT_DANGEROUS,OPT_SMB_PORTS,OPT_ASYNC};
|
||||||
@ -399,6 +399,7 @@ const static struct torture_ui_ops quiet_ui_ops = {
|
|||||||
{"parse-dns", 'D', POPT_ARG_STRING, NULL, OPT_DNS, "parse-dns", NULL},
|
{"parse-dns", 'D', POPT_ARG_STRING, NULL, OPT_DNS, "parse-dns", NULL},
|
||||||
{"dangerous", 'X', POPT_ARG_NONE, NULL, OPT_DANGEROUS,
|
{"dangerous", 'X', POPT_ARG_NONE, NULL, OPT_DANGEROUS,
|
||||||
"run dangerous tests (eg. wiping out password database)", NULL},
|
"run dangerous tests (eg. wiping out password database)", NULL},
|
||||||
|
{"target", 'T', POPT_ARG_STRING, &target, 0, "samba4|other", NULL},
|
||||||
{"async", 'a', POPT_ARG_NONE, NULL, OPT_ASYNC,
|
{"async", 'a', POPT_ARG_NONE, NULL, OPT_ASYNC,
|
||||||
"run async tests", NULL},
|
"run async tests", NULL},
|
||||||
{"num-async", 0, POPT_ARG_INT, &torture_numasync, 0,
|
{"num-async", 0, POPT_ARG_INT, &torture_numasync, 0,
|
||||||
@ -490,9 +491,8 @@ const static struct torture_ui_ops quiet_ui_ops = {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(p = argv_new[1]; *p; p++) {
|
if (!strcmp(target, "samba4")) {
|
||||||
if(*p == '\\')
|
lp_set_cmdline("target:samba4", "true");
|
||||||
*p = '/';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* see if its a RPC transport specifier */
|
/* see if its a RPC transport specifier */
|
||||||
|
@ -63,6 +63,8 @@ struct torture_context
|
|||||||
|
|
||||||
enum torture_result last_result;
|
enum torture_result last_result;
|
||||||
char *last_reason;
|
char *last_reason;
|
||||||
|
|
||||||
|
char *outputdir;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct torture_suite
|
struct torture_suite
|
||||||
|
@ -26,9 +26,10 @@
|
|||||||
/**
|
/**
|
||||||
create a temporary directory.
|
create a temporary directory.
|
||||||
*/
|
*/
|
||||||
_PUBLIC_ NTSTATUS torture_temp_dir(TALLOC_CTX *mem_ctx, char **tempdir)
|
_PUBLIC_ NTSTATUS torture_temp_dir(TALLOC_CTX *mem_ctx, const char *prefix,
|
||||||
|
char **tempdir)
|
||||||
{
|
{
|
||||||
*tempdir = talloc_strdup(mem_ctx, "torture-tmp.XXXXXX");
|
*tempdir = talloc_asprintf(mem_ctx, "torture.tmp-%s.XXXXXX", prefix);
|
||||||
|
|
||||||
if (mkdtemp(*tempdir) == NULL)
|
if (mkdtemp(*tempdir) == NULL)
|
||||||
return NT_STATUS_UNSUCCESSFUL;
|
return NT_STATUS_UNSUCCESSFUL;
|
||||||
@ -48,6 +49,7 @@ BOOL nt_time_equal(NTTIME *t1, NTTIME *t2)
|
|||||||
* Provision a Samba installation using @param setupdir_script and start smbd.
|
* Provision a Samba installation using @param setupdir_script and start smbd.
|
||||||
*/
|
*/
|
||||||
NTSTATUS torture_setup_server(TALLOC_CTX *mem_ctx,
|
NTSTATUS torture_setup_server(TALLOC_CTX *mem_ctx,
|
||||||
|
const char *prefix,
|
||||||
const char *setupdir_script,
|
const char *setupdir_script,
|
||||||
const char *smbd_path,
|
const char *smbd_path,
|
||||||
pid_t *smbd_pid)
|
pid_t *smbd_pid)
|
||||||
@ -61,7 +63,7 @@ NTSTATUS torture_setup_server(TALLOC_CTX *mem_ctx,
|
|||||||
|
|
||||||
*smbd_pid = -1;
|
*smbd_pid = -1;
|
||||||
|
|
||||||
status = torture_temp_dir(mem_ctx, &tempdir);
|
status = torture_temp_dir(mem_ctx, prefix, &tempdir);
|
||||||
if (NT_STATUS_IS_ERR(status)) {
|
if (NT_STATUS_IS_ERR(status)) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user