[orca] More work on the test harness
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] More work on the test harness
- Date: Sat, 7 Dec 2013 12:18:26 +0000 (UTC)
commit 96340e79c71a389d57cd7a81c3c6105cba9817d1
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Sat Dec 7 13:16:39 2013 +0100
More work on the test harness
test/harness/quit.py | 18 -------
test/harness/runall.sh | 2 -
test/harness/runone.sh | 49 +-------------------
test/harness/runorca.py | 21 ++++++---
.../{gcalctool => gnome-calculator}/gcalctool01.py | 0
5 files changed, 16 insertions(+), 74 deletions(-)
---
diff --git a/test/harness/runall.sh b/test/harness/runall.sh
index b934fca..470bc83 100755
--- a/test/harness/runall.sh
+++ b/test/harness/runall.sh
@@ -231,14 +231,12 @@ done
if [ "$coverageMode" -eq 1 ]
then
- python $harnessDir/quit.py
rm user-settings.conf
echo ...finished generating coverage map.
fi
if [ "$profileMode" -eq 1 ]
then
- python $harnessDir/quit.py
rm -f user-settings.conf
mkdir -p ../profile
profileFilePrefix=../profile/`date +%Y-%m-%d_%H:%M:%S`
diff --git a/test/harness/runone.sh b/test/harness/runone.sh
index ebf9ab2..8ca5070 100755
--- a/test/harness/runone.sh
+++ b/test/harness/runone.sh
@@ -34,62 +34,26 @@ then
useage
fi
-#echo runone.sh: $*
-
debugFile=`basename $1 .py`
# Number of seconds to wait for Orca and the application to start
#
WAIT_TIME=10
-# Set up the stuff we want to always be set for every test, regardless
-# if there is a *.params file for the test or not.
-#
-currentDir=`pwd`
-
cp `dirname $0`/orca-customizations.py.in orca-customizations.py
-
-# If a <testfilename>.customizations file exists, add those settings to
-# what is specified in the default orca-customizations-py.in.
-#
CUSTOMIZATIONS_FILE=`dirname $1`/$debugFile.customizations
if [ -f $CUSTOMIZATIONS_FILE ]
then
cat $CUSTOMIZATIONS_FILE >> orca-customizations.py
fi
-cat >> orca-customizations.py << EOF
-
-orca.settings.userPrefsDir = '$currentDir'
-
-if not orca.debug.debugFile:
- orca.debug.debugFile = open('$debugFile.debug', 'w')
-
- import logging
- for logger in ['braille', 'speech']:
- log = logging.getLogger(logger)
- formatter = logging.Formatter('%(name)s.%(message)s')
- handler = logging.FileHandler('$debugFile.%s' % logger, 'w')
- handler.setFormatter(formatter)
- log.addHandler(handler)
- log.setLevel(logging.INFO)
-EOF
-
-# Set up our local user settings file for the output format we want.
-#
-# If a <testfilename>.settings file exists, should use that instead of
-# the default user-settings.conf.in.
-#
-# (Orca will look in our local directory first for user-settings.conf
-# before looking in the usual location)
-#
SETTINGS_FILE=`dirname $1`/$debugFile.settings
if [ ! -f $SETTINGS_FILE ]
then
SETTINGS_FILE=`dirname $0`/user-settings.conf.in
fi
cp $SETTINGS_FILE user-settings.conf
-#echo "Using settings file:" $SETTINGS_FILE
+
# Allow us to pass parameters to the command line of the application.
#
@@ -163,7 +127,7 @@ if [ $orcaRunning -eq 0 ]
then
# Run orca and let it settle in.
#echo starting Orca...
- $harnessDir/runorca.py --user-prefs `pwd`&
+ $harnessDir/runorca.py --user-prefs `pwd` --debug-file $debugFile &
sleep $WAIT_TIME
fi
@@ -172,23 +136,14 @@ fi
#
echo starting test application $APP_NAME $ARGS $PARAMS ...
$APP_NAME $ARGS $PARAMS &
-#sleep $WAIT_TIME
APP_PID=$!
-#echo $APP_NAME pid $APP_PID
-
# Play the keystrokes.
#
python3 $1
-# Let things settle for a couple seconds...
-#
-#sleep $WAIT_TIME
-
if [ $orcaRunning -eq 0 ]
then
- # Terminate Orca
- #echo terminating Orca
pkill -9 orca > /dev/null 2>&1
fi
diff --git a/test/harness/runorca.py b/test/harness/runorca.py
index 39e6356..ce50dc2 100755
--- a/test/harness/runorca.py
+++ b/test/harness/runorca.py
@@ -15,8 +15,10 @@ from dbus.mainloop.glib import DBusGMainLoop
class LoggerService(dbus.service.Object):
- def __init__(self):
+ def __init__(self, filePrefix):
self._logger = orca.getLogger()
+ self._logNames = ['braille', 'speech']
+ self._filePrefix = filePrefix
DBusGMainLoop(set_as_default=True)
busname = dbus.service.BusName('org.gnome.Orca', bus=dbus.SessionBus())
@@ -24,16 +26,18 @@ class LoggerService(dbus.service.Object):
@dbus.service.method(dbus_interface='org.gnome.Orca.Logger', in_signature='', out_signature='')
def startRecording(self):
- names = self._logger.getLogNames()
- for name in names:
+ for name in self._logNames:
self._logger.clearLog(name)
@dbus.service.method(dbus_interface='org.gnome.Orca.Logger', in_signature='', out_signature='s')
def stopRecording(self):
contents = ''
- names = self._logger.getLogNames()
- for name in names:
- contents += self._logger.getLogContent(name)
+ for name in self._logNames:
+ content = self._logger.getLogContent(name)
+ contents += content
+ fileName = open('%s.%s' % (self._filePrefix, name), 'a')
+ fileName.writelines(content)
+ fileName.close()
return contents
@@ -42,13 +46,16 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument("-u", "--user-prefs", action="store")
+ parser.add_argument("--debug-file", action="store")
args = parser.parse_args()
+ orca.debug.debugFile = open('%s.debug' % args.debug_file, 'w')
+
manager = orca.getSettingsManager()
manager.activate(args.user_prefs)
sys.path.insert(0, manager.getPrefsDir())
- service = LoggerService()
+ service = LoggerService(args.debug_file)
return orca.main()
diff --git a/test/keystrokes/gcalctool/gcalctool01.py b/test/keystrokes/gnome-calculator/gcalctool01.py
similarity index 100%
rename from test/keystrokes/gcalctool/gcalctool01.py
rename to test/keystrokes/gnome-calculator/gcalctool01.py
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]