Commit 92e4bec7 authored by Christian Stenger's avatar Christian Stenger

Squish: Remove also versioned .user files

Change-Id: Icf4325930f5e1bd908fef9cbd87658b4cc8fc110
Reviewed-on: http://codereview.qt-project.org/5601Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarRobert Löhning <robert.loehning@nokia.com>
Reviewed-by: default avatarBill King <bill.king@nokia.com>
parent 3bd56fe9
import tempfile, shutil, os
import tempfile
def neededFilePresent(path):
found = os.path.exists(path)
......@@ -94,3 +94,28 @@ def prepareForSignal(object, signal):
installLazySignalHandler(object, signal, "__callbackFunction__")
return realName
# this function removes the user files of given pro file(s)
# can be called with a single string object or a list of strings holding path(s) to
# the pro file(s) returns False if it could not remove all user files or has been
# called with an unsupported object
def cleanUpUserFiles(pathsToProFiles=None):
if pathsToProFiles==None:
return False
if className(pathsToProFiles) in ("str", "unicode"):
filelist = glob.glob(pathsToProFiles+".user*")
elif className(pathsToProFiles)=="list":
filelist = []
for p in pathsToProFiles:
filelist.extend(glob.glob(p+".user*"))
else:
test.fatal("Got an unsupported object.")
return False
doneWithoutErrors = True
for file in filelist:
try:
file = os.path.abspath(file)
os.remove(file)
except:
doneWithoutErrors = False
return doneWithoutErrors
......@@ -74,16 +74,14 @@ def main():
test.compare(lineUnderCursor(findObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "Dummy::Dummy(int)")
invokeMenuItem("File", "Exit")
waitForCleanShutdown()
def init():
cleanup()
def cleanup():
# Make sure the .user files are gone
if os.access(srcPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro.user", os.F_OK):
os.remove(srcPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro.user")
cleanUpUserFiles(srcPath + "/creator/tests/manual/cplusplus-tools/cplusplus-tools.pro")
BuildPath = glob.glob(srcPath + "/qtcreator-build-*")
BuildPath += glob.glob(srcPath + "/projects-build-*")
......
......@@ -40,6 +40,7 @@ def main():
# Add a new run configuration
invokeMenuItem("File", "Exit")
waitForCleanShutdown()
def init():
global SpeedCrunchPath
......@@ -48,8 +49,7 @@ def init():
def cleanup():
# Make sure the .user files are gone
if os.access(SpeedCrunchPath + ".user", os.F_OK):
os.remove(SpeedCrunchPath + ".user")
cleanUpUserFiles(SpeedCrunchPath)
BuildPath = glob.glob(srcPath + "/creator-test-data/speedcrunch/speedcrunch-build-*")
BuildPath += glob.glob(srcPath + "/creator-test-data/speedcrunch/qtcreator-build-*")
......
......@@ -30,6 +30,7 @@ def main():
checkLastBuild()
invokeMenuItem("File", "Exit")
waitForCleanShutdown()
def init():
global SpeedCrunchPath
......@@ -38,8 +39,7 @@ def init():
def cleanup():
# Make sure the .user files are gone
if os.access(SpeedCrunchPath + ".user", os.F_OK):
os.remove(SpeedCrunchPath + ".user")
cleanUpUserFiles(SpeedCrunchPath)
BuildPath = srcPath + "/creator-test-data/speedcrunch/src/qtcreator-build"
......
......@@ -35,15 +35,13 @@ def main():
test.compare(wordUnderCursor(waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")), "QList")
invokeMenuItem("File", "Exit")
waitForCleanShutdown()
def init():
cleanup()
def cleanup():
# Make sure the .user files are gone
cleanUpUserFiles([srcPath + "/creator-test-data/speedcrunch/src/speedcrunch.pro",
srcPath + "/creator/qtcreator.pro"])
if os.access(srcPath + "/creator-test-data/speedcrunch/src/speedcrunch.pro.user", os.F_OK):
os.remove(srcPath + "/creator-test-data/speedcrunch/src/speedcrunch.pro.user")
if os.access(srcPath + "/creator/qtcreator.pro.user", os.F_OK):
os.remove(srcPath + "/creator/qtcreator.pro.user")
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