1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00
samba-mirror/source4/selftest/win/wintest_functions.sh
Andreas Schneider df29b9ab16 s4:selftest: Reformat shell scripts
shfmt -f source4/selftest/ | xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2022-07-15 12:08:36 +00:00

55 lines
1.3 KiB
Bash
Executable File

#!/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
}