Linux-libre 4.19.123-gnu
[librecmc/linux-libre.git] / tools / testing / selftests / sparc64 / drivers / drivers_test.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3
4 SRC_TREE=../../../../
5
6 test_run()
7 {
8         if [ -f ${SRC_TREE}/drivers/char/adi.ko ]; then
9                 insmod ${SRC_TREE}/drivers/char/adi.ko 2> /dev/null
10                 if [ $? -ne 0 ]; then
11                         rc=1
12                 fi
13         else
14                 # Use modprobe dry run to check for missing adi module
15                 if ! /sbin/modprobe -q -n adi; then
16                         echo "adi: [SKIP]"
17                 elif /sbin/modprobe -q adi; then
18                         echo "adi: ok"
19                 else
20                         echo "adi: [FAIL]"
21                         rc=1
22                 fi
23         fi
24         ./adi-test
25         rmmod adi 2> /dev/null
26 }
27
28 rc=0
29 test_run
30 exit $rc