ACL's ptest has a handful of failure modes which can be triggered by a restrictive or small system. First, the ptest requires that daemon be in the bin group, which run-ptest attempts to do using gpasswd, but gpasswd is part of shadow, and oe-core removes shadow when it doesn't think shadow will be needed. Even if, say, a package has RDEPENDS on it. Whoops. So we manually sed the group file. This will probably work. Second, the filesystem used for the test has to support ACLs, so we create a dummy ext3 filesystem and use that. Third, the root/permissions test relies on the assumption that "mkdir d" produces a directory which non-root users can access, but in a secure product which defaults to umask 077, this doesn't work. (That fix has been separately reported to upstream acl through their bug report form.) (This may prevent the test from running without mkfs.ext3, but it allows the test to run on targets where root doesn't have ACL support. Tradeoffs, tradeoffs everywhere.) (From OE-Core rev: 0f1054e7db74bb4a196e00773915d7997b55bdf2) Signed-off-by: Peter Seebach <peter.seebach@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
1.2 KiB
#!/bin/sh
#This script is used to run acl test suites
#umask 077
EXT3_IMAGE=ext3.img EXT3_MOUNT_POINT=/mnt/ext3
trap 'rm -f ${EXT3_IMAGE}' EXIT
dd if=/dev/zero of=${EXT3_IMAGE} bs=1M count=1 if [ "$?" -eq 0 ]; then echo "PASS: dump ext3.img" else echo "FAIL: dump ext3.img" exit 1 fi
mkfs.ext3 -F ${EXT3_IMAGE} if [ "$?" -eq 0 ]; then echo "PASS: mkfs.ext3 -F ext3.img" else echo "FAIL: mkfs.ext3 -F ext3.img" exit 1 fi
if [ -d $EXT3_MOUNT_POINT ]; then echo "mount point exist" else mkdir -p $EXT3_MOUNT_POINT fi
mount -o loop,rw,acl ${EXT3_IMAGE} $EXT3_MOUNT_POINT if [ "$?" -eq 0 ]; then echo "PASS: mount ext3.img" else echo "FAIL: mount ext3.img" exit 1 fi
cp -rf ./test/ $EXT3_MOUNT_POINT
cd $EXT3_MOUNT_POINT/test/
if sed -e 's!^bin❌2:$!bin❌2:daemon!' < /etc/group > gtmp
then if cp /etc/group group.orig;
then cp gtmp /etc/group
make -k tests root-tests | sed
-e 's|^[.] (.) -- ok$|PASS: \1|'
-e 's|^[.] (.) -- failed|FAIL: \1|'
cp group.orig /etc/group
else echo "FAIL: couldn't save original group file."
exit 1
fi
else echo "FAIL: couldn't create modified group file."
exit 1
fi
cd - umount $EXT3_MOUNT_POINT rm -rf $EXT3_MOUNT_POINT rm $EXT3_IMAGE