summaryrefslogtreecommitdiffstats
path: root/WebKitTools/BuildSlaveSupport/test-result-archive
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/BuildSlaveSupport/test-result-archive')
-rw-r--r--WebKitTools/BuildSlaveSupport/test-result-archive42
1 files changed, 37 insertions, 5 deletions
diff --git a/WebKitTools/BuildSlaveSupport/test-result-archive b/WebKitTools/BuildSlaveSupport/test-result-archive
index df02dbd..af66bf0 100644
--- a/WebKitTools/BuildSlaveSupport/test-result-archive
+++ b/WebKitTools/BuildSlaveSupport/test-result-archive
@@ -23,10 +23,9 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import optparse, os, shutil, subprocess, sys
+import optparse, os, shutil, subprocess, sys, zipfile
sourceRootDirectory = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
-layoutTestResultsDir = os.path.abspath(os.path.join(sourceRootDirectory, "layout-test-results"))
archiveFile = os.path.join(sourceRootDirectory, "layout-test-results.zip")
def main():
@@ -43,9 +42,16 @@ def main():
if action not in ('archive'):
parser.error("Action is required")
- return archiveTestResults(options.configuration, options.platform)
+ layoutTestResultsDir = os.path.abspath(os.path.join(sourceRootDirectory, "layout-test-results"))
+ if options.platform == 'chromium':
+ # See results_directory() in webkitpy/layout_tests/port/chromium.py.
+ layoutTestResultsDir = os.path.abspath(os.path.join(sourceRootDirectory,
+ "WebKit", "chromium", "webkit", options.configuration.capitalize(),
+ "layout-test-results"))
-def archiveTestResults(configuration, platform):
+ return archiveTestResults(options.configuration, options.platform, layoutTestResultsDir)
+
+def archiveTestResults(configuration, platform, layoutTestResultsDir):
assert platform in ('mac', 'win', 'gtk', 'qt', 'chromium')
try:
@@ -66,9 +72,14 @@ def archiveTestResults(configuration, platform):
if platform == 'mac':
if subprocess.call(["ditto", "-c", "-k", "--sequesterRsrc", layoutTestResultsDir, archiveFile]):
return 1
- elif platform in ('win', 'gtk', 'qt', 'chromium'):
+ elif platform in ('win', 'gtk', 'qt'):
if subprocess.call(["zip", "-r", archiveFile, "."], cwd=layoutTestResultsDir):
return 1
+ elif platform == 'chromium':
+ cwd = os.getcwd()
+ os.chdir(layoutTestResultsDir)
+ zipFilesRecursively(archiveFile, ["."])
+ os.chdir(cwd)
try:
shutil.rmtree(layoutTestResultsDir)
@@ -82,5 +93,26 @@ def archiveTestResults(configuration, platform):
if e.errno != 90:
raise
+def zipFilesRecursively(archiveFile, files):
+ """Make a zip archive.
+
+ Args:
+ archiveFile: The resultant zip archive file name.
+ files: A list of files to be archived. If a list item is a directory,
+ files in the directory are archived recursively."""
+ zipper = zipfile.ZipFile(archiveFile, 'w', zipfile.ZIP_DEFLATED)
+ for file in files:
+ if os.path.isdir(file):
+ for dirPath, dirNames, fileNames in os.walk(file):
+ for fileName in fileNames:
+ relativePath = os.path.join(dirPath, fileName)
+ print "Adding", relativePath
+ zipper.write(relativePath)
+ else:
+ print "Adding", file
+ zipper.write(file)
+ zipper.close()
+ print "Created zip archive: ", archiveFile
+
if __name__ == '__main__':
sys.exit(main())