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