s3:torture: Migrate vfstest to new cmdline option parser
authorAndreas Schneider <asn@samba.org>
Tue, 12 Jan 2021 11:08:18 +0000 (12:08 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 20 May 2021 02:58:36 +0000 (02:58 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/script/tests/vfstest-catia/run.sh
source3/torture/vfstest.c
source3/wscript_build

index c345f11682a38e2487f4ffed16f29127846611a9..bd703f634469f3f57b5f61b4a84b5591968f4f37 100755 (executable)
@@ -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=$?
 
index e4b6760853f6945bec1308a44b7e12e04ef54ea9..5c0ef2d073d4577d8a063ca0e23601d4a7188b21 100644 (file)
@@ -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);
index f5deff37c4b2f1db2d66c27e9a2dc4c06bd6c533..9838809f48ddfbea2af31a1f100ef6bb4017c17c 100644 (file)
@@ -1315,7 +1315,7 @@ bld.SAMBA3_BINARY('vfstest',
                         ''',
                  deps='''
                       vfs
-                      popt_samba3
+                      CMDLINE_S3
                       smbconf
                       SMBREADLINE
                       ''',