1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3
4SRC_TREE=../../../../
5
6test_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
28rc=0
29test_run
30exit $rc
31