Make test drill, next steps, call for help with Winetest
Hans Leidekker
hans at it.vu.nl
Mon Oct 15 15:15:43 CDT 2007
I have written attached script to facilitate automated winetest runs.
It needs a VirtualBox virtual machine with either Windows or a Wine platform
configured to run autorun.inf files.
The script downloads the latest winetest binary and puts it in an iso image,
along with an autorun file to trigger its execution when the image is
'inserted' into the virtual drive.
A snapshot is used to revert the vm to its original state, so no need to
worry about winetest screwing up your installation.
-Hans
-------------- next part --------------
#!/bin/bash
if [ $# -lt 2 ]; then
echo "Usage: $0 <vmname> <tag>"
echo ""
echo "vmname: Virtual machine to use (must be in suspended state).
echo "tag: Tag built from [-.0-9a-zA-Z] to identify test report.
exit 1
fi
TMPDIR=/tmp/winetest$$
LOGFILE=$TMPDIR/log
mkdir -p $TMPDIR/master
echo "downloading winetest binary"
wget -P $TMPDIR http://www.astro.gla.ac.uk/users/paulm/WRT/CrossBuilt/winetest-latest.exe >> $LOGFILE 2>&1
if [ $? -ne 0 ]; then
exit 1
fi
mv $TMPDIR/winetest-latest.exe $TMPDIR/master/winetest.exe
echo "creating autorun.inf"
cat > $TMPDIR/master/autorun.inf <<_EOF_
[autorun]
open=winetest.exe -q -t $2
_EOF_
echo "creating cd image"
mkisofs -o $TMPDIR/winetest.iso $TMPDIR/master >> $LOGFILE 2>&1
if [ $? -ne 0 ]; then
exit 1
fi
echo "checking vm $1 state"
VBoxManage showvminfo $1 | grep "^State:" | grep "saved" >> $LOGFILE 2>&1
if [ $? -ne 0 ]; then
exit 1
fi
echo "creating snapshot for vm $1"
VBoxManage snapshot $1 take before-winetest >> $LOGFILE 2>&1
if [ $? -ne 0 ]; then
exit 1
fi
echo "starting vm $1"
VBoxManage startvm $1 >> $LOGFILE 2>&1
if [ $? -ne 0 ]; then
exit 1
fi
echo "waiting until vm $1 is up and running"
RUNNING="false"
while [ $RUNNING != "true" ]
do
VBoxManage showvminfo $1 | grep "^State:" | grep "running" >> $LOGFILE 2>&1
if [ $? -eq 0 ]; then
RUNNING="true"
fi
sleep 1
done
echo "attaching cd image to vm $1"
VBoxManage controlvm $1 dvdattach $TMPDIR/winetest.iso >> $LOGFILE 2>&1
if [ $? -ne 0 ]; then
exit 1
fi
echo "sleeping while vm $1 runs winetest"
sleep 1800 # 30 minutes should be enough for winetest to finish
echo "suspending vm $1"
VBoxManage controlvm $1 savestate >> $LOGFILE 2>&1
if [ $? -ne 0 ]; then
exit 1
fi
echo "waiting until vm $1 is suspended"
SAVED="false"
while [ $SAVED != "true" ]
do
VBoxManage showvminfo $1 | grep "^State:" | grep "saved" >> $LOGFILE 2>&1
if [ $? -eq 0 ]; then
SAVED="true"
fi
sleep 1
done
echo "reverting vm $1 to previous state"
VBoxManage snapshot $1 discardcurrent -all >> $LOGFILE 2>&1
if [ $? -ne 0 ]; then
exit 1
fi
rm -rf $TMPDIR
exit 0
More information about the wine-devel
mailing list