[PATCH v2 5/5] tests: check diagnostics about -kk/--stack-traces=source option

Masatake YAMATO yamato at redhat.com
Sun Nov 19 05:30:25 UTC 2023


* tests/options-syntax.test: Check strace -kk/--stack-traces=source
diagnostics.

Signed-off-by: Masatake YAMATO <yamato at redhat.com>
---
 tests/options-syntax.test | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/options-syntax.test b/tests/options-syntax.test
index f437cafba..e9312ac45 100755
--- a/tests/options-syntax.test
+++ b/tests/options-syntax.test
@@ -12,6 +12,8 @@
 
 compiled_with_secontext=$(get_config_option ENABLE_SECONTEXT "y")
 compiled_with_stacktrace="$(get_config_option ENABLE_STACKTRACE 1)"
+compiled_with_libunwind_based_stacktrace="$(get_config_option USE_LIBUNWIND 1)"
+compiled_with_libdw_based_stacktrace="$(get_config_option USE_LIBDW 1)"
 
 check_e "Invalid process id: '0'" -p 0
 check_e "Invalid process id: '0'" --attach=0
@@ -420,6 +422,13 @@ if [ -z "$compiled_with_stacktrace" ]; then
 	check_e "Stack traces (-k/--stack-traces option) are not supported by this build of strace" --stack-traces
 	check_e "Stack traces (-k/--stack-traces option) are not supported by this build of strace" --stack-traces=symbol
 	check_e "Stack traces (-k/--stack-traces option) are not supported by this build of strace" --stack-traces=source
+else
+	if [ -n "$compiled_with_libunwind_based_stacktrace" ]; then
+		check_e "Stack traces with source line information (-kk/--stack-traces=source option) are not supported by this build of strace" -kk
+		check_e "Stack traces with source line information (-kk/--stack-traces=source option) are not supported by this build of strace" --stack-traces=source
+	elif [ -n "$compiled_with_libdw_based_stacktrace" ]; then
+		check_e "Too many -k options" -kkk
+	fi
 fi
 
 args='-p 2147483647'
-- 
2.41.0



More information about the Strace-devel mailing list