diff --git a/tests/fatrace-comm b/tests/fatrace-comm new file mode 100755 index 0000000..3180780 --- /dev/null +++ b/tests/fatrace-comm @@ -0,0 +1,42 @@ +#!/bin/sh +set -euC + +mkdir -m 777 tmp +trap "rm -rf tmp" EXIT INT QUIT PIPE + +LOG="$AUTOPKGTEST_TMP/fatrace.log" +echo "starting fatrace..." +fatrace --current-mount --command touch -s 2 -o $LOG & +sleep 1 + +echo "create files with different programs" +touch tmp/includeme +dd if=/dev/zero of=tmp/notme bs=1 count=1 + +echo "waiting for fatrace..." +wait + +echo "checking log..." +RC=0 +check_log() { + if ! grep -q "$1" $LOG; then + echo "$1 not found in log" >&2 + ((RC=RC+1)) + fi +} + +check_log "^touch([0-9]*).*includeme$" + +if grep -Eq "notme|^dd" $LOG; then + echo "notme found in log" >&2 + ((RC=RC+1)) +fi + +if [ $RC -ne 0 ]; then + echo "$RC checks failed -- log:" >&2 + echo "===================" >&2 + cat $LOG >&2 + echo "===================" >&2 +fi + +exit $RC diff --git a/tests/run b/tests/run index f4af9d4..fccf761 100755 --- a/tests/run +++ b/tests/run @@ -4,7 +4,7 @@ set -eu MYDIR=$(dirname $(readlink -f "$0")) export PATH=$(pwd):$PATH -for t in fatrace fatrace-currentmount fatrace-btrfs fatrace-user; do +for t in fatrace fatrace-currentmount fatrace-btrfs fatrace-user fatrace-comm; do export AUTOPKGTEST_TMP=$(mktemp -d) echo "===== $t ====" "$MYDIR"/$t