ctdb: Avoid a talloc in ctdb_queue_send
[Samba.git] / source4 / selftest / win / wintest_functions.sh
blob3c0a1dccac180907c33814a6c6a494a9aff012a5
1 #!/bin/sh
3 # Setup the windows environment.
4 # This was the best way I could figure out including library files
5 # for the moment.
6 # I was finding that "cat common.exp wintest_setup.exp | expect -f -"
7 # fails to run, but exits with 0 status something like 1% of the time.
9 setup_share_test()
11 echo -e "\nSetting up windows environment."
12 cat $WINTEST_DIR/common.exp > $TMPDIR/setup.exp
13 cat $WINTEST_DIR/wintest_setup.exp >> $TMPDIR/setup.exp
14 expect $TMPDIR/setup.exp
15 err_rtn=$?
16 rm -f $TMPDIR/setup.exp
19 # Clean up the windows environment after the test has run or failed.
20 remove_share_test()
22 echo -e "\nCleaning up windows environment."
23 cat $WINTEST_DIR/common.exp > $TMPDIR/remove.exp
24 cat $WINTEST_DIR/wintest_remove.exp >> $TMPDIR/remove.exp
25 expect $TMPDIR/remove.exp
26 err_rtn=$?
27 rm -f $TMPDIR/remove.exp
30 restore_snapshot()
32 err_str=$1
33 VMX_PATH=$2
35 # Display the error that caused us to restore the snapshot.
36 echo -e $err_str
38 if [ -z $HOST_SERVER_NAME ]; then
39 # The vmware server is running locally.
40 vmrun revertToSnapshot "$VMX_PATH"
41 err_rtn=$?
42 else
43 vmrun -h $HOST_SERVER_NAME -P $HOST_SERVER_PORT \
44 -u $HOST_USERNAME -p $HOST_PASSWORD \
45 revertToSnapshot "$VMX_PATH"
46 err_rtn=$?
49 if [ $err_rtn -eq 0 ]; then
50 echo "Snapshot restored."
51 else
52 echo "Error $err_rtn restoring snapshot!"