Line | |
---|
1 | #!/bin/sh
|
---|
2 |
|
---|
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.
|
---|
8 |
|
---|
9 | setup_share_test()
|
---|
10 | {
|
---|
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
|
---|
17 | }
|
---|
18 |
|
---|
19 | # Clean up the windows environment after the test has run or failed.
|
---|
20 | remove_share_test()
|
---|
21 | {
|
---|
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
|
---|
28 | }
|
---|
29 |
|
---|
30 | restore_snapshot()
|
---|
31 | {
|
---|
32 | err_str=$1
|
---|
33 | VMX_PATH=$2
|
---|
34 |
|
---|
35 | # Display the error that caused us to restore the snapshot.
|
---|
36 | echo -e $err_str
|
---|
37 |
|
---|
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=$?
|
---|
47 | fi
|
---|
48 |
|
---|
49 | if [ $err_rtn -eq 0 ]; then
|
---|
50 | echo "Snapshot restored."
|
---|
51 | else
|
---|
52 | echo "Error $err_rtn restoring snapshot!"
|
---|
53 | fi
|
---|
54 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.