diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 21:12:02 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 21:12:02 +0000 |
commit | 77e50caaf2ef81cd91075cf836fed0e75718ffb4 (patch) | |
tree | 53b7b411290b63192fc9e924a3b6b65cdf67e9d0 /debian/vendor-h2o/deps/brotli/python/tests/roundtrip_test.py | |
parent | Adding upstream version 1.8.3. (diff) | |
download | dnsdist-77e50caaf2ef81cd91075cf836fed0e75718ffb4.tar.xz dnsdist-77e50caaf2ef81cd91075cf836fed0e75718ffb4.zip |
Adding debian version 1.8.3-2.debian/1.8.3-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | debian/vendor-h2o/deps/brotli/python/tests/roundtrip_test.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/debian/vendor-h2o/deps/brotli/python/tests/roundtrip_test.py b/debian/vendor-h2o/deps/brotli/python/tests/roundtrip_test.py new file mode 100755 index 0000000..719a7b7 --- /dev/null +++ b/debian/vendor-h2o/deps/brotli/python/tests/roundtrip_test.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python +from __future__ import print_function +import sys +import os +from subprocess import check_call, Popen, PIPE + +from test_utils import PYTHON, BRO, TEST_ENV, diff_q + + +INPUTS = """\ +testdata/alice29.txt +testdata/asyoulik.txt +testdata/lcet10.txt +testdata/plrabn12.txt +../enc/encode.cc +../enc/dictionary.h +../dec/decode.c +%s +""" % BRO + +os.chdir(os.path.abspath("../../tests")) +for filename in INPUTS.splitlines(): + for quality in (1, 6, 9, 11): + filename = os.path.abspath(filename) + print('Roundtrip testing file "%s" at quality %d' % + (os.path.basename(filename), quality)) + compressed = os.path.splitext(filename)[0] + ".bro" + uncompressed = os.path.splitext(filename)[0] + ".unbro" + check_call([PYTHON, BRO, "-f", "-q", str(quality), "-i", filename, + "-o", compressed], env=TEST_ENV) + check_call([PYTHON, BRO, "-f", "-d", "-i", compressed, "-o", + uncompressed], env=TEST_ENV) + if diff_q(filename, uncompressed) != 0: + sys.exit(1) + # Test the streaming version + with open(filename, "rb") as infile, \ + open(uncompressed, "wb") as outfile: + p = Popen([PYTHON, BRO, "-q", str(quality)], stdin=infile, + stdout=PIPE, env=TEST_ENV) + check_call([PYTHON, BRO, "-d"], stdin=p.stdout, stdout=outfile, + env=TEST_ENV) + if diff_q(filename, uncompressed) != 0: + sys.exit(1) |