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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
#!/bin/bash
#
# Copyright (c) 2015 Mattia Rizzolo <mattia@mapreri.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# .
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# .
# On Debian systems, the full text of the GNU General Public License
# version 3 can be found in file '/usr/share/common-licenses/GPL-3'.
set -e
temp=false
if [ -z "$AUTOPKGTEST_TMP" ] ; then
AUTOPKGTEST_TMP=$(mktemp -d)
temp=true
fi
echo "Coping the tests sources..."
cp -v libeatmydata/test/* "$AUTOPKGTEST_TMP"
cd "$AUTOPKGTEST_TMP"
echo "Compiling..."
while IFS= read -r -d '' file; do
printf "\t%s -> %s\n" "$file" "${file%.c}"
gcc -g -pthread -o "${file%.c}" "$file"
done < <(find . -type f ! -executable -name '*.c' -print0)
result=0
echo "Running..."
while IFS= read -r -d '' file; do
printf "\t%s\n" "$file"
eatmydata strace -o "${file}.result" "$file"
if grep -q '^[a-z]*sync\|O_SYNC' "${file}.result" ; then
>&2 echo "test $file failed"
result=1
fi
done < <(find . -type f -executable ! -name '*.c' -print0)
if [ "$temp" = true ] ; then
echo "Deleting $AUTOPKGTEST_TMP"
rm -r "$AUTOPKGTEST_TMP"
fi
echo
echo "Test completed: exit: $result"
echo
exit "$result"
|