forked from w3c/csswg-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-css3-writing-modes.py
executable file
·70 lines (61 loc) · 2.47 KB
/
build-css3-writing-modes.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/python
# CSS Writing Modes Level 3 Test Suite Build Script
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# Initial code by fantasai, joint copyright 2010 W3C and Microsoft
# Licensed under BSD 3-Clause: <http://www.w3.org/Consortium/Legal/2008/03-bsd-license>
import os.path
skipDirs = ('support')
reftestPath = 'reftest.list'
rawDirs = {'other-formats':'other'}
import sys
from os.path import join, exists, basename
from w3ctestlib.Suite import TestSuite
from w3ctestlib.Indexer import Indexer
from w3ctestlib.Utils import listdirs, listfiles, basepath
# run from css test suite repo root
print "Building CSS Writing Modes Level 3 Test Suite from repository %s into %s" % \
(os.path.abspath('.'), os.path.abspath(os.path.join('.', 'dist', 'css3-writing-modes')))
unreviewed = sys.argv[1:]
print "Requested unreviewed source directories."
# Set up
suite = TestSuite('css3-writing-modes', 'CSS Writing Modes Module Level 3 Test Suite', 'http://www.w3.org/TR/css3-writing-modes/')
suite.setFormats(('html5', 'xhtml1'))
# Add approved tests
root = join('approved', 'css3-writing-modes', 'src')
dirs = listdirs(root)
for dir in dirs:
if dir in skipDirs or rawDirs.has_key(dir): continue
testroot = join(root, dir)
suite.addTestsByExt(testroot, '.xht')
suite.addTestsByExt(testroot, '.html')
if exists(join(testroot, reftestPath)):
suite.addReftests(testroot, reftestPath)
suite.addTestsByExt(root, '.xht')
suite.addTestsByExt(root, '.html')
if exists(join(root, reftestPath)):
suite.addReftests(root, reftestPath)
for src, dst in rawDirs.items():
if exists(join(root,src)):
suite.addRaw(join(root,src), dst)
# Add unreviewed tests
for path in unreviewed:
if path.endswith('.list'):
print "Adding unreviewed reftests from %s" % path
suite.addReftests(basepath(path), basename(path))
else:
def grep(file):
if not (file.endswith('.xht') or file.endswith('.html')):
return False
for line in open(join(path, file)):
if line.find(suite.specroot) != -1:
return True
return False
files = listfiles(path)
files = filter(grep, files)
print "Adding %d unreviewed selftests from %s" % (len(files), path)
suite.addTestsByList(path, files)
# Build
data = join('approved', 'css3-writing-modes', 'data')
indexer = Indexer(suite, join(data, 'sections.dat'), True, templatePathList=[data],
extraData={ 'devel' : False, 'official' : True })
suite.buildInto(join('dist', 'css3-writing-modes'), indexer)