Backed out changeset 8fc3326bce7f (bug 1943032) for causing failures at browser_tab_g...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / deqp / genHTMLfromTest.py
blob47ad28ccc96ecfd034180554473d7696cb1fed59
1 import os
2 import re
4 # Generate an HTML file for each .test file in the current directory
7 TEST_LIST_FILE = '00_test_list.txt';
8 TEMPLATE = 'template.html';
10 def genHTML(template, test):
11 contents = re.sub('___TEST_NAME___', "'" + test + "'", template);
12 filename = test + '.html';
13 print "Generating " + filename;
14 with open(test + '.html', 'w') as f:
15 f.write(contents);
16 return filename;
19 def process_test_files(template):
20 generated = [];
21 files = os.listdir(os.getcwd());
22 for file in files:
23 found = re.search('(^[^.].*)\.test$', file);
24 if found:
25 generated.append(genHTML(template,found.group(1)));
26 return generated;
28 def readTemplate():
29 contents = None;
30 with open(TEMPLATE, 'r') as f:
31 contents = f.read();
32 return contents;
35 template = readTemplate();
36 if (template):
37 test_list = process_test_files(template);
38 print "Generating " + TEST_LIST_FILE;
39 with open(TEST_LIST_FILE, 'w') as f:
40 for item in test_list:
41 f.write(item + '\n');
42 else:
43 print "Couldn't find template file: " + TEMPLATE;