File: upstream-tests

package info (click to toggle)
libeatmydata 105-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,064 kB
  • sloc: sh: 12,301; ansic: 745; makefile: 113
file content (51 lines) | stat: -rwxr-xr-x 1,438 bytes parent folder | download
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
#!/bin/sh
#
# 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
    ADTTMP=$(mktemp -d)
    temp=true
fi

echo "coping the tests source file and compiling them..."
cp libeatmydata/test/* "$AUTOPKGTEST_TMP"

cd "$AUTOPKGTEST_TMP"

for file in $(find . -type f ! -executable -name '*.c') ; do
    bin=$(echo "$file" | sed s/\.c$//)
    gcc -g -lpthread -o "$bin" "$file"
done

result=0
for file in $(find . -type f -executable ! -name '*.c') ; do
    echo "running the test ${file}..."
    eatmydata strace -o "${file}.result" "$file"
    if $(grep '^[a-z]*sync\|O_SYNC' "${file}.result") ; then
        >&2 echo "test $file failed"
        result=1
    fi
done

if [ "$temp" = true ] ; then
    rm -r "$AUTOPKGTEST_TMP"
fi

exit "$result"