]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Add Test Case (Behind Flag); Run in GitHub Action 2613/head
authorW. Felix Handte <w@felixhandte.com>
Tue, 4 May 2021 21:26:05 +0000 (17:26 -0400)
committerW. Felix Handte <w@felixhandte.com>
Tue, 4 May 2021 22:43:39 +0000 (18:43 -0400)
.github/workflows/generic-dev.yml
tests/playTests.sh

index 87b2507284a815610679348b71297f8be8cfb1e8..ae4ee7e9f53a3e83bd8ccd99f7e089af5f6a3600 100644 (file)
@@ -30,6 +30,9 @@ jobs:
 
   test:
     runs-on: ubuntu-latest
+    env:
+      DEVNULLRIGHTS: 1
+      READFROMBLOCKDEVICE: 1
     steps:
     - uses: actions/checkout@v2
     - name: make test
index 04a90e3c2ee931ff6acffc887a5d60b7e4709226..f002d34ecae9a88f82423d8075c0bbf3cd3ea224 100755 (executable)
@@ -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