66731fe8fe
In order to provide information to user what optionally built features are available. * strace.c (print_version): New variable "features". Print features string after non-liability disclaimer (or "(none)" in case it is empty). (print_version) [USE_LIBUNWIND]: Concatenate "stack-unwind" into features string. * tests/strace-V.tests (getoption): New function. Update check in accordance with updated output.
56 lines
1.4 KiB
Bash
Executable File
56 lines
1.4 KiB
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"
|
|
|
|
getstr()
|
|
{
|
|
sed -r -n 's/#define[[:space:]]*'"$1"'[[:space:]]*"([^"]*)".*/\1/p' \
|
|
../../config.h
|
|
}
|
|
|
|
# getoption OPTION YES_STRING [NO_STRING]
|
|
#
|
|
# Returns YES_STRING in case OPTION is enabled (present in config.h and has
|
|
# a non-zero numeric value). Otherwise, NO_STRING (or empty string, if not
|
|
# specified) is returned.
|
|
getoption()
|
|
{
|
|
local opt
|
|
opt=$(sed -r -n 's/#define[[:space:]]*'"$1"'[[:space:]]*([0-9]+)$/\1/p' \
|
|
../../config.h)
|
|
if [ -n "$opt" -a "$opt" -ne 0 ]; then
|
|
printf "%s" "$2"
|
|
else
|
|
printf "%s" "${3-}"
|
|
fi
|
|
}
|
|
|
|
config_year=$(getstr 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
|
|
}
|
|
|
|
option_unwind=$(getoption USE_LIBUNWIND " stack-unwind")
|
|
|
|
features="${option_unwind}"
|
|
[ -n "$features" ] || features=" (none)"
|
|
|
|
cat > "$EXP" << __EOF__
|
|
$(getstr PACKAGE_NAME) -- version $(getstr PACKAGE_VERSION)
|
|
Copyright (c) 1991-${config_year} The strace developers <$(getstr 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.
|
|
|
|
Optional features enabled:${features}
|
|
__EOF__
|
|
|
|
match_diff "$LOG" "$EXP"
|