Commit e26ab899 authored by Christian Stenger's avatar Christian Stenger

Squish: Added debugging output

Change-Id: I8f838a61261e1355031b7206a73c013cdcbda5a3
Reviewed-by: default avatarRobert Löhning <robert.loehning@nokia.com>
parent d679dc4d
......@@ -2,7 +2,9 @@ import tempfile
def neededFilePresent(path):
found = os.path.exists(path)
if not found:
if os.getenv("SYSTEST_DEBUG") == "1":
checkAccess(path)
elif not found:
test.fatal("Missing file or directory: " + path)
return found
......@@ -233,3 +235,28 @@ def verifyOutput(string, substring, outputFrom, outputIn):
test.fail("Output from " + outputFrom + " could not be found in " + outputIn)
else:
test.passes("Output from " + outputFrom + " found at position " + str(index) + " of " + outputIn)
# function that verifies the existance and the read permissions
# of the given file path
# if the executing user hasn't the read permission it checks
# the parent folders for their execute permission
def checkAccess(pathToFile):
if os.path.exists(pathToFile):
test.log("Path '%s' exists" % pathToFile)
if os.access(pathToFile, os.R_OK):
test.log("Got read access on '%s'" % pathToFile)
else:
test.fail("No read permission on '%s'" % pathToFile)
else:
test.fatal("Path '%s' does not exist or cannot be accessed" % pathToFile)
__checkParentAccess__(pathToFile)
# helper function for checking the execute rights of all
# parents of filePath
def __checkParentAccess__(filePath):
for i in range(1, filePath.count(os.sep)):
tmp = filePath.rsplit(os.sep, i)[0]
if os.access(tmp, os.X_OK):
test.log("Got execute permission on '%s'" % tmp)
else:
test.fail("No execute permission on '%s'" % tmp)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment