Commit 810aa6d0 authored by zmo@google.com's avatar zmo@google.com

Fix webgl conformance test list generation script.

The current code is for update time run, so it can generate correct list per OS.  However, we changed it to run locally and check the generated list in, so we need to have OS conditions for tests.

Also, add DEBUG/RELEASE modifier so we can mark test failures better.

BUG=
TEST=gpu_tests built
R=kbr
Review URL: http://codereview.chromium.org/8885003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114078 0039d316-1c4b-4281-b951-d872f2087c98
parent 22191158
...@@ -45,29 +45,50 @@ OUTPUT_FILE = "webgl_conformance_test_list_autogen.h" ...@@ -45,29 +45,50 @@ OUTPUT_FILE = "webgl_conformance_test_list_autogen.h"
EXPECTATION_FILE = "webgl_conformance_test_expectations.txt" EXPECTATION_FILE = "webgl_conformance_test_expectations.txt"
EXPECTATION_REGEXP = re.compile( EXPECTATION_REGEXP = re.compile(
r'^(?P<BUG>\S+)\s+' r'^(?P<BUG>\S+)\s+'
'(?P<OS>(\s*(WIN|MAC|LINUX)\s*)+):' '(?P<MODIFIER>(\s*(WIN|MAC|LINUX|RELEASE|DEBUG)\s*)+):'
'(?P<TEST>[^=]+)=' '(?P<TEST>[^=]+)='
'(?P<OUTCOME>(\s*(PASS|FAIL|TIMEOUT)\s*)+)') '(?P<OUTCOME>(\s*(PASS|FAIL|TIMEOUT)\s*)+)')
def is_matching_os(expected_os_list): def map_to_macro_conditions(modifier_list):
"""Returns true if the current OS is in the given list. """Returns a string containing macro conditions wrapped in '(*)'.
Given a list containing 'WIN', 'MAC' or 'LINUX', return true if the current Given a list containing 'WIN', 'MAC', 'LINUX', 'RELEASE', or 'DEBUG',
OS, represented as 'win32', 'darwin' or 'linux*', respectively, exists in the return the corresponding macro conditions.
list.
""" """
if sys.platform.startswith('linux') and 'LINUX' in expected_os_list: rt = ''
return True; release = False
if sys.platform == 'darwin' and 'MAC' in expected_os_list: debug = False
return True; for modifier in modifier_list:
if sys.platform == 'win32' and 'WIN' in expected_os_list: if modifier == 'RELEASE':
return True; release = True
return False; elif modifier == 'DEBUG':
debug = True
else:
if rt:
rt += ' || '
if modifier == 'WIN':
rt = rt + 'defined(OS_WIN)'
elif modifier == 'MAC':
rt = rt + 'defined(OS_MACOSX)'
elif modifier == 'LINUX':
rt = rt + 'defined(OS_LINUX)'
if release == debug:
return rt
if rt:
rt = '(' + rt + ') && '
if debug:
rt = rt + '!defined(NDEBUG)'
if release:
rt = rt + 'defined(NDEBUG)'
return rt
def main(argv): def main(argv):
"""Main function for the WebGL conformance test list generator. """Main function for the WebGL conformance test list generator.
""" """
if not os.path.exists(os.path.join(INPUT_DIR, INPUT_FILE)): if not os.path.exists(os.path.join(INPUT_DIR, INPUT_FILE)):
print >> sys.stderr, "ERROR: WebGL conformance tests do not exist." print >> sys.stderr, "ERROR: WebGL conformance tests do not exist."
print >> sys.stderr, "Run the script from the directory containing it." print >> sys.stderr, "Run the script from the directory containing it."
...@@ -77,31 +98,39 @@ def main(argv): ...@@ -77,31 +98,39 @@ def main(argv):
print >> sys.stderr, "Run the script from the directory containing it." print >> sys.stderr, "Run the script from the directory containing it."
return 1 return 1
output = open(OUTPUT_FILE, "w")
output.write(COPYRIGHT)
output.write(WARNING)
output.write(HEADER_GUARD)
test_prefix = {} test_prefix = {}
test_expectations = open(EXPECTATION_FILE) test_expectations = open(EXPECTATION_FILE)
for line in test_expectations: for line in test_expectations:
line_match = EXPECTATION_REGEXP.match(line) line_match = EXPECTATION_REGEXP.match(line)
if line_match: if line_match:
match_dict = line_match.groupdict() match_dict = line_match.groupdict()
os_list = match_dict['OS'].strip().split() modifier_list = match_dict['MODIFIER'].strip().split()
if not is_matching_os(os_list): macro_conditions = map_to_macro_conditions(modifier_list)
continue
test = match_dict['TEST'].strip() test = match_dict['TEST'].strip()
outcome_list = match_dict['OUTCOME'].strip().split() outcome_list = match_dict['OUTCOME'].strip().split()
if 'TIMEOUT' in outcome_list: if 'TIMEOUT' in outcome_list:
test_prefix[test] = "DISABLED_" prefix = "DISABLED_"
elif 'FAIL' in outcome_list: elif 'FAIL' in outcome_list:
if 'PASS' in outcome_list: if 'PASS' in outcome_list:
test_prefix[test] = "FLAKY_" prefix = "FLAKY_"
else: else:
test_prefix[test] = "FAILS_" prefix = "FAILS_"
if macro_conditions:
output.write('#if %s\n' % macro_conditions)
output.write('#define MAYBE_%s %s%s\n' % (test, prefix, test))
output.write('#elif !defined(MAYBE_%s)\n' % test)
output.write('#define MAYBE_%s %s\n' % (test, test))
output.write('#endif\n')
test_prefix[test] = 'MAYBE_'
else:
test_prefix[test] = prefix
test_expectations.close() test_expectations.close()
output = open(OUTPUT_FILE, "w")
output.write(COPYRIGHT)
output.write(WARNING)
output.write(HEADER_GUARD)
unparsed_files = [INPUT_FILE] unparsed_files = [INPUT_FILE]
while unparsed_files: while unparsed_files:
filename = unparsed_files.pop(0) filename = unparsed_files.pop(0)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// This file contains a list of defective WebGL conformance tests. The expected // This file contains a list of defective WebGL conformance tests. The expected
// format is: // format is:
// {BUG#} {MAC,WIN,LINUX} : {TEST_NAME} = {FAIL,TIMEOUT} // {BUG#} {MAC,WIN,LINUX,RELEASE,DEBUG} : {TEST_NAME} = {PASS,FAIL,TIMEOUT}
// //
// Examples: // Examples:
// 91530 MAC WIN LINUX : context_lost_restored = TIMEOUT // 91530 MAC WIN LINUX : context_lost_restored = TIMEOUT
......
...@@ -9,6 +9,21 @@ ...@@ -9,6 +9,21 @@
#ifndef CHROME_TEST_GPU_WEBGL_CONFORMANCE_TEST_LIST_AUTOGEN_H_ #ifndef CHROME_TEST_GPU_WEBGL_CONFORMANCE_TEST_LIST_AUTOGEN_H_
#define CHROME_TEST_GPU_WEBGL_CONFORMANCE_TEST_LIST_AUTOGEN_H_ #define CHROME_TEST_GPU_WEBGL_CONFORMANCE_TEST_LIST_AUTOGEN_H_
#if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX)
#define MAYBE_conformance_more_functions_readPixelsBadArgs FAILS_conformance_more_functions_readPixelsBadArgs
#elif !defined(MAYBE_conformance_more_functions_readPixelsBadArgs)
#define MAYBE_conformance_more_functions_readPixelsBadArgs conformance_more_functions_readPixelsBadArgs
#endif
#if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX)
#define MAYBE_conformance_more_functions_texImage2DHTML FAILS_conformance_more_functions_texImage2DHTML
#elif !defined(MAYBE_conformance_more_functions_texImage2DHTML)
#define MAYBE_conformance_more_functions_texImage2DHTML conformance_more_functions_texImage2DHTML
#endif
#if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX)
#define MAYBE_conformance_more_functions_texSubImage2DHTML FAILS_conformance_more_functions_texSubImage2DHTML
#elif !defined(MAYBE_conformance_more_functions_texSubImage2DHTML)
#define MAYBE_conformance_more_functions_texSubImage2DHTML conformance_more_functions_texSubImage2DHTML
#endif
CONFORMANCE_TEST(conformance_more_conformance_constants, CONFORMANCE_TEST(conformance_more_conformance_constants,
"conformance/more/conformance/constants.html"); "conformance/more/conformance/constants.html");
CONFORMANCE_TEST(conformance_more_conformance_getContext, CONFORMANCE_TEST(conformance_more_conformance_getContext,
...@@ -73,13 +88,13 @@ CONFORMANCE_TEST(conformance_more_functions_isTests, ...@@ -73,13 +88,13 @@ CONFORMANCE_TEST(conformance_more_functions_isTests,
"conformance/more/functions/isTests.html"); "conformance/more/functions/isTests.html");
CONFORMANCE_TEST(conformance_more_functions_readPixels, CONFORMANCE_TEST(conformance_more_functions_readPixels,
"conformance/more/functions/readPixels.html"); "conformance/more/functions/readPixels.html");
CONFORMANCE_TEST(FAILS_conformance_more_functions_readPixelsBadArgs, CONFORMANCE_TEST(MAYBE_conformance_more_functions_readPixelsBadArgs,
"conformance/more/functions/readPixelsBadArgs.html"); "conformance/more/functions/readPixelsBadArgs.html");
CONFORMANCE_TEST(conformance_more_functions_texImage2D, CONFORMANCE_TEST(conformance_more_functions_texImage2D,
"conformance/more/functions/texImage2D.html"); "conformance/more/functions/texImage2D.html");
CONFORMANCE_TEST(conformance_more_functions_texImage2DBadArgs, CONFORMANCE_TEST(conformance_more_functions_texImage2DBadArgs,
"conformance/more/functions/texImage2DBadArgs.html"); "conformance/more/functions/texImage2DBadArgs.html");
CONFORMANCE_TEST(FAILS_conformance_more_functions_texImage2DHTML, CONFORMANCE_TEST(MAYBE_conformance_more_functions_texImage2DHTML,
"conformance/more/functions/texImage2DHTML.html"); "conformance/more/functions/texImage2DHTML.html");
CONFORMANCE_TEST(conformance_more_functions_texImage2DHTMLBadArgs, CONFORMANCE_TEST(conformance_more_functions_texImage2DHTMLBadArgs,
"conformance/more/functions/texImage2DHTMLBadArgs.html"); "conformance/more/functions/texImage2DHTMLBadArgs.html");
...@@ -87,7 +102,7 @@ CONFORMANCE_TEST(conformance_more_functions_texSubImage2D, ...@@ -87,7 +102,7 @@ CONFORMANCE_TEST(conformance_more_functions_texSubImage2D,
"conformance/more/functions/texSubImage2D.html"); "conformance/more/functions/texSubImage2D.html");
CONFORMANCE_TEST(conformance_more_functions_texSubImage2DBadArgs, CONFORMANCE_TEST(conformance_more_functions_texSubImage2DBadArgs,
"conformance/more/functions/texSubImage2DBadArgs.html"); "conformance/more/functions/texSubImage2DBadArgs.html");
CONFORMANCE_TEST(FAILS_conformance_more_functions_texSubImage2DHTML, CONFORMANCE_TEST(MAYBE_conformance_more_functions_texSubImage2DHTML,
"conformance/more/functions/texSubImage2DHTML.html"); "conformance/more/functions/texSubImage2DHTML.html");
CONFORMANCE_TEST(conformance_more_functions_texSubImage2DHTMLBadArgs, CONFORMANCE_TEST(conformance_more_functions_texSubImage2DHTMLBadArgs,
"conformance/more/functions/texSubImage2DHTMLBadArgs.html"); "conformance/more/functions/texSubImage2DHTMLBadArgs.html");
......
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