Hash :
5df9f523
Author :
Date :
2014-05-16T10:37:47
Automate the DEQP tests by wrapping them in the gtest suite. BUG=angle:497 Change-Id: If0a72c053bccccc4369ec78dd70173bbadb1be7b Reviewed-on: https://chromium-review.googlesource.com/200044 Reviewed-by: Jamie Madill <jmadill@chromium.org> Tested-by: Geoff Lang <geofflang@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
import os
import re
import sys
def ReadFileAsLines(filename):
"""Reads a file, removing blank lines and lines that start with #"""
file = open(filename, "r")
raw_lines = file.readlines()
file.close()
lines = []
for line in raw_lines:
line = line.strip()
if len(line) > 0 and not line.startswith("#"):
lines.append(line)
return lines
def GetCleanTestName(testName):
replacements = { "dEQP-": "", ".*": "", ".":"_", }
cleanName = testName
for replaceKey in replacements:
cleanName = cleanName.replace(replaceKey, replacements[replaceKey])
return cleanName
def GenerateTests(outFile, testNames):
''' Remove duplicate tests '''
testNames = list(set(testNames))
outFile.write("#include \"deqp_tests.h\"\n\n")
for test in testNames:
outFile.write("TEST(deqp, " + GetCleanTestName(test) + ")\n")
outFile.write("{\n")
outFile.write(" RunDEQPTest(\"" + test + "\", GetCurrentConfig());\n")
outFile.write("}\n\n")
def main(argv):
tests = ReadFileAsLines(argv[0])
output = open(argv[1], 'wb')
GenerateTests(output, tests)
output.close()
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))