mirror of
https://github.com/neovim/neovim.git
synced 2025-12-17 11:55:34 +00:00
travis: Refactor {valgrind,asan}_check functions
Put all logic into the `check_logs` function and use the `find` command to avoid having to deal with empty directory errors when globbing files.
This commit is contained in:
@@ -1,56 +1,32 @@
|
|||||||
valgrind_check() {
|
valgrind_check() {
|
||||||
|
check_logs "$1" "valgrind-*"
|
||||||
|
}
|
||||||
|
|
||||||
|
asan_check() {
|
||||||
|
check_logs "$1" "*san.*"
|
||||||
|
}
|
||||||
|
|
||||||
|
check_logs() {
|
||||||
# For some strange reason, now we need to give ubuntu some time to flush it's
|
# For some strange reason, now we need to give ubuntu some time to flush it's
|
||||||
# FS cache in order to see valgrind logs, even though the script executes
|
# FS cache in order to see error logs, even though all commands are executing
|
||||||
# synchronously
|
# synchronously
|
||||||
sleep 1
|
sleep 1
|
||||||
(
|
# Iterate through each log to remove an useless warning
|
||||||
cd $1
|
for log in $(find "$1" -type f -name "$2"); do
|
||||||
set -- valgrind-[*] valgrind-*
|
sed -i "$log" \
|
||||||
case $1$2 in
|
|
||||||
'valgrind-[*]valgrind-*')
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
shift
|
|
||||||
local err=''
|
|
||||||
for valgrind_log in "$@"; do
|
|
||||||
# Remove useless warning
|
|
||||||
sed -i "$valgrind_log" \
|
|
||||||
-e '/Warning: noted but unhandled ioctl/d' \
|
-e '/Warning: noted but unhandled ioctl/d' \
|
||||||
-e '/could cause spurious value errors to appear/d' \
|
-e '/could cause spurious value errors to appear/d' \
|
||||||
-e '/See README_MISSING_SYSCALL_OR_IOCTL for guidance/d'
|
-e '/See README_MISSING_SYSCALL_OR_IOCTL for guidance/d'
|
||||||
if [ "$(stat -c %s $valgrind_log)" != "0" ]; then
|
done
|
||||||
# if after removing the warning, the log still has errors, show its
|
# Now do it again, but only consider files with size > 0
|
||||||
# contents and set the flag so we exit with non-zero status
|
for log in $(find "$1" -type f -name "$2" -size +0); do
|
||||||
cat "$valgrind_log"
|
cat "$log"
|
||||||
err=1
|
err=1
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
if [ -n "$err" ]; then
|
if [ -n "$err" ]; then
|
||||||
echo "Runtime errors detected"
|
echo "Runtime errors detected"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
|
||||||
esac
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
asan_check() {
|
|
||||||
# See valgrind_check
|
|
||||||
sleep 1
|
|
||||||
(
|
|
||||||
cd $1
|
|
||||||
set -- [*]san.[*] *san.*
|
|
||||||
case $1$2 in
|
|
||||||
'[*]san.[*]*san.*')
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
shift
|
|
||||||
cat "$@"
|
|
||||||
echo "Runtime errors detected"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_environment() {
|
set_environment() {
|
||||||
|
|||||||
Reference in New Issue
Block a user