-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis-functions.sh
executable file
·128 lines (110 loc) · 2.35 KB
/
.travis-functions.sh
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
#
# .travis-functions.sh:
# - helper functions to be sourced from .travis.yml
# - designed to respect travis' environment but testing locally is possible
#
if [ ! -f "configure.ac" ]; then
echo ".travis-functions.sh must be sourced from source dir" >&2
return 1 || exit 1
fi
# some config settings
MAKE="make -j4"
DUMP_CONFIG_LOG="short"
# We could test (exotic) out-of-tree build dirs using relative or abs paths.
# After sourcing this script we are living in build dir. Tasks for source dir
# have to use $SOURCE_DIR.
SOURCE_DIR="."
BUILD_DIR="."
CONFIGURE="$SOURCE_DIR/configure"
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR" || return 1 || exit 1
function configure_travis
{
"$CONFIGURE" "$@"
err=$?
if [ "$DUMP_CONFIG_LOG" = "short" ]; then
grep -B1 -A10000 "^## Output variables" config.log | grep -v "_FALSE="
elif [ "$DUMP_CONFIG_LOG" = "full" ]; then
cat config.log
fi
return $err
}
function check_nonroot
{
configure_travis \
--disable-use-tty-group \
--with-python \
--enable-all-programs \
--enable-gtk-doc \
|| return
$MAKE || return
$MAKE check || return
$MAKE install DESTDIR=/tmp/dest || return
}
function check_root
{
configure_travis \
--with-python \
--enable-all-programs \
|| return
$MAKE || return
$MAKE check TS_COMMAND="true" || return
sudo -E $MAKE check TS_OPTS='--parallel=1' || return
sudo $MAKE install || return
}
function check_dist
{
configure_travis \
|| return
$MAKE distcheck || return
}
function travis_before_script
{
pushd "$SOURCE_DIR" || return
set -o xtrace
./autogen.sh
ret=$?
# workaround for broken pylibmount install relink
[ $ret -eq 0 ] && \
sed -i 's/\(link_all_deplibs\)=no/\1=unknown/' ./configure
set +o xtrace
popd
return $ret
}
function travis_script
{
local ret
set -o xtrace
case "$MAKE_CHECK" in
nonroot)
check_nonroot
;;
root)
check_root
;;
dist)
check_dist
;;
*)
echo "error, check environment (travis.yml)" >&2
false
;;
esac
# We exit here with case-switch return value!
ret=$?
set +o xtrace
return $ret
}
function travis_after_script
{
local diff_dir
local tmp
# find diff dir from check as well as from distcheck
diff_dir=$(find -type d -a -name "diff" | grep "tests/diff" | head -n 1)
if [ -d "$diff_dir" ]; then
tmp=$(find "$diff_dir" -type f | sort)
echo -en "dump test diffs:\n${tmp}\n"
echo "$tmp" | xargs -r cat
fi
}