Skip to content

Commit

Permalink
Expand tests to cover compression and checksumming
Browse files Browse the repository at this point in the history
  • Loading branch information
mkozlowski committed Sep 28, 2024
1 parent 6dd078a commit a7c5dfd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))

Expand Down

0 comments on commit a7c5dfd

Please sign in to comment.