summaryrefslogtreecommitdiff
path: root/source4/selftest/win/wintest_functions.sh
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-04-29 20:37:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:51:46 -0500
commit1e84e4026e3c8f0b94cfaf61a089b075f07417f1 (patch)
tree091ad4a99b9f124ffcbf9dec2f7dcd8727851a11 /source4/selftest/win/wintest_functions.sh
parent82ad0ea6eaab04cdb1739da468b5ed2169421439 (diff)
downloadsamba-1e84e4026e3c8f0b94cfaf61a089b075f07417f1.tar.gz
samba-1e84e4026e3c8f0b94cfaf61a089b075f07417f1.tar.bz2
samba-1e84e4026e3c8f0b94cfaf61a089b075f07417f1.zip
r22575: move script/tests/ -> selftest/
as discussed with jelmer and abartlet metze (This used to be commit e9fe3c40e10accb63d7a2124d3a7e77e499c4209)
Diffstat (limited to 'source4/selftest/win/wintest_functions.sh')
-rwxr-xr-xsource4/selftest/win/wintest_functions.sh54
1 files changed, 54 insertions, 0 deletions
diff --git a/source4/selftest/win/wintest_functions.sh b/source4/selftest/win/wintest_functions.sh
new file mode 100755
index 0000000000..3c0a1dccac
--- /dev/null
+++ b/source4/selftest/win/wintest_functions.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+# Setup the windows environment.
+# This was the best way I could figure out including library files
+# for the moment.
+# I was finding that "cat common.exp wintest_setup.exp | expect -f -"
+# fails to run, but exits with 0 status something like 1% of the time.
+
+setup_share_test()
+{
+ echo -e "\nSetting up windows environment."
+ cat $WINTEST_DIR/common.exp > $TMPDIR/setup.exp
+ cat $WINTEST_DIR/wintest_setup.exp >> $TMPDIR/setup.exp
+ expect $TMPDIR/setup.exp
+ err_rtn=$?
+ rm -f $TMPDIR/setup.exp
+}
+
+# Clean up the windows environment after the test has run or failed.
+remove_share_test()
+{
+ echo -e "\nCleaning up windows environment."
+ cat $WINTEST_DIR/common.exp > $TMPDIR/remove.exp
+ cat $WINTEST_DIR/wintest_remove.exp >> $TMPDIR/remove.exp
+ expect $TMPDIR/remove.exp
+ err_rtn=$?
+ rm -f $TMPDIR/remove.exp
+}
+
+restore_snapshot()
+{
+ err_str=$1
+ VMX_PATH=$2
+
+ # Display the error that caused us to restore the snapshot.
+ echo -e $err_str
+
+ if [ -z $HOST_SERVER_NAME ]; then
+ # The vmware server is running locally.
+ vmrun revertToSnapshot "$VMX_PATH"
+ err_rtn=$?
+ else
+ vmrun -h $HOST_SERVER_NAME -P $HOST_SERVER_PORT \
+ -u $HOST_USERNAME -p $HOST_PASSWORD \
+ revertToSnapshot "$VMX_PATH"
+ err_rtn=$?
+ fi
+
+ if [ $err_rtn -eq 0 ]; then
+ echo "Snapshot restored."
+ else
+ echo "Error $err_rtn restoring snapshot!"
+ fi
+}