Added new qml test and continue refactoring

Refactoring of all helper functions to make it easier to
recognize them as such. All helper functions in global
shared scripts now follow the scheme __NAME__
Helper functions normally should not get called from outside.

Change-Id: I0d02028d3f9de1ad251af9226c0460655bd9c9bd
Reviewed-on: http://codereview.qt-project.org/5331
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Bill King <bill.king@nokia.com>
This commit is contained in:
Christian Stenger
2011-09-21 17:29:18 +02:00
committed by Bill King
parent ddacec3eb5
commit 11f7dbda77
14 changed files with 225 additions and 63 deletions
+32 -3
View File
@@ -4,6 +4,9 @@ import os;
import glob;
import atexit;
import codecs;
import subprocess;
import errno;
from datetime import datetime,timedelta;
SDKPath = ''
SettingsPath = ''
@@ -14,10 +17,36 @@ source("../../shared/utils.py")
source("../../shared/build_utils.py")
source("../../shared/mainwin.py")
source("../../shared/qtquick.py")
source("../../shared/editor_utils.py")
def removeTmpSettingsDir():
def waitForCleanShutdown(timeOut=10):
appCtxt = currentApplicationContext()
waitFor("appCtxt.isRunning==False")
shutdownDone = False
if platform.system() in ('Windows','Microsoft'):
endtime = datetime.utcnow() + timedelta(seconds=timeOut)
while not shutdownDone:
# following work-around because os.kill() works for win not until python 2.7
tasks = subprocess.Popen("tasklist /FI \"PID eq %d\"" % appCtxt.pid, shell=True,stdout=subprocess.PIPE)
output = tasks.communicate()[0]
tasks.stdout.close()
if (output=="INFO: No tasks are running which match the specified criteria."
or output=="" or output.find("ERROR")==0):
shutdownDone=True
if not shutdownDone and datetime.utcnow() > endtime:
break
else:
endtime = datetime.utcnow() + timedelta(seconds=timeOut)
while not shutdownDone:
try:
os.kill(appCtxt.pid,0)
except OSError, err:
if err.errno == errno.EPERM or err.errno == errno.ESRCH:
shutdownDone=True
if not shutdownDone and datetime.utcnow() > endtime:
break
def __removeTmpSettingsDir__():
waitForCleanShutdown()
deleteDirIfExists(os.path.dirname(tmpSettingsDir))
if platform.system() in ('Windows', 'Microsoft'):
@@ -34,6 +63,6 @@ tmpSettingsDir = tempDir()
tmpSettingsDir = os.path.abspath(tmpSettingsDir+"/settings")
shutil.copytree(cwd, tmpSettingsDir)
# the following only doesn't work if the test ends in an exception
atexit.register(removeTmpSettingsDir)
atexit.register(__removeTmpSettingsDir__)
SettingsPath = " -settingspath %s" % tmpSettingsDir