selftests: sparc64: char: Selftest for privileged ADI driver

Add a selftest for the sparc64 privileged ADI driver.  These
tests verify the read(), pread(), write(), pwrite(), and seek()
functionality of the driver.  The tests also report simple
performance statistics:

        Syscall Call    AvgTime AvgSize
                Count   (ticks) (bytes)
        -------------------------------
        read          3  119638    8133
        pread         4  118164    6741
        write         3  339442    8133
        pwrite        4  280134    6741
        seek         10    2919       0
        Pass 8 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Reviewed-by: Allen Pais <allen.pais@oracle.com>
Reviewed-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Tom Hromatka
2018-04-26 10:54:09 -06:00
committed by David S. Miller
parent 873c38a424
commit 3c54508413
7 changed files with 817 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
SRC_TREE=../../../../
test_run()
{
if [ -f ${SRC_TREE}/drivers/char/adi.ko ]; then
insmod ${SRC_TREE}/drivers/char/adi.ko 2> /dev/null
if [ $? -ne 0 ]; then
rc=1
fi
else
# Use modprobe dry run to check for missing adi module
if ! /sbin/modprobe -q -n adi; then
echo "adi: [SKIP]"
elif /sbin/modprobe -q adi; then
echo "adi: ok"
else
echo "adi: [FAIL]"
rc=1
fi
fi
./adi-test
rmmod adi 2> /dev/null
}
rc=0
test_run
exit $rc