2008-03-27 20:49:26 +00:00
|
|
|
#!/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
|
2008-03-29 13:10:57 +00:00
|
|
|
# cut: remove date
|
|
|
|
FILTER_LS="sed -e 's/, */,/g' -e 's/ */ /g' | cut -d' ' -f 1-5,9-"
|
2008-03-27 20:49:26 +00:00
|
|
|
|
|
|
|
# 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
|
2008-03-29 13:10:57 +00:00
|
|
|
mkdir mdev.testdir/etc
|
2008-03-27 20:49:26 +00:00
|
|
|
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
|
2008-03-29 13:10:57 +00:00
|
|
|
brw-rw---- 1 0 0 8,0 sda
|
|
|
|
" \
|
|
|
|
"" ""
|
|
|
|
|
|
|
|
# continuing to use directory structure from prev test
|
|
|
|
rm mdev.testdir/dev/sda
|
|
|
|
echo ".* 1:1 666" >mdev.testdir/etc/mdev.conf
|
|
|
|
echo "sda 2:2 444" >>mdev.testdir/etc/mdev.conf
|
|
|
|
testing "mdev stops on first rule" \
|
|
|
|
"env - ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
|
|
|
|
ls -ln mdev.testdir/dev | $FILTER_LS" \
|
|
|
|
"\
|
|
|
|
brw-rw-rw- 1 1 1 8,0 sda
|
2008-03-27 20:49:26 +00:00
|
|
|
" \
|
|
|
|
"" ""
|
|
|
|
|
|
|
|
# clean up
|
|
|
|
rm -rf mdev.testdir
|
|
|
|
|
|
|
|
exit $FAILCOUNT
|