SOC Automated Windows Testing Project

tridge at samba.org tridge at samba.org
Wed May 31 04:47:01 GMT 2006


Brad,

Here are some more detailed comments on your initial vbs scripts. I
have almost no experience with vbs, so I hope you don't mind if I
misunderstood something fundamental :-)

First off, you have very similar argv handling in all 4 scripts. I
presume you can include libraries of code in vbs, so could you have a
common.vbs that does this sort of stuff, then do something like:

  Set options = SetupOptions(argv, "username", "sharename", "sharepath");

which would then setup options.username, options.sharename,
options.sharepath, and die if it doesn't get all 3? That would make
the scripts clearer (especially if we end up with lots of these
scripts).

In this code:

    ' Check if the directory exists, and exit if it does.
    Set fileSystemObject = CreateObject("Scripting.FileSystemObject")
    if fileSystemObject.FolderExists(pathname) Then
	    stdout.Write "Error: Directory " & pathname & " exists. Exiting." 
	    WScript.Quit
    End If

You probably want something equivalent to the torture_setup_dir()
function we have in smbtorture (see torture_util.c), except written in
vbs.
    
The function would:
    
    - delete any existing file/directory of the same name, operating
    recursively for the deletion
    - create the new directory, setting up reasonable permissions
    
The reason for having a function like that is that when a test fails,
we want to be able to move onto the next test with a clean directory
without having to restore the snapshot. So if we're running 50
different tests in a row, and the 7th test fails, the remaining tests
won't fall over because some test directory is left behind from the
7th test.



    ' Share the directory.
    Set shell = WScript.CreateObject("WScript.Shell")
    netsharecmd = "net share " & sharename & "=" & pathname & " /GRANT:" _
	     & username & ",FULL"
    shell.Run netsharecmd, 7, True

Ahh, I see you are calling out to net.exe, great! I initially only
looked at your adduser script and didn't notice that.
    
what is the "7, True" btw?
    
Cheers, Tridge


More information about the samba-technical mailing list