From: Andreas Schneider Date: Tue, 12 Jan 2021 11:08:18 +0000 (+0100) Subject: s3:torture: Migrate vfstest to new cmdline option parser X-Git-Tag: tevent-0.11.0~782 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=279c95cebfed3aa8adbad6edad57e5bdbad6abf2;p=thirdparty%2Fsamba.git s3:torture: Migrate vfstest to new cmdline option parser Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- diff --git a/source3/script/tests/vfstest-catia/run.sh b/source3/script/tests/vfstest-catia/run.sh index c345f11682a..bd703f63446 100755 --- a/source3/script/tests/vfstest-catia/run.sh +++ b/source3/script/tests/vfstest-catia/run.sh @@ -45,7 +45,7 @@ touch $UNIX_FILE || exit 1 # test "translate" unix-to-windows test_vfstest() { - cmd='$VFSTEST -f $TESTBASE/vfstest.cmd $MYARGS1 $MYARGS2 $ADDARGS ' + cmd='$VFSTEST --debug-stdout -f $TESTBASE/vfstest.cmd $MYARGS1 $MYARGS2 $ADDARGS ' out=`eval $cmd` ret=$? diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c index e4b6760853f..5c0ef2d073d 100644 --- a/source3/torture/vfstest.c +++ b/source3/torture/vfstest.c @@ -27,7 +27,7 @@ #include "locking/share_mode_lock.h" #include "smbd/smbd.h" #include "smbd/globals.h" -#include "popt_common.h" +#include "lib/cmdline/cmdline.h" #include "vfstest.h" #include "../libcli/smbreadline/smbreadline.h" #include "auth.h" @@ -475,6 +475,7 @@ int main(int argc, const char *argv[]) TALLOC_CTX *frame = talloc_stackframe(); struct auth_session_info *session_info = NULL; NTSTATUS status = NT_STATUS_OK; + bool ok; /* make sure the vars that get altered (4th field) are in a fixed location or certain compilers complain */ @@ -503,6 +504,7 @@ int main(int argc, const char *argv[]) .descrip = "Report memory left on talloc stackframe after each command", }, POPT_COMMON_SAMBA + POPT_COMMON_VERSION POPT_TABLEEND }; static const struct smbd_shim vfstest_shim_fns = @@ -515,7 +517,19 @@ int main(int argc, const char *argv[]) setlinebuf(stdout); - pc = poptGetContext("vfstest", argc, argv, long_options, 0); + ok = samba_cmdline_init(frame, + SAMBA_CMDLINE_CONFIG_SERVER, + true /* require_smbconf */); + if (!ok) { + TALLOC_FREE(frame); + exit(1); + } + + pc = samba_popt_get_context("vfstest", argc, argv, long_options, 0); + if (pc == NULL) { + TALLOC_FREE(frame); + exit(1); + } while(poptGetNextOpt(pc) != -1); @@ -526,15 +540,9 @@ int main(int argc, const char *argv[]) so set our umask to 0 */ umask(0); - lp_load_initial_only(get_dyn_CONFIGFILE()); - /* TODO: check output */ reload_services(NULL, NULL, false); - /* the following functions are part of the Samba debugging - facilities. See lib/debug.c */ - setup_logging("vfstest", DEBUG_STDOUT); - per_thread_cwd_check(); set_smbd_shim(&vfstest_shim_fns); diff --git a/source3/wscript_build b/source3/wscript_build index f5deff37c4b..9838809f48d 100644 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -1315,7 +1315,7 @@ bld.SAMBA3_BINARY('vfstest', ''', deps=''' vfs - popt_samba3 + CMDLINE_S3 smbconf SMBREADLINE ''',