aboutsummaryrefslogtreecommitdiff
path: root/lib/io/Makemodule.am
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-02-21 13:23:56 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-02-21 14:10:48 +0100
commit6b1020ef3e034cbb6e0fa4cd984b181c0dd414ff (patch)
tree25f21c41a1bfa11c22c124a0b5c1f531bd025bde /lib/io/Makemodule.am
parent90056de06e274997c9a9f6c3fefa96906b2cd8c2 (diff)
libio: Add an xfrm stream wrapper test
This basically re-uses the libxfrm pack/unpack tests, but runs the data through a stream wrapper. When de-compressing, we have a ridiculously tiny input buffer, to force the wrapper to snort up the data in several attempts until the it can decompress something. We read the data byte-by-byte to force the wraper to internally cache the uncompressed data and spoon feed it to us. It has to be completely transparent to us that it internaly decompresses and also reads transparently across concatenated streams. When compressing, we only require that the output is smaller than the input and not equal to it. We also require the wrapper to flush the wrapped stream when it is flushed. We then test if the compressed data can be unpacked again. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/io/Makemodule.am')
-rw-r--r--lib/io/Makemodule.am43
1 files changed, 39 insertions, 4 deletions
diff --git a/lib/io/Makemodule.am b/lib/io/Makemodule.am
index 71f01e8..e8e1697 100644
--- a/lib/io/Makemodule.am
+++ b/lib/io/Makemodule.am
@@ -15,6 +15,9 @@ endif
noinst_LIBRARIES += libio.a
+LIBIO_TESTS = test_get_line test_sparse_fb test_istream_read \
+ test_istream_skip test_stream_splice
+
test_get_line_SOURCES = lib/io/test/get_line.c
test_get_line_LDADD = libio.a libcompat.a
test_get_line_CPPFLAGS = $(AM_CPPFLAGS)
@@ -32,9 +35,41 @@ test_istream_skip_LDADD = libio.a libutil.a libcompat.a
test_stream_splice_SOURCES = lib/io/test/stream_splice.c
test_stream_splice_LDADD = libio.a libutil.a libcompat.a
-check_PROGRAMS += test_get_line test_sparse_fb test_istream_read
-check_PROGRAMS += test_istream_skip test_stream_splice
-TESTS += test_get_line test_sparse_fb test_istream_read
-TESTS += test_istream_skip test_stream_splice
+if WITH_XZ
+test_io_xfrm_xz_SOURCES = lib/io/test/xfrm.c
+test_io_xfrm_xz_LDADD = libio.a libxfrm.a $(XZ_LIBS)
+test_io_xfrm_xz_CPPFLAGS = $(AM_CPPFLAGS) -DDO_XZ=1
+
+LIBIO_TESTS += test_io_xfrm_xz
+endif
+
+if WITH_BZIP2
+test_io_xfrm_bzip2_SOURCES = lib/io/test/xfrm.c
+test_io_xfrm_bzip2_LDADD = libio.a libxfrm.a $(BZIP2_LIBS)
+test_io_xfrm_bzip2_CPPFLAGS = $(AM_CPPFLAGS) -DDO_BZIP2=1
+
+LIBIO_TESTS += test_io_xfrm_bzip2
+endif
+
+if WITH_GZIP
+test_io_xfrm_gzip_SOURCES = lib/io/test/xfrm.c
+test_io_xfrm_gzip_LDADD = libio.a libxfrm.a $(ZLIB_LIBS)
+test_io_xfrm_gzip_CPPFLAGS = $(AM_CPPFLAGS) -DDO_GZIP=1
+
+LIBIO_TESTS += test_io_xfrm_gzip
+endif
+
+if WITH_ZSTD
+if HAVE_ZSTD_STREAM
+test_io_xfrm_zstd_SOURCES = lib/io/test/xfrm.c
+test_io_xfrm_zstd_LDADD = libio.a libxfrm.a $(ZSTD_LIBS)
+test_io_xfrm_zstd_CPPFLAGS = $(AM_CPPFLAGS) -DDO_ZSTD=1
+
+LIBIO_TESTS += test_io_xfrm_zstd
+endif
+endif
+
+check_PROGRAMS += $(LIBIO_TESTS)
+TESTS += $(LIBIO_TESTS)
EXTRA_DIST += $(top_srcdir)/lib/io/test/get_line.txt