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

Unified 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, 9 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libxslt/win32/runtests.py
diff --git a/third_party/libxslt/win32/runtests.py b/third_party/libxslt/win32/runtests.py
new file mode 100644
index 0000000000000000000000000000000000000000..6986650aa1fec068350e11d3cd18eb6ed6debe58
--- /dev/null
+++ b/third_party/libxslt/win32/runtests.py
@@ -0,0 +1,82 @@
+import io
+import os
+import sys
+import difflib
+
+from os import path
+from subprocess import Popen, PIPE
+
+xsltproc = path.join(os.getcwd(), "win32", "bin.msvc", "xsltproc.exe")
+if not path.isfile(xsltproc):
+ raise FileNotFoundError(xsltproc)
+
+def runtests(xsl_dir, xml_dir="."):
+ old_dir = os.getcwd()
+ os.chdir(xsl_dir)
+
+ for xsl_file in os.listdir():
+ if not xsl_file.endswith(".xsl"):
+ continue
+ xsl_path = "./" + xsl_file
+ name = path.splitext(xsl_file)[0]
+
+ xml_path = path.join(xml_dir + "/" + name + ".xml")
+ if not path.isfile(xml_path):
+ continue
+
+ args = [ xsltproc, xsl_path, xml_path ]
+ p = Popen(args, stdout=PIPE, stderr=PIPE)
+ out_path = path.join(xml_dir, name + ".out")
+ err_path = path.join(xml_dir, name + ".err")
+ out_diff = diff(p.stdout, "<stdout>", name + ".out")
+ err_diff = diff(p.stderr, "<stderr>", name + ".err")
+
+ if (len(out_diff) or len(err_diff)):
+ sys.stdout.writelines(out_diff)
+ sys.stdout.writelines(err_diff)
+ print()
+
+ os.chdir(old_dir)
+
+def diff(got_stream, got_name, expected_path):
+ text_stream = io.TextIOWrapper(got_stream, encoding="latin_1")
+ got_lines = text_stream.readlines()
+
+ if path.isfile(expected_path):
+ file = open(expected_path, "r", encoding="latin_1")
+ expected_lines = file.readlines()
+ else:
+ expected_lines = []
+
+ diff = difflib.unified_diff(expected_lines, got_lines,
+ fromfile=expected_path,
+ tofile=got_name)
+ return list(diff)
+
+print("## Running REC tests")
+runtests("tests/REC")
+
+print("## Running general tests")
+runtests("tests/general", "./../docs")
+
+print("## Running exslt common tests")
+runtests("tests/exslt/common")
+
+print("## Running exslt functions tests")
+runtests("tests/exslt/functions")
+
+print("## Running exslt math tests")
+runtests("tests/exslt/math")
+
+print("## Running exslt sets tests")
+runtests("tests/exslt/sets")
+
+print("## Running exslt strings tests")
+runtests("tests/exslt/strings")
+
+print("## Running exslt dynamic tests")
+runtests("tests/exslt/dynamic")
+
+print("## Running exslt date tests")
+runtests("tests/exslt/date")
+
« 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