strace/tests/strace-V.test
2017-05-26 19:43:11 +00:00

32 lines
801 B
Bash
Executable File

#!/bin/sh
# Check -V option.
. "${srcdir=.}/init.sh"
run_prog_skip_if_failed date +%Y > /dev/null
year="$(date +%Y)"
run_strace -V > "$LOG"
getval()
{
sed -r -n 's/#define[[:space:]]*'"$1"'[[:space:]]*"([^"]*)".*/\1/p' \
../../config.h
}
config_year=$(getval COPYRIGHT_YEAR)
[ "$year" -ge "$config_year" ] && [ "$config_year" -ge 2017 ] || {
echo >&2 "The year derived from config.h (${config_year}) does not pass sanity checks."
exit 1
}
cat > "$EXP" << __EOF__
$(getval PACKAGE_NAME) -- version $(getval PACKAGE_VERSION)
Copyright (c) 1991-${config_year} The strace developers <$(getval PACKAGE_URL)>.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
__EOF__
match_diff "$LOG" "$EXP"