nx-gzip-test.sh 647 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. # SPDX-License-Identifier: GPL-2.0-or-later
  3. if [[ ! -w /dev/crypto/nx-gzip ]]; then
  4. echo "Can't access /dev/crypto/nx-gzip, skipping"
  5. echo "skip: $0"
  6. exit 4
  7. fi
  8. set -e
  9. function cleanup
  10. {
  11. rm -f nx-tempfile*
  12. }
  13. trap cleanup EXIT
  14. function test_sizes
  15. {
  16. local n=$1
  17. local fname="nx-tempfile.$n"
  18. for size in 4K 64K 1M 64M
  19. do
  20. echo "Testing $size ($n) ..."
  21. dd if=/dev/urandom of=$fname bs=$size count=1
  22. ./gzfht_test $fname
  23. ./gunz_test ${fname}.nx.gz
  24. done
  25. }
  26. echo "Doing basic test of different sizes ..."
  27. test_sizes 0
  28. echo "Running tests in parallel ..."
  29. for i in {1..16}
  30. do
  31. test_sizes $i &
  32. done
  33. wait
  34. echo "OK"
  35. exit 0