[2/2] addr2line: test to check -n option

Message ID 20221219135303.116222-3-mpapini@redhat.com
State Accepted
Headers
Series addr2line: new option -n to add a newline at the end |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Maurizio Papini Dec. 19, 2022, 1:53 p.m. UTC
  ---
 binutils/testsuite/binutils-all/addr2line.exp | 10 ++++++++++
 1 file changed, 10 insertions(+)
  

Patch

diff --git a/binutils/testsuite/binutils-all/addr2line.exp b/binutils/testsuite/binutils-all/addr2line.exp
index 957ae55df33..59c0924412c 100644
--- a/binutils/testsuite/binutils-all/addr2line.exp
+++ b/binutils/testsuite/binutils-all/addr2line.exp
@@ -61,6 +61,16 @@  if ![regexp -line "^(\[0-9a-fA-F\]+)? +\[Tt\] ${dot}fn" $output contents] then {
 	pass "$testname -f option"
     }
 
+#testcase for -n option: check the extra newline
+#Using the same fn function address used in -f option.
+    set got [binutils_run $ADDR2LINE "-n -f -e tmpdir/testprog$exe [lindex $list 0]"]
+    set want "fn\n$srcdir/$subdir/testprog.c:\[0-9\]+\n\n"
+    if ![regexp $want $got] then {
+	fail "$testname -fn option $got\n"
+    } else {
+	pass "$testname -fn option"
+    }
+
 #testcase for -s option.
 #Using the same fn function address used in -f option.
     set got [binutils_run $ADDR2LINE "-s -e tmpdir/testprog$exe [lindex $list 0]"]