Bug 1277424 - Update wrapper generator to skip WebGL2 testing for linux and Android, r?jgilbert draft
authorpeter chang <pchang@mozilla.com>
Thu, 07 Jul 2016 12:15:11 +0800
changeset 388879 9c53528c83533e8670441490e088a8997e16befc
parent 388878 a8caf7d90056edd7887a0a1f4737637023b648fe
child 388880 b078fe012af0b6b728516d6711bfb38a6e8fc855
push id23250
push userbmo:howareyou322@gmail.com
push dateMon, 18 Jul 2016 06:51:39 +0000
reviewersjgilbert
bugs1277424
milestone50.0a1
Bug 1277424 - Update wrapper generator to skip WebGL2 testing for linux and Android, r?jgilbert MozReview-Commit-ID: GmyvaxYlWZr
dom/canvas/test/webgl-conf/generate-wrappers-and-manifest.py
--- a/dom/canvas/test/webgl-conf/generate-wrappers-and-manifest.py
+++ b/dom/canvas/test/webgl-conf/generate-wrappers-and-manifest.py
@@ -4,27 +4,27 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 # Write a Mochitest manifest for WebGL conformance test files.
 
 import os
 import re
 
-CURRENT_VERSION = '1.0.3'
-
 # All paths in this file are based where this file is run.
 WRAPPER_TEMPLATE_FILE = 'mochi-wrapper.html.template'
 MANIFEST_TEMPLATE_FILE = 'mochitest.ini.template'
 ERRATA_FILE = 'mochitest-errata.ini'
 DEST_MANIFEST_PATHSTR = 'generated-mochitest.ini'
 
 BASE_TEST_LIST_PATHSTR = 'checkout/00_test_list.txt'
 GENERATED_PATHSTR = 'generated'
+WEBGL2_TEST_MANGLE = '2_'
 PATH_SEP_MANGLING = '__'
+WEBGL2_SKIP_IF_CONDITION = "(os == 'android' || os == 'linux')"
 
 SUPPORT_DIRS = [
     'checkout',
 ]
 
 EXTRA_SUPPORT_FILES = [
     'always-fail.html',
     'iframe-passthrough.css',
@@ -279,40 +279,48 @@ class TemplateShell:
                 indentLen += len(span)
             continue
 
         return ret
 
 ########################################################################
 # Output
 
+def IsWrapperWebGL2(wrapperPath):
+    return wrapperPath.startswith(GENERATED_PATHSTR + '/test_' + WEBGL2_TEST_MANGLE)
+
+
 def WriteWrapper(entryPath, webgl2, templateShell, wrapperPathAccum):
     mangledPath = entryPath.replace('/', PATH_SEP_MANGLING)
-    maybeWebGL2 = ''
+    maybeWebGL2Mangle = ''
     if webgl2:
-        maybeWebGL2 = '2_'
+        maybeWebGL2Mangle = WEBGL2_TEST_MANGLE
 
     # Mochitests must start with 'test_' or similar, or the test
     # runner will ignore our tests.
     # The error text is "is not a valid test".
-    wrapperFileName = 'test_{}{}'.format(maybeWebGL2, mangledPath)
+    wrapperFileName = 'test_' + maybeWebGL2Mangle + mangledPath
 
     wrapperPath = GENERATED_PATHSTR + '/' + wrapperFileName
     print('Adding wrapper: ' + wrapperPath)
 
     args = ''
     if webgl2:
         args = '?webglVersion=2'
 
     templateDict = {
         'TEST_PATH': entryPath,
         'ARGS': args,
     }
 
     OutputFilledTemplate(templateShell, templateDict, wrapperPath)
+
+    if webgl2:
+        assert IsWrapperWebGL2(wrapperPath)
+
     wrapperPathAccum.append(wrapperPath)
     return
 
 
 def WriteWrappers(testEntryList):
     templateShell = ImportTemplate(WRAPPER_TEMPLATE_FILE)
 
     generatedDirPath = GENERATED_PATHSTR.replace('/', os.sep)
@@ -366,20 +374,33 @@ def WriteManifest(wrapperPathStrList, su
     wrapperPathStrList = sorted(wrapperPathStrList)
     for wrapperPathStr in wrapperPathStrList:
         #print 'wrapperPathStr: ' + wrapperPathStr
 
         wrapperManifestPathStr = ManifestPathStr(wrapperPathStr)
         sectionName = '[' + wrapperManifestPathStr + ']'
         manifestTestLineList.append(sectionName)
 
+        errataLines = []
         if wrapperPathStr in errataMap:
-            manifestTestLineList += errataMap[wrapperPathStr]
+            errataLines = errataMap[wrapperPathStr]
             del errataMap[wrapperPathStr]
 
+        if IsWrapperWebGL2(wrapperPathStr):
+            needsSkip = True
+            for i in range(len(errataLines)):
+                if errataLines[i].startswith('skip-if'):
+                    errataLines[i] += ' || ' + WEBGL2_SKIP_IF_CONDITION
+                    needsSkip = False
+                continue
+
+            if needsSkip:
+                errataLines.append('skip-if = ' + WEBGL2_SKIP_IF_CONDITION)
+
+        manifestTestLineList += errataLines
         continue
 
     if errataMap:
         print 'Errata left in map:'
         for x in errataMap.keys():
             print ' '*4 + x
         assert False