File: upstream-tests

package info (click to toggle)
libeatmydata 131-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,740 kB
  • sloc: sh: 4,768; ansic: 924; makefile: 93
file content (81 lines) | stat: -rwxr-xr-x 2,070 bytes parent folder | download | duplicates (2)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/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

cleanup() {
    echo "Deleting $AUTOPKGTEST_TMP"
    rm -r "$AUTOPKGTEST_TMP"
}

#set -x

if [ -z "$AUTOPKGTEST_TMP" ] ; then
    AUTOPKGTEST_TMP=$(mktemp -d)
    trap cleanup EXIT
fi


echo
echo "############### Autoconfiguring..."
export DH_VERBOSE=1
debian/rules clean 2>&1
dh_update_autotools_config 2>&1
dh_autoreconf 2>&1
dh_auto_configure 2>&1

echo
echo "############### Coping the tests sources..."
mkdir -pv "$AUTOPKGTEST_TMP"/libeatmydata
cp -v config.h libeatmydata/test/* "$AUTOPKGTEST_TMP"/
cp -v libeatmydata/portability.h "$AUTOPKGTEST_TMP"/libeatmydata/

echo
echo "############### Cleaning up the sources..."
debian/rules clean 2>&1

pushd "$AUTOPKGTEST_TMP"

echo
echo "############### Compiling..."
while IFS= read -r -d '' file; do
    printf "\t%s -> %s\n" "$file" "${file%.c}"
    gcc -g -pthread -I. -o "${file%.c}" "$file" 2>&1
done <   <(find . -type f ! -executable -name '*.c' -print0)

echo
echo "############### Running..."
result=0
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)

popd

echo
echo
echo
echo "############### Test completed: exit: $result"
echo

exit "$result"