| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
LOGFILE="$AUTOPKGTEST_TMP/test.log" |
| 4 |
|
| 5 |
# added 'breaks-testbed' restriction because it modifies global config files |
| 6 |
sed -i 's/^\(restricted-network .*\)/#\1/' /etc/firejail/firejail.config |
| 7 |
sed -i 's/^\(cgroup .*\)/#\1/' /etc/firejail/firejail.config |
| 8 |
|
| 9 |
# copy tests to temporary directory, as current one might be read-only |
| 10 |
cp -a test "$AUTOPKGTEST_TMP" |
| 11 |
cd "$AUTOPKGTEST_TMP/test" |
| 12 |
|
| 13 |
# user setup |
| 14 |
[ -z "$AUTOPKGTEST_NORMAL_USER" ] && AUTOPKGTEST_NORMAL_USER="nobody" |
| 15 |
GROUP=$(id -g $AUTOPKGTEST_NORMAL_USER) |
| 16 |
chown -R $AUTOPKGTEST_NORMAL_USER:$GROUP "$AUTOPKGTEST_TMP" |
| 17 |
echo $AUTOPKGTEST_NORMAL_USER > /etc/firejail/firejail.users |
| 18 |
|
| 19 |
# workaround for https://github.com/netblue30/firejail/issues/3113 |
| 20 |
rm -f /etc/firejail/ffmpegthumbnailer.profile |
| 21 |
|
| 22 |
# run tests |
| 23 |
for dir in fs sysutils profiles utils; |
| 24 |
do |
| 25 |
pushd $dir |
| 26 |
runuser -u $AUTOPKGTEST_NORMAL_USER -- bash -x ./$dir.sh | tee -a "$LOGFILE" |
| 27 |
popd |
| 28 |
done |
| 29 |
|
| 30 |
echo "======================================" |
| 31 |
grep "TESTING" "$LOGFILE" |
| 32 |
echo "======================================" |
| 33 |
|
| 34 |
[ $(grep -a -c "TESTING ERROR" "$LOGFILE") -gt 0 ] && exit 1 |
| 35 |
|
| 36 |
exit 0 |