summaryrefslogtreecommitdiff
path: root/ubi-utils/tests/runtests.sh
blob: f993bc0b5a950941204968ce57681081e0297565 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh

ubidev="$1"
ubiloadcmd="$2"
tests="mkvol_basic mkvol_bad mkvol_paral rsvol io_basic io_read io_update io_paral"

if test -z "$ubidev" || test -z "$ubiloadcmd";
then
	echo "Usage:"
	echo "$0 <UBI device> <ubi module load command>"
	exit 1
fi

ubiname=`echo $ubidev | cut -d/ -f3`

major=`cat /sys/class/ubi/$ubiname/dev | cut -d: -f1`

for minor in `seq 0 4`; do
	if test ! -e ${ubidev}_${minor} ;
	then
		mknod ${ubidev}_${minor} c $major $(($minor + 1))
	fi
done

if ! test -c "$ubidev";
then
	echo "Error: $ubidev is not character device"
	exit 1
fi

for t in `echo $tests`;
do
	echo "Running $t $ubidev"
	"./$t" "$ubidev" || exit 1
done

./integ "$ubiloadcmd" || exit 1

echo SUCCESS

exit 0