summaryrefslogtreecommitdiffstats
path: root/debian/vendor-h2o/deps/brotli/python/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 02:50:01 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 02:50:01 +0000
commit91275eb478ceb58083426099b6da3f4c7e189f19 (patch)
tree260f7d2fa77408b38c5cea96b320b9b0b6713ff2 /debian/vendor-h2o/deps/brotli/python/tests
parentMerging upstream version 1.9.4. (diff)
downloaddnsdist-91275eb478ceb58083426099b6da3f4c7e189f19.tar.xz
dnsdist-91275eb478ceb58083426099b6da3f4c7e189f19.zip
Merging debian version 1.9.4-1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/vendor-h2o/deps/brotli/python/tests')
-rwxr-xr-xdebian/vendor-h2o/deps/brotli/python/tests/compatibility_test.py27
-rw-r--r--debian/vendor-h2o/deps/brotli/python/tests/custom_dictionary_test.py36
-rwxr-xr-xdebian/vendor-h2o/deps/brotli/python/tests/roundtrip_test.py43
-rw-r--r--debian/vendor-h2o/deps/brotli/python/tests/test_utils.py36
4 files changed, 0 insertions, 142 deletions
diff --git a/debian/vendor-h2o/deps/brotli/python/tests/compatibility_test.py b/debian/vendor-h2o/deps/brotli/python/tests/compatibility_test.py
deleted file mode 100755
index 668c9ec..0000000
--- a/debian/vendor-h2o/deps/brotli/python/tests/compatibility_test.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-from __future__ import print_function
-import glob
-import sys
-import os
-from subprocess import check_call
-
-from test_utils import PYTHON, BRO, TEST_ENV, diff_q
-
-
-os.chdir(os.path.abspath("../../tests"))
-for filename in glob.glob("testdata/*.compressed*"):
- filename = os.path.abspath(filename)
- print('Testing decompression of file "%s"' % os.path.basename(filename))
- expected = filename.split(".compressed")[0]
- uncompressed = expected + ".uncompressed"
- check_call([PYTHON, BRO, "-f", "-d", "-i", filename, "-o", uncompressed],
- env=TEST_ENV)
- if diff_q(uncompressed, expected) != 0:
- sys.exit(1)
- # Test the streaming version
- with open(filename, "rb") as infile, open(uncompressed, "wb") as outfile:
- check_call([PYTHON, BRO, '-d'], stdin=infile, stdout=outfile,
- env=TEST_ENV)
- if diff_q(uncompressed, expected) != 0:
- sys.exit(1)
- os.unlink(uncompressed)
diff --git a/debian/vendor-h2o/deps/brotli/python/tests/custom_dictionary_test.py b/debian/vendor-h2o/deps/brotli/python/tests/custom_dictionary_test.py
deleted file mode 100644
index afbf07a..0000000
--- a/debian/vendor-h2o/deps/brotli/python/tests/custom_dictionary_test.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/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):
- for lgwin in (10, 15, 20, 24):
- filename = os.path.abspath(filename)
- print('Roundtrip testing file "%s" at quality %d with lg(win)=%d and auto-custom-dictionary' %
- (os.path.basename(filename), quality, lgwin))
- compressed = os.path.splitext(filename)[0] + ".custom_bro"
- uncompressed = os.path.splitext(filename)[0] + ".custom_unbro"
- check_call([PYTHON, BRO, "-f", "-q", str(quality), "-i", filename,
- "-o", compressed, "--lgwin", str(lgwin),
- "--custom-dictionary", filename], env=TEST_ENV)
- check_call([PYTHON, BRO, "-f", "-d", "-i", compressed, "-o",
- uncompressed, "--custom-dictionary", filename], env=TEST_ENV)
- if diff_q(filename, uncompressed) != 0:
- sys.exit(1)
diff --git a/debian/vendor-h2o/deps/brotli/python/tests/roundtrip_test.py b/debian/vendor-h2o/deps/brotli/python/tests/roundtrip_test.py
deleted file mode 100755
index 719a7b7..0000000
--- a/debian/vendor-h2o/deps/brotli/python/tests/roundtrip_test.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/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)
diff --git a/debian/vendor-h2o/deps/brotli/python/tests/test_utils.py b/debian/vendor-h2o/deps/brotli/python/tests/test_utils.py
deleted file mode 100644
index 381b64e..0000000
--- a/debian/vendor-h2o/deps/brotli/python/tests/test_utils.py
+++ /dev/null
@@ -1,36 +0,0 @@
-from __future__ import print_function
-import sys
-import os
-import sysconfig
-import filecmp
-
-
-def diff_q(first_file, second_file):
- """Simulate call to POSIX diff with -q argument"""
- if not filecmp.cmp(first_file, second_file, shallow=False):
- print("Files %s and %s differ" % (first_file, second_file),
- file=sys.stderr)
- return 1
- return 0
-
-
-PYTHON = sys.executable or "python"
-
-# 'bro.py' script should be in parent directory
-BRO = os.path.abspath("../bro.py")
-
-# get platform- and version-specific build/lib folder
-platform_lib_name = "lib.{platform}-{version[0]}.{version[1]}".format(
- platform=sysconfig.get_platform(),
- version=sys.version_info)
-
-# by default, distutils' build base is in the same location as setup.py
-build_base = os.path.abspath(os.path.join("..", "..", "build"))
-build_lib = os.path.join(build_base, platform_lib_name)
-
-# prepend build/lib to PYTHONPATH environment variable
-TEST_ENV = os.environ.copy()
-if 'PYTHONPATH' not in TEST_ENV:
- TEST_ENV['PYTHONPATH'] = build_lib
-else:
- TEST_ENV['PYTHONPATH'] = build_lib + os.pathsep + TEST_ENV['PYTHONPATH']