]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
seekable_format: Add test for parallel_compression memory usage
authorDave Vasilevsky <dave@vasilevsky.ca>
Wed, 7 May 2025 05:43:36 +0000 (01:43 -0400)
committerYann Collet <Cyan4973@users.noreply.github.com>
Thu, 8 May 2025 05:01:49 +0000 (22:01 -0700)
Use ulimit to fail the test if we use O(filesize) memory, rather than
O(threads).

contrib/seekable_format/tests/.gitignore
contrib/seekable_format/tests/Makefile

index f831eaf37c4ca8be51c0597e593d4ff395cae471..b59d08b342d05ceecea48d311e3f3e069a016078 100644 (file)
@@ -1 +1,2 @@
 seekable_tests
+data.txt
index a81f2229fa5b8a9f7e7d2878bad97920ac75b023..a23c0f43c358bd2507dc056ac82919893789d497 100644 (file)
@@ -24,7 +24,7 @@ SEEKABLE_OBJS = ../zstdseek_compress.c ../zstdseek_decompress.c $(ZSTDLIB)
 .PHONY: default clean test
 default: test
 
-test: seekable_tests
+test: seekable_tests parallel_compression_test
        ./seekable_tests
 
 $(ZSTDLIB):
@@ -32,7 +32,27 @@ $(ZSTDLIB):
 
 seekable_tests : $(SEEKABLE_OBJS)
 
+EXAMPLES_PATH = ../examples
+PARALLEL_COMPRESSION = $(EXAMPLES_PATH)/parallel_compression
+
+DATAGEN_PATH = ../../../tests
+DATAGEN = $(DATAGEN_PATH)/datagen
+
+$(PARALLEL_COMPRESSION):
+       $(MAKE) -C $(EXAMPLES_PATH) parallel_compression
+
+$(DATAGEN):
+       $(MAKE) -C $(DATAGEN_PATH) datagen
+
+data.txt: $(DATAGEN)
+       $(DATAGEN) -g100M > $@
+
+parallel_compression_test: $(PARALLEL_COMPRESSION) data.txt
+       ulimit -Sv 102400; $(PARALLEL_COMPRESSION) data.txt 1048576 2
+
+.PHONY: parallel_compression_test parallel_comp
+
 clean:
        @$(RM) core *.o tmp* result* *.zst \
-               seekable_tests
+               seekable_tests data.txt
        @echo Cleaning completed