mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
merge
This commit is contained in:
commit
05ef2f2ffd
6 files changed
+384
-273
No files matched your search
Regular → Executable
+64
-64
@@ -23,13 +23,13 @@
|
||||
a _very_ specific value, set in the PROMPT
|
||||
variable of this script
|
||||
"""
|
||||
import sys;
|
||||
import os;
|
||||
import pty;
|
||||
import tty;
|
||||
import termios;
|
||||
import fcntl;
|
||||
import select;
|
||||
import sys
|
||||
import os
|
||||
import pty
|
||||
import tty
|
||||
import termios
|
||||
import fcntl
|
||||
import select
|
||||
|
||||
from Test import *
|
||||
|
||||
@@ -52,15 +52,15 @@ class XmConsole:
|
||||
are included in the history buffer
|
||||
"""
|
||||
|
||||
self.TIMEOUT = 30;
|
||||
self.PROMPT = "@%@%> ";
|
||||
self.domain = domain;
|
||||
self.historyBuffer = [];
|
||||
self.historyLines = 0;
|
||||
self.historyLimit = historyLimit;
|
||||
self.historySaveAll = historySaveAll;
|
||||
self.historySaveCmds = historySaveCmds;
|
||||
self.debugMe = False;
|
||||
self.TIMEOUT = 30
|
||||
self.PROMPT = "@%@%> "
|
||||
self.domain = domain
|
||||
self.historyBuffer = []
|
||||
self.historyLines = 0
|
||||
self.historyLimit = historyLimit
|
||||
self.historySaveAll = historySaveAll
|
||||
self.historySaveCmds = historySaveCmds
|
||||
self.debugMe = False
|
||||
self.limit = None
|
||||
|
||||
consoleCmd = ["/usr/sbin/xm", "xm", "console", domain]
|
||||
@@ -68,62 +68,62 @@ class XmConsole:
|
||||
if verbose:
|
||||
print "Console executing: " + str(consoleCmd)
|
||||
|
||||
pid, fd = pty.fork();
|
||||
pid, fd = pty.fork()
|
||||
|
||||
if pid == 0:
|
||||
os.execvp("/usr/sbin/xm", consoleCmd[1:]);
|
||||
os.execvp("/usr/sbin/xm", consoleCmd[1:])
|
||||
|
||||
self.consolePid = pid;
|
||||
self.consoleFd = fd;
|
||||
self.consolePid = pid
|
||||
self.consoleFd = fd
|
||||
|
||||
tty.setraw(self.consoleFd, termios.TCSANOW);
|
||||
tty.setraw(self.consoleFd, termios.TCSANOW)
|
||||
|
||||
bytes = self.__chewall(self.consoleFd)
|
||||
if bytes < 0:
|
||||
raise ConsoleError("Console didn't respond")
|
||||
|
||||
def __addToHistory(self, line):
|
||||
self.historyBuffer.append(line);
|
||||
self.historyLines += 1;
|
||||
self.historyBuffer.append(line)
|
||||
self.historyLines += 1
|
||||
if self.historyLines > self.historyLimit:
|
||||
self.historyBuffer = self.historyBuffer[1:];
|
||||
self.historyLines -= 1;
|
||||
self.historyBuffer = self.historyBuffer[1:]
|
||||
self.historyLines -= 1
|
||||
|
||||
|
||||
def clearHistory(self):
|
||||
"""Clear the history buffer"""
|
||||
self.historyBuffer = [];
|
||||
self.historyLines = 0;
|
||||
self.historyBuffer = []
|
||||
self.historyLines = 0
|
||||
|
||||
|
||||
def getHistory(self):
|
||||
"""Returns a string containing the entire history buffer"""
|
||||
output = "";
|
||||
output = ""
|
||||
|
||||
for line in self.historyBuffer:
|
||||
output += line + "\n";
|
||||
output += line + "\n"
|
||||
|
||||
return output;
|
||||
return output
|
||||
|
||||
|
||||
def setTimeout(self, timeout):
|
||||
"""Sets the timeout used to determine if a remote command
|
||||
has blocked"""
|
||||
self.TIMEOUT = timeout;
|
||||
self.TIMEOUT = timeout
|
||||
|
||||
|
||||
def setPrompt(self, prompt):
|
||||
"""Sets the string key used to delimit the end of command
|
||||
output"""
|
||||
self.PROMPT = prompt;
|
||||
self.PROMPT = prompt
|
||||
|
||||
|
||||
def __chewall(self, fd):
|
||||
timeout = 0;
|
||||
bytes = 0;
|
||||
timeout = 0
|
||||
bytes = 0
|
||||
|
||||
while timeout < 3:
|
||||
i, o, e = select.select([fd], [], [], 1);
|
||||
i, o, e = select.select([fd], [], [], 1)
|
||||
if fd in i:
|
||||
try:
|
||||
foo = os.read(fd, 1)
|
||||
@@ -143,7 +143,7 @@ class XmConsole:
|
||||
if self.debugMe:
|
||||
print "Ignored %i bytes of miscellaneous console output" % bytes
|
||||
|
||||
return bytes;
|
||||
return bytes
|
||||
|
||||
|
||||
def __runCmd(self, command, saveHistory=True):
|
||||
@@ -152,15 +152,15 @@ class XmConsole:
|
||||
lines = 0
|
||||
bytes = 0
|
||||
|
||||
self.__chewall(self.consoleFd);
|
||||
self.__chewall(self.consoleFd)
|
||||
|
||||
if verbose:
|
||||
print "[%s] Sending `%s'" % (self.domain, command)
|
||||
|
||||
os.write(self.consoleFd, "%s\n" % command);
|
||||
os.write(self.consoleFd, "%s\n" % command)
|
||||
|
||||
while 1==1:
|
||||
i, o, e = select.select([self.consoleFd], [], [], self.TIMEOUT);
|
||||
i, o, e = select.select([self.consoleFd], [], [], self.TIMEOUT)
|
||||
|
||||
if self.consoleFd in i:
|
||||
try:
|
||||
@@ -182,59 +182,59 @@ class XmConsole:
|
||||
if lines > 0:
|
||||
output += line + "\n"
|
||||
if saveHistory:
|
||||
self.__addToHistory(line);
|
||||
self.__addToHistory(line)
|
||||
elif self.historySaveCmds and saveHistory:
|
||||
self.__addToHistory("*" + line);
|
||||
lines += 1;
|
||||
line = "";
|
||||
self.__addToHistory("*" + line)
|
||||
lines += 1
|
||||
line = ""
|
||||
elif str == "\r":
|
||||
pass # ignore \r's
|
||||
else:
|
||||
line += str;
|
||||
line += str
|
||||
|
||||
if line == self.PROMPT:
|
||||
break;
|
||||
break
|
||||
|
||||
return output;
|
||||
return output
|
||||
|
||||
|
||||
def runCmd(self, command):
|
||||
"""Runs a command on the remote terminal and returns the output
|
||||
as well as the return code. For example:
|
||||
|
||||
ret = c.runCmd("ls");
|
||||
print ret["output"];
|
||||
sys.exit(run["return"]);
|
||||
ret = c.runCmd("ls")
|
||||
print ret["output"]
|
||||
sys.exit(run["return"])
|
||||
|
||||
"""
|
||||
|
||||
# Allow exceptions to bubble up
|
||||
realOutput = self.__runCmd(command);
|
||||
retOutput = self.__runCmd("echo $?", saveHistory=False);
|
||||
realOutput = self.__runCmd(command)
|
||||
retOutput = self.__runCmd("echo $?", saveHistory=False)
|
||||
|
||||
try:
|
||||
retCode = int(retOutput);
|
||||
retCode = int(retOutput)
|
||||
except:
|
||||
retCode = 255;
|
||||
retCode = 255
|
||||
return {
|
||||
"output": realOutput,
|
||||
"return": retCode,
|
||||
};
|
||||
}
|
||||
|
||||
def sendInput(self, input):
|
||||
"""Sends input to the remote terminal, but doesn't check
|
||||
for a return code"""
|
||||
realOutput = self.__runCmd(input);
|
||||
realOutput = self.__runCmd(input)
|
||||
return {
|
||||
"output": realOutput,
|
||||
"return": 0,
|
||||
};
|
||||
}
|
||||
|
||||
def closeConsole(self):
|
||||
"""Closes the console connection and ensures that the console
|
||||
process is killed"""
|
||||
os.close(self.consoleFd);
|
||||
os.kill(self.consolePid, 2);
|
||||
os.close(self.consoleFd)
|
||||
os.kill(self.consolePid, 2)
|
||||
|
||||
|
||||
def setLimit(self, limit):
|
||||
@@ -254,23 +254,23 @@ if __name__ == "__main__":
|
||||
code as the domU command.
|
||||
"""
|
||||
|
||||
verbose = True;
|
||||
verbose = True
|
||||
|
||||
try:
|
||||
t = XmConsole(sys.argv[1]);
|
||||
t = XmConsole(sys.argv[1])
|
||||
except ConsoleError, e:
|
||||
print "Failed to attach to console (%s)" % str(e)
|
||||
sys.exit(255)
|
||||
|
||||
try:
|
||||
run = t.runCmd(sys.argv[2]);
|
||||
run = t.runCmd(sys.argv[2])
|
||||
except ConsoleError, e:
|
||||
print "Console failed (%)" % str(e)
|
||||
sys.exit(255)
|
||||
|
||||
t.closeConsole();
|
||||
t.closeConsole()
|
||||
|
||||
print run["output"],;
|
||||
sys.exit(run["return"]);
|
||||
print run["output"],
|
||||
sys.exit(run["return"])
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Dan Smith <danms@us.ibm.com> - 16-Sep-2005
|
||||
#
|
||||
# This script takes all the .report files in the current
|
||||
# directory and generates a summary table, showing the
|
||||
# number of PASS, FAIL, XPASS, and XFAIL tests in each
|
||||
# report
|
||||
|
||||
|
||||
echo " Platform | PASS | FAIL | XPASS | XFAIL |"
|
||||
echo "---------------------+------+------+-------+-------+"
|
||||
|
||||
for r in *.report; do
|
||||
|
||||
mach=$(basename $r .report)
|
||||
pass=$(cat $r | grep ' PASS' | cut -d : -f 2 | sed 's/ *//')
|
||||
fail=$(cat $r | grep ' FAIL' | cut -d : -f 2 | sed 's/ *//')
|
||||
xpas=$(cat $r | grep ' XPASS' | cut -d : -f 2 | sed 's/ *//')
|
||||
xfal=$(cat $r | grep ' XFAIL' | cut -d : -f 2 | sed 's/ *//')
|
||||
|
||||
printf "%20s | %4s | %4s | %5s | %5s |\n" "$mach" "$pass" \
|
||||
"$fail" "$xpas" "$xfal"
|
||||
|
||||
done
|
||||
Regular → Executable
+230
-186
@@ -1,215 +1,259 @@
|
||||
#!/bin/sh
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [opts] <logfile>"
|
||||
echo " Where opts are:"
|
||||
echo " -d : do not submit a report for this run"
|
||||
echo " -b : do not ask any questions (batch mode)"
|
||||
echo " -e <email> : set email address for report"
|
||||
}
|
||||
##
|
||||
## Test driver script
|
||||
##
|
||||
|
||||
#
|
||||
# Defaults
|
||||
#
|
||||
MAXFAIL=10
|
||||
report=yes
|
||||
batch=no
|
||||
usage() {
|
||||
echo "Usage: $0 [opts] <report>"
|
||||
echo " Where report is a name that will be used for report files"
|
||||
echo ""
|
||||
echo " Where opts are:"
|
||||
echo " -d : do not submit a report for this run"
|
||||
echo " -b : do not ask any questions (batch mode)"
|
||||
echo " -q : run a quick test set"
|
||||
echo " -e <email> : set email address for report"
|
||||
echo " -s <report> : just submit report <report>"
|
||||
}
|
||||
|
||||
#
|
||||
# Resolve options
|
||||
#
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-d)
|
||||
echo "(Skipping report submission)"
|
||||
report=no
|
||||
;;
|
||||
-b)
|
||||
echo "(Batch mode)"
|
||||
batch=yes
|
||||
;;
|
||||
-e)
|
||||
shift
|
||||
echo $1 > contact_info
|
||||
echo "(Email set to $1)"
|
||||
;;
|
||||
*)
|
||||
LOGFILE=$1
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
# Just submit the report
|
||||
submit_report() {
|
||||
|
||||
#
|
||||
# Usage
|
||||
#
|
||||
if [ -z $LOGFILE ]; then
|
||||
usage
|
||||
reportfile=$1
|
||||
|
||||
./lib/XmTestReport/Report.py $reportfile
|
||||
}
|
||||
|
||||
# Generate XML result report from output file
|
||||
make_result_report() {
|
||||
output=$1
|
||||
reportfile=$2
|
||||
if ! ./lib/XmTestReport/ResultReport.py $output > $reportfile; then
|
||||
echo "Unable to generate clean ResultReport"
|
||||
echo "Take a look at $report"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Output files
|
||||
#
|
||||
OSREPORTTEMP=${LOGFILE}.os.xml
|
||||
PROGREPORTTEMP=${LOGFILE}.prog.xml
|
||||
RESULTREPORTTEMP=${LOGFILE}.result.xml
|
||||
OUTPUT=${LOGFILE}.output
|
||||
SUMMARY=${LOGFILE}.summary
|
||||
PASSFAIL=${LOGFILE}.passfail
|
||||
REPORT=${LOGFILE}.report
|
||||
FAILURES=${LOGFILE}.failures
|
||||
|
||||
#
|
||||
# Make sure we're root
|
||||
#
|
||||
uid=$(id -u)
|
||||
if [ $uid != 0 ]; then
|
||||
echo "ERROR: I must be run as root!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# See if the ramdisk has been built
|
||||
#
|
||||
rdsize=$(stat -c %s ramdisk/initrd.img 2>/dev/null)
|
||||
if [ -z "$rdsize" ] || [ $rdsize -le 16384 ]; then
|
||||
echo "Cannot find a valid ramdisk. You need to run \"make\" or"
|
||||
echo "copy in a previously-built ramdisk to the ramdisk/ directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# See if xend is running
|
||||
#
|
||||
if ! xm list >/dev/null 2>&1; then
|
||||
echo "'xm list' failed: is xend running?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Make sure permissions are correct
|
||||
#
|
||||
chmod a+x lib/XmTestReport/*
|
||||
chmod a+x mkreport mergereport
|
||||
|
||||
#
|
||||
# Get contact info if needed
|
||||
#
|
||||
if [ ! -f contact_info ]; then
|
||||
if [ "$batch" = "yes" ]; then
|
||||
echo "Unable to read contact_info!"
|
||||
echo "Please run me once interactively before using batch mode!"
|
||||
exit 1
|
||||
else
|
||||
echo "Please provide your email address so that we can "
|
||||
echo "contact you if we need further information concerning"
|
||||
echo "your results. Any information provided will be"
|
||||
echo "kept private. If you wish to remain anonymous, please"
|
||||
echo "hit [ENTER] now."
|
||||
|
||||
while ! echo "$EMAIL" | grep -q '@'; do
|
||||
echo
|
||||
echo -n "Your email address: "
|
||||
read EMAIL
|
||||
if [ -z $EMAIL ]; then
|
||||
EMAIL="anonymous@somewhere.com"
|
||||
fi
|
||||
done
|
||||
echo $EMAIL > contact_info
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Collect environment information for XML report
|
||||
#
|
||||
if ! ./lib/XmTestReport/OSReport.py > $OSREPORTTEMP; then
|
||||
echo "Unable to generate clean OSReport"
|
||||
echo "Take a look at $OSREPORTTEMP"
|
||||
exit 1
|
||||
fi
|
||||
if ! ./lib/XmTestReport/ProgReport.py > $PROGREPORTTEMP; then
|
||||
echo "Unable to generate clean ProgReport"
|
||||
echo "Take a look at $PROGREPORTTEMP"
|
||||
exit 1
|
||||
fi
|
||||
make_environment_report() {
|
||||
os=$1
|
||||
prog=$2
|
||||
if ! ./lib/XmTestReport/OSReport.py > $os; then
|
||||
echo "Unable to generate clean OSReport"
|
||||
echo "Take a look at $os"
|
||||
exit 1
|
||||
fi
|
||||
if ! ./lib/XmTestReport/ProgReport.py > $prog; then
|
||||
echo "Unable to generate clean ProgReport"
|
||||
echo "Take a look at $prog"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Check conditions needed to actually run the tests
|
||||
runnable_tests() {
|
||||
# Make sure we're root
|
||||
uid=$(id -u)
|
||||
if [ $uid != 0 ]; then
|
||||
echo "ERROR: I must be run as root!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# See if the ramdisk has been built
|
||||
rdsize=$(stat -c %s ramdisk/initrd.img 2>/dev/null)
|
||||
if [ -z "$rdsize" ] || [ $rdsize -le 16384 ]; then
|
||||
echo "Cannot find a valid ramdisk. You need to run \"make\" or"
|
||||
echo "copy in a previously-built ramdisk to the ramdisk/ directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# See if xend is running
|
||||
if ! xm list >/dev/null 2>&1; then
|
||||
echo "'xm list' failed: is xend running?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# Get contact info if needed
|
||||
get_contact_info() {
|
||||
|
||||
if [ ! -f contact_info ]; then
|
||||
if [ "$batch" = "yes" ]; then
|
||||
echo "Unable to read contact_info!"
|
||||
echo "Please run me once interactively before using batch mode!"
|
||||
exit 1
|
||||
else
|
||||
echo "Please provide your email address so that we can "
|
||||
echo "contact you if we need further information concerning"
|
||||
echo "your results. Any information provided will be"
|
||||
echo "kept private. If you wish to remain anonymous, please"
|
||||
echo "hit [ENTER] now."
|
||||
|
||||
while ! echo "$EMAIL" | grep -q '@'; do
|
||||
echo
|
||||
echo -n "Your email address: "
|
||||
read EMAIL
|
||||
if [ -z $EMAIL ]; then
|
||||
EMAIL="anonymous@somewhere.com"
|
||||
fi
|
||||
done
|
||||
echo $EMAIL > contact_info
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Run the tests
|
||||
#
|
||||
export TEST_VERBOSE=1
|
||||
echo Running tests...
|
||||
make -k check > $OUTPUT 2>&1
|
||||
run_tests() {
|
||||
output=$1
|
||||
echo Running tests...
|
||||
TEST_VERBOSE=1 make -k check > $output 2>&1
|
||||
}
|
||||
|
||||
run_tests_quick() {
|
||||
|
||||
output=$1
|
||||
|
||||
create_tests="01_create_basic_pos.test 07_create_mem64_pos.test 10_create_fastdestroy.test 14_create_blockroot_pos.test"
|
||||
unpause_tests="01_unpause_basic_pos.test"
|
||||
memset_tests="01_memset_basic_pos.test 03_memset_random_pos.test"
|
||||
help_tests="06_help_allcmds.test"
|
||||
testgroups="create unpause memset help"
|
||||
|
||||
echo "*** Quick test" > $output
|
||||
for group in $testgroups; do
|
||||
eval $(echo list=\$${group}_tests)
|
||||
echo "*** Running tests [$list] from $group"
|
||||
(cd tests/$group && TEST_VERBOSE=1 make -k check TESTS="$list") >> $output 2>&1
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# Generate some plain-text reports
|
||||
#
|
||||
echo "Making PASS/FAIL report ($PASSFAIL)..."
|
||||
cat $OUTPUT | egrep '(REASON|PASS|FAIL|XPASS|XFAIL|SKIP)' | perl -pe 's/^(PASS|FAIL|XPASS|XFAIL)(.+)$/$1$2\n/' > $PASSFAIL
|
||||
|
||||
echo "Making FAIL report ($FAILURES)..."
|
||||
cat $PASSFAIL | egrep '(REASON|FAIL)' > $FAILURES
|
||||
|
||||
NUMPASS=`grep -c PASS $OUTPUT`
|
||||
NUMFAIL=`grep -c FAIL $OUTPUT`
|
||||
NUMXPASS=`grep -c XPASS $OUTPUT`
|
||||
NUMXFAIL=`grep -c XFAIL $OUTPUT`
|
||||
cat > $SUMMARY << EOF
|
||||
make_text_reports() {
|
||||
passfail=$1
|
||||
failures=$2
|
||||
output=$3
|
||||
reportfile=$4
|
||||
summary=summary.tmp
|
||||
echo "Making PASS/FAIL report ($passfail)..."
|
||||
cat $OUTPUT | egrep '(REASON|PASS|FAIL|XPASS|XFAIL|SKIP)' | perl -pe 's/^(PASS|FAIL|XPASS|XFAIL)(.+)$/$1$2\n/' > $passfail
|
||||
|
||||
echo "Making FAIL report ($failures)..."
|
||||
cat $passfail | egrep '(REASON|FAIL)' > $failures
|
||||
|
||||
NUMPASS=`grep -c PASS $output`
|
||||
NUMFAIL=`grep -c FAIL $output`
|
||||
NUMXPASS=`grep -c XPASS $output`
|
||||
NUMXFAIL=`grep -c XFAIL $output`
|
||||
cat > $summary << EOF
|
||||
Xm-test execution summary:
|
||||
PASS: $NUMPASS
|
||||
FAIL: $NUMFAIL
|
||||
XPASS: $NUMXPASS
|
||||
XFAIL: $NUMXFAIL
|
||||
EOF
|
||||
|
||||
cat $summary > $reportfile
|
||||
|
||||
echo -e '\n\nDetails:\n' >> $reportfile
|
||||
|
||||
./mkreport $passfail >> $reportfile
|
||||
|
||||
cat $SUMMARY > $REPORT
|
||||
rm $summary
|
||||
}
|
||||
|
||||
echo -e '\n\nDetails:\n' >> $REPORT
|
||||
|
||||
./mkreport $PASSFAIL >> $REPORT
|
||||
############
|
||||
### Main ###
|
||||
############
|
||||
|
||||
#
|
||||
# Check to see if it's worth reporting these results
|
||||
#
|
||||
#if [ "$batch" = "no" ] &&
|
||||
# [ "$report" = "yes" ] &&
|
||||
# [ $NUMFAIL -gt $MAXFAIL ]; then
|
||||
# echo "NOTE: $NUMFAIL tests failed, which may be erroneous. It may"
|
||||
# echo "be a good idea to review the report before sending. If you"
|
||||
# echo "choose not to submit the report, it will be saved for your review"
|
||||
# echo "and later submission."
|
||||
# echo
|
||||
# echo -n "Submit anyway? [y/n] "
|
||||
# read ANSWER
|
||||
# if [ "$ANSWER" = "n" ]; then
|
||||
# report=no
|
||||
# fi
|
||||
#fi
|
||||
# Defaults
|
||||
MAXFAIL=10
|
||||
report=yes
|
||||
batch=no
|
||||
run=yes
|
||||
|
||||
#
|
||||
# Generate the XML result report
|
||||
#
|
||||
if ! ./lib/XmTestReport/ResultReport.py $OUTPUT > $RESULTREPORTTEMP; then
|
||||
echo "Unable to generate clean ResultReport"
|
||||
echo "Take a look at $RESULTREPORTTEMP"
|
||||
exit 1
|
||||
# Resolve options
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-d)
|
||||
echo "(Skipping report submission)"
|
||||
report=no
|
||||
;;
|
||||
-b)
|
||||
echo "(Batch mode)"
|
||||
batch=yes
|
||||
;;
|
||||
-e)
|
||||
shift
|
||||
echo $1 > contact_info
|
||||
echo "(Email set to $1)"
|
||||
;;
|
||||
-q)
|
||||
run=quick
|
||||
;;
|
||||
-s)
|
||||
run=no
|
||||
;;
|
||||
*)
|
||||
REPORT=$1
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Usage
|
||||
if [ -z $REPORT ]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Maybe submit report and save the combined XML file
|
||||
#
|
||||
if [ "$report" = "yes" ]; then
|
||||
echo "Sending report..."
|
||||
./lib/XmTestReport/Report.py -D $OSREPORTTEMP $PROGREPORTTEMP \
|
||||
$RESULTREPORTTEMP > $1.xml
|
||||
echo "Report also saved in $1.xml"
|
||||
else
|
||||
echo "Saving report to $1.xml..."
|
||||
./lib/XmTestReport/Report.py -d $OSREPORTTEMP $PROGREPORTTEMP \
|
||||
$RESULTREPORTTEMP > $1.xml
|
||||
# Output files
|
||||
OSREPORTTEMP=${REPORT}.os.xml
|
||||
PROGREPORTTEMP=${REPORT}.prog.xml
|
||||
RESULTREPORTTEMP=${REPORT}.result.xml
|
||||
XMLREPORT=${REPORT}.xml
|
||||
OUTPUT=${REPORT}.output
|
||||
SUMMARY=${REPORT}.summary
|
||||
PASSFAIL=${REPORT}.passfail
|
||||
TXTREPORT=${REPORT}.report
|
||||
FAILURES=${REPORT}.failures
|
||||
|
||||
# Make sure permissions are correct
|
||||
chmod a+x lib/XmTestReport/*
|
||||
chmod a+x mkreport mergereport
|
||||
|
||||
if [ ! -f contact_info ]; then
|
||||
if [ "$batch" = "yes" ]; then
|
||||
echo "Unable to read contact_info"
|
||||
echo "You must run me interactively once!"
|
||||
exit 1
|
||||
else
|
||||
get_contact_info
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$run" != "no" ]; then
|
||||
runnable_tests
|
||||
make_environment_report $OSREPORTTEMP $PROGREPORTTEMP
|
||||
if [ "$run" = "yes" ]; then
|
||||
run_tests $OUTPUT
|
||||
else
|
||||
run_tests_quick $OUTPUT
|
||||
fi
|
||||
make_text_reports $PASSFAIL $FAILURES $OUTPUT $TXTREPORT
|
||||
make_result_report $OUTPUT $RESULTREPORTTEMP
|
||||
cat $OSREPORTTEMP $PROGREPORTTEMP $RESULTREPORTTEMP > $XMLREPORT
|
||||
rm $OSREPORTTEMP $PROGREPORTTEMP $RESULTREPORTTEMP
|
||||
fi
|
||||
|
||||
if [ "$report" = "yes" ] && [ "$run" = "yes" ]; then
|
||||
if [ ! -f "$XMLREPORT" ]; then
|
||||
echo "No such file: $XMLREPORT"
|
||||
exit 1
|
||||
fi
|
||||
submit_report $XMLREPORT
|
||||
fi
|
||||
+3
-1
@@ -36,7 +36,9 @@ except ConsoleError, e:
|
||||
saveLog(console.getHistory())
|
||||
FAIL(str(e))
|
||||
|
||||
os.system("mkfs.ext2 -F /dev/ram1")
|
||||
s, o = traceCommand("mke2fs -q -F /dev/ram1")
|
||||
if s != 0:
|
||||
FAIL("mke2fs returned %i != 0" % s)
|
||||
|
||||
for i in range(10):
|
||||
status, output = traceCommand("xm block-attach %s phy:ram1 hda1 w" % domain.getName())
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
-- BEGIN XmTest Log @Fri Oct 28 13:00:55 PDT 2005
|
||||
*input
|
||||
|
||||
|
||||
BusyBox v1.01 (2005.10.27-17:34+0000) Built-in shell (ash)
|
||||
Enter 'help' for a list of built-in commands.
|
||||
|
||||
-sh: can't access tty; job control turned off
|
||||
*ls
|
||||
CVS etc linuxrc opt sbin var
|
||||
bin home lost+found proc tmp
|
||||
dev lib mnt root usr
|
||||
|
||||
-- END XmTest Log
|
||||
@@ -5,13 +5,20 @@
|
||||
|
||||
from XmTestLib import *
|
||||
|
||||
domain = XmTestDomain()
|
||||
import re
|
||||
|
||||
domain = XmTestDomain(extraOpts={"nics":2})
|
||||
|
||||
domain.configAddDisk("phy:/dev/ram0", "hda1", "w")
|
||||
domain.configAddDisk("phy:/dev/ram1", "hdb2", "w")
|
||||
|
||||
s, o = traceCommand("mkfs /dev/ram0")
|
||||
s, o = traceCommand("mke2fs -q /dev/ram0")
|
||||
if s != 0:
|
||||
FAIL("Unable to mkfs /dev/ram0 in dom0")
|
||||
FAIL("Unable to mke2fs /dev/ram0 in dom0")
|
||||
|
||||
s, o = traceCommand("mke2fs -q /dev/ram1")
|
||||
if s != 0:
|
||||
FAIL("Unable to mke2fs /dev/ram1 in dom0")
|
||||
|
||||
try:
|
||||
domain.start()
|
||||
@@ -22,13 +29,38 @@ try:
|
||||
console = XmConsole(domain.getName())
|
||||
console.sendInput("foo")
|
||||
|
||||
run = console.runCmd("mount /dev/hda1 /mnt")
|
||||
run = console.runCmd("mkdir /mnt/a /mnt/b")
|
||||
if run["return"] != 0:
|
||||
FAIL("Unable to mkdir /mnt/a /mnt/b")
|
||||
|
||||
run = console.runCmd("mount /dev/hda1 /mnt/a")
|
||||
if run["return"] != 0:
|
||||
FAIL("Unable to mount /dev/hda1")
|
||||
|
||||
run = console.runCmd("echo bar > /mnt/foo")
|
||||
run = console.runCmd("mount /dev/hdb2 /mnt/b")
|
||||
if run["return"] != 0:
|
||||
FAIL("Unable to write to block device!")
|
||||
FAIL("Unable to mount /dev/hdb2")
|
||||
|
||||
run = console.runCmd("echo hda1 > /mnt/a/foo")
|
||||
if run["return"] != 0:
|
||||
FAIL("Unable to write to block device hda1!")
|
||||
|
||||
run = console.runCmd("echo hdb2 > /mnt/b/foo")
|
||||
if run["return"] != 0:
|
||||
FAIL("Unable to write to block device hdb2!")
|
||||
|
||||
run = console.runCmd("ifconfig eth0 169.254.0.1 netmask 255.255.255.0")
|
||||
if run["return"] != 0:
|
||||
FAIL("Unable to configure DomU's eth0")
|
||||
|
||||
run = console.runCmd("ifconfig eth1 169.254.1.1 netmask 255.255.255.0")
|
||||
if run["return"] != 0:
|
||||
FAIL("Unable to configure DomU's eth1")
|
||||
|
||||
run = console.runCmd("ifconfig lo 127.0.0.1")
|
||||
if run["return"] != 0:
|
||||
FAIL("Unable to configure DomU's lo")
|
||||
|
||||
|
||||
except ConsoleError, e:
|
||||
FAIL(str(e))
|
||||
@@ -63,9 +95,31 @@ try:
|
||||
if run["return"] != 0:
|
||||
FAIL("ls failed on restored domain")
|
||||
|
||||
run = console.runCmd("cat /mnt/foo | grep bar")
|
||||
run = console.runCmd("cat /mnt/a/foo")
|
||||
if run["return"] != 0:
|
||||
FAIL("Unable to read from block device")
|
||||
FAIL("Unable to read from block device hda1")
|
||||
if not re.search("hda1", run["output"]):
|
||||
FAIL("Failed to read correct data from hda1")
|
||||
|
||||
run = console.runCmd("cat /mnt/b/foo")
|
||||
if run["return"] != 0:
|
||||
FAIL("Unable to read from block device hdb2")
|
||||
if not re.search("hdb2", run["output"]):
|
||||
FAIL("Failed to read correct data from hdb2")
|
||||
|
||||
run = console.runCmd("ifconfig")
|
||||
if not re.search("eth0", run["output"]):
|
||||
FAIL("DomU's eth0 disappeared")
|
||||
if not re.search("169.254.0.1", run["output"]):
|
||||
FAIL("DomU's eth0 lost its IP")
|
||||
if not re.search("eth1", run["output"]):
|
||||
FAIL("DomU's eth1 disappeared")
|
||||
if not re.search("169.254.1.1", run["output"]):
|
||||
FAIL("DomU's eth1 lost its IP")
|
||||
if not re.search("Loopback", run["output"]):
|
||||
FAIL("DomU's lo disappeared")
|
||||
if not re.search("127.0.0.1", run["output"]):
|
||||
FAIL("DomU's lo lost its IP")
|
||||
|
||||
except ConsoleError, e:
|
||||
FAIL(str(e))
|
||||
|
||||