From e58e9c792863d3b43f7ca755d3e29a8631c0f5a5 Mon Sep 17 00:00:00 2001 From: "W. Felix Handte" Date: Tue, 4 May 2021 17:26:05 -0400 Subject: [PATCH] Add Test Case (Behind Flag); Run in GitHub Action --- .github/workflows/generic-dev.yml | 3 +++ tests/playTests.sh | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 87b25072..ae4ee7e9 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -30,6 +30,9 @@ jobs: test: runs-on: ubuntu-latest + env: + DEVNULLRIGHTS: 1 + READFROMBLOCKDEVICE: 1 steps: - uses: actions/checkout@v2 - name: make test diff --git a/tests/playTests.sh b/tests/playTests.sh index 04a90e3c..f002d34e 100755 --- a/tests/playTests.sh +++ b/tests/playTests.sh @@ -459,6 +459,22 @@ if [ -n "$DEVNULLRIGHTS" ] ; then ls -las $INTOVOID | grep "rw-rw-rw-" fi +if [ -n "$READFROMBLOCKDEVICE" ] ; then + # This creates a temporary block device, which is only possible on unix-y + # systems, is somewhat invasive, and requires sudo. For these reasons, you + # have to specifically ask for this test. + println "\n===> checking that zstd can read from a block device" + datagen -g65536 > tmp.img + sudo losetup -fP tmp.img + LOOP_DEV=$(losetup -a | grep 'tmp\.img' | cut -f1 -d:) + [ -z "$LOOP_DEV" ] && die "failed to get loopback device" + sudoZstd $LOOP_DEV -c > tmp.img.zst && die "should fail without -f" + sudoZstd -f $LOOP_DEV -c > tmp.img.zst + zstd -d tmp.img.zst -o tmp.img.copy + sudo losetup -d $LOOP_DEV + $DIFF -s tmp.img tmp.img.copy || die "round trip failed" + rm -f tmp.img tmp.img.zst tmp.img.copy +fi println "\n===> compress multiple files into an output directory, --output-dir-flat" println henlo > tmp1