Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Side by Side Diff: third_party/libxslt/win32/runtests.py

Issue 1848793005: Roll libxslt to 891681e3e948f31732229f53cb6db7215f740fc7 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libxslt/win32/libxslt/xsltproc.dsp ('k') | third_party/libxslt/xslt-config.in » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 import io
2 import os
3 import sys
4 import difflib
5
6 from os import path
7 from subprocess import Popen, PIPE
8
9 xsltproc = path.join(os.getcwd(), "win32", "bin.msvc", "xsltproc.exe")
10 if not path.isfile(xsltproc):
11 raise FileNotFoundError(xsltproc)
12
13 def runtests(xsl_dir, xml_dir="."):
14 old_dir = os.getcwd()
15 os.chdir(xsl_dir)
16
17 for xsl_file in os.listdir():
18 if not xsl_file.endswith(".xsl"):
19 continue
20 xsl_path = "./" + xsl_file
21 name = path.splitext(xsl_file)[0]
22
23 xml_path = path.join(xml_dir + "/" + name + ".xml")
24 if not path.isfile(xml_path):
25 continue
26
27 args = [ xsltproc, xsl_path, xml_path ]
28 p = Popen(args, stdout=PIPE, stderr=PIPE)
29 out_path = path.join(xml_dir, name + ".out")
30 err_path = path.join(xml_dir, name + ".err")
31 out_diff = diff(p.stdout, "<stdout>", name + ".out")
32 err_diff = diff(p.stderr, "<stderr>", name + ".err")
33
34 if (len(out_diff) or len(err_diff)):
35 sys.stdout.writelines(out_diff)
36 sys.stdout.writelines(err_diff)
37 print()
38
39 os.chdir(old_dir)
40
41 def diff(got_stream, got_name, expected_path):
42 text_stream = io.TextIOWrapper(got_stream, encoding="latin_1")
43 got_lines = text_stream.readlines()
44
45 if path.isfile(expected_path):
46 file = open(expected_path, "r", encoding="latin_1")
47 expected_lines = file.readlines()
48 else:
49 expected_lines = []
50
51 diff = difflib.unified_diff(expected_lines, got_lines,
52 fromfile=expected_path,
53 tofile=got_name)
54 return list(diff)
55
56 print("## Running REC tests")
57 runtests("tests/REC")
58
59 print("## Running general tests")
60 runtests("tests/general", "./../docs")
61
62 print("## Running exslt common tests")
63 runtests("tests/exslt/common")
64
65 print("## Running exslt functions tests")
66 runtests("tests/exslt/functions")
67
68 print("## Running exslt math tests")
69 runtests("tests/exslt/math")
70
71 print("## Running exslt sets tests")
72 runtests("tests/exslt/sets")
73
74 print("## Running exslt strings tests")
75 runtests("tests/exslt/strings")
76
77 print("## Running exslt dynamic tests")
78 runtests("tests/exslt/dynamic")
79
80 print("## Running exslt date tests")
81 runtests("tests/exslt/date")
82
OLDNEW
« no previous file with comments | « third_party/libxslt/win32/libxslt/xsltproc.dsp ('k') | third_party/libxslt/xslt-config.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698