Hi Tac,
tac wrote:
Hi lists,
Recently using the ldtprunner to startup some test suites.
Find it is much powerful a tool : )
Still I find some seemingly like problems with it:
1. the test suite path providing for ldtprunner to find the
test_suite_xml file
shouldn't have any "../" kind of thing in it, in which case ldtprunner
just omits it. This
prevents me from executing the gnome-desktop-testing cases directly in
case you may
know that project in Gnome : )
I tried this scenario. If the .py file doesn't exist in the current
directory, the testcase will fail, as it can't find the .py file.
Anyways attached a fix, could you please try this ?
2. Even if "ldtp-daemon" wasn't started in background,
ldtprunner wouldn't
give any complaints and just quit quietly. Though it may be able
to check through
log file, but I just suggested ldtprunner could give more warnings that
may sound
friendly to user ?
In Linux, we no need to start the daemon, unlesss if it doesn't exist in
the path. How does this work in Solaris environment ?
Thanks
Nagappan
Correct me if I may wrong, thanks!
B.R.
tac
_______________________________________________
LDTP-dev mailing list
LDTP-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev
--
Linux Desktop Testing Project - http://ldtp.freedesktop.org
http://nagappanal.blogspot.com
diff --git a/python/ldtprunner b/python/ldtprunner
index c9ad7ca..b5c7f60 100755
--- a/python/ldtprunner
+++ b/python/ldtprunner
@@ -67,18 +67,21 @@ if options.ipAddress != None:
if options.port != None:
os.environ['LDTP_SERVER_PORT'] = options.port
+xmlFileName = os.path.abspath (args [0])
+baseDir = xmlFileName [:xmlFileName.rfind ('/') + 1]
+
try:
- dom = xml.dom.minidom.parse (args[0])
+ dom = xml.dom.minidom.parse (xmlFileName)
except xml.parsers.expat.ExpatError, msg:
- print 'XML Error: ' + str (msg)
+ print 'XML Error: %s' % msg.value
sys.exit (1)
except IOError:
- print 'XML \"' + args[0] + '\" file not found'
+ print 'XML "%s" file not found' % xmlFileName
sys.exit (1)
scriptLevelTimeinfo = False
-class TESTCASESTATE(object):
+class TESTCASESTATE (object):
TCS_ENTERING = 1
TCS_RUNNING = 2
TCS_EXITING = 3
@@ -415,8 +418,8 @@ def executescript (groupelements):
scriptPassCount = 0
totalScripts = len (scripts)
for scriptelements in scripts:
- scriptname = ''
- scriptdata = ''
+ scriptFileName = ''
+ scriptDataFileName = ''
testcasename = None
try:
name = scriptelements.getElementsByTagName ('name')[0]
@@ -424,10 +427,10 @@ def executescript (groupelements):
# print 'Script file entry not present - skipping'
ldtp.log ('Script file entry not present - skipping', 'warning')
continue
- scriptname = getText (name.childNodes)
+ scriptFileName = getText (name.childNodes)
try:
data = scriptelements.getElementsByTagName ('data')[0]
- scriptdata = getText (data.childNodes)
+ scriptDataFileName = getText (data.childNodes)
except IndexError:
ldtp.log ('Data file maynot be present')
try:
@@ -436,14 +439,16 @@ def executescript (groupelements):
except IndexError:
ldtp.log ('testcase name maynot be present')
scriptglobal = dict ({'datafilename' : ''})
- if scriptdata != '':
- ldtp.log (scriptname, 'scriptstart')
- ldtp.log (scriptdata, 'datafilename')
- scriptglobal = dict ({'datafilename' : scriptdata})
+ if scriptDataFileName != '':
+ ldtp.log (scriptFileName, 'scriptstart')
+ if os.path.exists (scriptDataFileName) == False:
+ scriptDataFileName = "%s/%s" % (baseDir, scriptDataFileName)
+ ldtp.log (scriptDataFileName, 'datafilename')
+ scriptglobal = dict ({'datafilename' : scriptDataFileName})
else:
- ldtp.log (scriptname, 'scriptstart')
+ ldtp.log (scriptFileName, 'scriptstart')
ldtp.log ('data xml tag missing', 'info')
- # print 'Executing script: ' + scriptname + ' - ' + scriptdata
+ # print 'Executing script: ' + scriptFileName + ' - ' + scriptDataFileName
try:
appmapfile = scriptelements.getElementsByTagName ('appmapfile')[0]
appmapfilename = getText (appmapfile.childNodes)
@@ -471,8 +476,10 @@ def executescript (groupelements):
try:
if testcasename is not None:
ldtp.log (testcasename, 'teststart')
- scriptname = ldtputils.getFullPath (scriptname)
- execfile (scriptname, scriptglobal)
+ scriptName = scriptFileName = ldtputils.getFullPath (scriptFileName)
+ if os.path.exists (scriptName) == False:
+ scriptName = "%s/%s" % (baseDir, scriptName)
+ execfile (scriptName, scriptglobal)
time.sleep (1)
if scriptLevelTimeinfo:
ldtp.log ('start="%s" elapsed="%s"' % (str (_startLocalTime),
@@ -512,15 +519,15 @@ def executescript (groupelements):
if testcasename is not None:
ldtp.log (testcasename, 'fail')
ldtp.log (testcasename, 'testend')
- ldtp.log (scriptname, 'scriptend')
+ ldtp.log (scriptFileName, 'scriptend')
break
except IOError:
if testcasename is not None:
ldtp.log (testcasename, 'fail')
ldtp.log (testcasename, 'testend')
g_prj_exception = True
- ldtp.log ('Script \"' + scriptname + '\" not found', 'error')
- ldtp.log (scriptname, 'scriptend')
+ ldtp.log ('Script \"' + scriptFileName + '\" not found', 'error')
+ ldtp.log (scriptFileName, 'scriptend')
break
except KeyboardInterrupt:
if testcasename is not None:
@@ -531,7 +538,7 @@ def executescript (groupelements):
getElapsedTime (time.time (),
_startTime)),
'timeinfo')
- ldtp.log (scriptname, 'scriptend')
+ ldtp.log (scriptFileName, 'scriptend')
raise
except:
g_prj_exception = True
@@ -547,9 +554,9 @@ def executescript (groupelements):
getElapsedTime (time.time (),
_startTime)),
'timeinfo')
- ldtp.log (scriptname, 'scriptend')
+ ldtp.log (scriptFileName, 'scriptend')
break
- ldtp.log (scriptname, 'scriptend')
+ ldtp.log (scriptFileName, 'scriptend')
return scriptPassCount, totalScripts
def enable_accessibility ():
_______________________________________________
LDTP-dev mailing list
LDTP-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev