diff options
Diffstat (limited to 'testsuite/lib')
-rw-r--r-- | testsuite/lib/compile.exp | 78 | ||||
-rw-r--r-- | testsuite/lib/default-nt-names.exp | 20 | ||||
-rw-r--r-- | testsuite/lib/env-single.exp | 36 | ||||
-rw-r--r-- | testsuite/lib/nsswitch-config.exp | 21 | ||||
-rw-r--r-- | testsuite/lib/smbclient.exp | 54 |
5 files changed, 209 insertions, 0 deletions
diff --git a/testsuite/lib/compile.exp b/testsuite/lib/compile.exp new file mode 100644 index 0000000000..7dae87d213 --- /dev/null +++ b/testsuite/lib/compile.exp @@ -0,0 +1,78 @@ +# +# Compilation utility functions +# + +# +# Unix SMB/Netbios implementation. +# Copyright (C) Tim Potter 2000 +# +# 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 +# the Free Software Foundation; either version 3 of the License, or +# (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 +# along with this program; if not, see <http://www.gnu.org/licenses/>. +# + +# Compile a program consisting of one .c file. For example +# simple_compile "foo" will compile foo.c to the executable foo.exe +# Use a second argument to specify link libraries. + +proc simple_compile { args } { + global srcdir + global subdir + + # Compile up program + + set program [lindex $args 0] + set libs [lindex $args 1] + + if { $libs == "" } { + + set output [target_compile "$srcdir/$subdir/$program.c" \ + "$srcdir/$subdir/$program" executable \ + {additional_flags="-g"}] + } else { + + set output [target_compile "$srcdir/$subdir/$program.c" \ + "$srcdir/$subdir/$program" executable \ + [list libs=$libs additional_flags="-g"]] + } + + # Check for errors + + if {$output != ""} { + perror "compile $program" + puts $output + return -1 + } +} + +# Compile a program from a Makefile.suffix + +proc simple_make { args } { + global srcdir + global subdir + + # Compile up program with make + + set suffix [lindex $args 0] + set program [lindex $args 1] + + set output [util_start "make" \ + "-C $srcdir/$subdir -f Makefile.$suffix $program"] + + # Check for errors + + if { [regexp "Error" $output] } { + perror "make $program" + puts $output + return -1 + } +} diff --git a/testsuite/lib/default-nt-names.exp b/testsuite/lib/default-nt-names.exp new file mode 100644 index 0000000000..5d01d2a5bb --- /dev/null +++ b/testsuite/lib/default-nt-names.exp @@ -0,0 +1,20 @@ +# +# A list of default domain/local users/groups. Unfortunately this is tied +# to the English language version of Windows NT. +# + +global domain + +# Domain users and groups + +set domain_users [list "$domain/Administrator" "$domain/Guest"] + +set domain_groups [list "$domain/Domain Admins" "$domain/Domain Guests" \ + "$domain/Domain Users"] + +# Local groups + +set local_groups [list "BUILTIN/Replicator" "BUILTIN/Server Operators" \ + "BUILTIN/Account Operators" "BUILTIN/Backup Operators" \ + "BUILTIN/Print Operators" "BUILTIN/Guests" "BUILTIN/Users" \ + "BUILTIN/Administrators"] diff --git a/testsuite/lib/env-single.exp b/testsuite/lib/env-single.exp new file mode 100644 index 0000000000..6cd7f94a86 --- /dev/null +++ b/testsuite/lib/env-single.exp @@ -0,0 +1,36 @@ +# +# Environment variables for a single machine test. We look for the +# following environment variables: +# +# $TEST_SERVER The SMB server to contact for the test +# $TEST_SHARE Share name on $TEST_SERVER to contact +# $TEST_USER The username to connect to $TEST_SHARE as +# +# These are stored in the Tcl variables $server, $share and $user +# respectively. +# +# An error will be produced and the test will exit if any of these +# variables are not present. +# + +verbose "Loading single machine environment variables" + +catch {set server "$env(TEST_SERVER)"} tmp + +if {[regexp "^can't read" $tmp]} { + error "Environment variable TEST_SERVER not set" +} + +catch {set share "$env(TEST_SHARE)"} tmp + +if {[regexp "^can't read" $tmp]} { + error "Environment variable TEST_SHARE not set" +} + +catch {set user "$env(TEST_USER)"} tmp + +if {[regexp "^can't read" $tmp]} { + error "Environment variable TEST_USER not set" +} + +verbose "Single machine is //$server/$share -U $user" diff --git a/testsuite/lib/nsswitch-config.exp b/testsuite/lib/nsswitch-config.exp new file mode 100644 index 0000000000..38342685df --- /dev/null +++ b/testsuite/lib/nsswitch-config.exp @@ -0,0 +1,21 @@ +# +# Load environment variables +# + +global tool + +if { [file exists "deja-$tool.tcl"] } { + source "deja-$tool.tcl" +} + +# Required options + +if { ![info exists WORKGROUP] } { + error "\$WORKGROUP not set in config file" +} + +if { ![info exists PDC] } { + error "\$PDC not set in config file" +} + +set domain $WORKGROUP diff --git a/testsuite/lib/smbclient.exp b/testsuite/lib/smbclient.exp new file mode 100644 index 0000000000..dc55d72139 --- /dev/null +++ b/testsuite/lib/smbclient.exp @@ -0,0 +1,54 @@ +# +# Utilities for driving smbclient +# + +# Variables + +set smb_prompt "smb: \\\\>" + +# Spawn smbclient and wait for a prompt + +proc spawn_smbclient { args } { + set result 0 + global smb_prompt + global spawn_id + + # Spawn smbclient + + spawn smbclient [lindex $args 0] [lindex $args 1] [lindex $args 2] \ + [lindex $args 3] [lindex $args 4] [lindex $args 5] \ + [lindex $args 6] + + # Wait for prompt + + expect { + $smb_prompt { set result 1 } + timeout { perror "timed out spawning smbclient" } + eof { perror "end of file spawning smbclient" } + } + + return $result +} + +# Run a command and wait for a prompt + +proc do_smbclient { args } { + set action [lindex $args 0] + set description [lindex $args 1] + global smb_prompt + + # Send command + + verbose $action + + send $action + + expect { + $smb_prompt {} + timeout { perror "timed out $description"; return -1} + eof { perror "end of file $description"; return -1 } + } + + verbose $expect_out(buffer) + return $expect_out(buffer) +} |