1#!/bin/sh
2
3testbins="gpiod-test gpio-tools-test gpiod-cxx-test"
4
5ptestdir=$(dirname "$(readlink -f "$0")")
6cd $ptestdir/tests
7
8# libgpiod v2 uses gpio-sim - a configfs-based testing module. We need to
9# make sure configfs is mounted before running any tests.
10modprobe configfs
11mountpoint /sys/kernel/config > /dev/null || mount -t configfs configfs /sys/kernel/config
12
13for testbin in $testbins; do
14	if test -e ./$testbin; then
15		./$testbin > ./$testbin.out 2>&1
16		if [ $? -ne 0 ]; then
17			echo "FAIL: $testbin"
18		else
19			echo "PASS: $testbin"
20		fi
21	else
22		echo "SKIP: $testbin"
23	fi
24done
25