From a7c5dfdb701a16390368d0a3e3a34cccdce08856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20Koz=C5=82owski?= Date: Sat, 28 Sep 2024 18:41:10 +0200 Subject: [PATCH] Expand tests to cover compression and checksumming --- Makefile | 2 +- tests/run.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 89b8a01..6c16e5c 100644 --- a/Makefile +++ b/Makefile @@ -167,7 +167,7 @@ $(B)/libencrypt.so: libencrypt.c tests: $(B)/memcr - $(MAKE) -C tests CC=$(CC) MEMCR=../$< ENCRYPT=$(ENCRYPT) + $(MAKE) -C tests CC=$(CC) MEMCR=../$< COMPRESS_LZ4=$(COMPRESS_LZ4) CHECKSUM_MD5=$(CHECKSUM_MD5) ENCRYPT=$(ENCRYPT) ifeq ($(ENCRYPT), 1) tests: $(B)/libencrypt.so diff --git a/tests/run.sh b/tests/run.sh index f16916e..c41387f 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -72,6 +72,24 @@ for OPT in "" "--proc-mem" "--rss-file" "--proc-mem --rss-file"; do done done +# compression tests +if [ "$COMPRESS_LZ4" = 1 ]; then + MEMCR_CMD="${DO}$MEMCR -n -f --compress" + + for TEST in $TESTS; do + do_memcr_test "$MEMCR_CMD" "$TEST" || exit 1 + done +fi + +# checksumming tests +if [ "$CHECKSUM_MD5" = 1 ]; then + MEMCR_CMD="${DO}$MEMCR -n -f --checksum" + + for TEST in $TESTS; do + do_memcr_test "$MEMCR_CMD" "$TEST" || exit 1 + done +fi + # encryption tests if [ "$ENCRYPT" = "1" ]; then if [ ! -f ../libencrypt.so ]; then @@ -90,6 +108,15 @@ if [ "$ENCRYPT" = "1" ]; then done fi +# combined tests +if [ "$COMPRESS_LZ4" = 1 ] && [ "$CHECKSUM_MD5" = 1 ] && [ "$ENCRYPT" = "1" ]; then + MEMCR_CMD="${DO}env LD_PRELOAD=../libencrypt.so $MEMCR -n -f -z -c -e" + + for TEST in $TESTS; do + do_memcr_test "$MEMCR_CMD" "$TEST" || exit 1 + done +fi + TIME_END=$(date +%s%N) TIME_ELAPSED_MS=$(((TIME_END - TIME_START) / 1000000))