aboutsummaryrefslogtreecommitdiff
path: root/testsuite/mdev.tests
blob: 4c44adcb8ee56af7fdc80dec471567b5be75ef8d (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
#!/bin/sh
# Copyright 2008 by Denys Vlasenko
# Licensed under GPL v2, see file LICENSE for details.

. testing.sh

# ls -ln is showing date. Need to remove that, it's variable
# sed: (1) "maj, min" -> "maj,min" (2) coalesce spaces
# cut: remove user, group, and date
FILTER_LS="sed -e 's/,  */,/g' -e 's/  */ /g' | cut -d' ' -f 1,2,5,9-"

# testing "test name" "options" "expected result" "file input" "stdin"

rm -rf mdev.testdir
mkdir mdev.testdir
# We need mdev executable to be in chroot jail!
# (will still fail with dynamically linked one, though...)
cp ../busybox mdev.testdir/mdev
mkdir mdev.testdir/dev
mkdir -p mdev.testdir/sys/block/sda
echo "8:0" >mdev.testdir/sys/block/sda/dev

testing "mdev add /block/sda" \
	"env - ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
	ls -ln mdev.testdir/dev | $FILTER_LS" \
"\
mdev: /etc/mdev.conf: No such file or directory
brw-rw---- 1 8,0 sda
" \
	"" ""

# clean up
rm -rf mdev.testdir

exit $FAILCOUNT