]> sourceware.org Git - lvm2.git/commitdiff
tests: correcting globbing usage
authorZdenek Kabelac <zkabelac@redhat.com>
Fri, 30 Jun 2017 12:28:44 +0000 (14:28 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Fri, 30 Jun 2017 12:40:50 +0000 (14:40 +0200)
Ensure globbing uses current dir.
Break loop when no match is found.
Let STACKTRACE finish its output when gdb fails.

test/lib/utils.sh

index 4f3e460594d8064e70136be15c6c8d7b0f9bac62..2b5b782e6c86e299b5153c403b383cd05db0b780 100644 (file)
@@ -120,7 +120,7 @@ stacktrace() {
 
 STACKTRACE() {
        trap - ERR
-       local i=0
+       local i
 
        stacktrace
 
@@ -134,10 +134,12 @@ STACKTRACE() {
                echo bt full > gdb_commands.txt
                echo l >> gdb_commands.txt
                echo quit >> gdb_commands.txt
-               for core in $(echo core* 2>/dev/null); do
-                       bin=$(gdb -batch -c "$core" 2>&1 | grep "generated by" | \
-                       sed -e "s,.*generated by \`\([^ ']*\).*,\1,")
-                       gdb -batch -c "$core" -x gdb_commands.txt "$(which "$bin")"
+               # TODO: use sysctl to get 'core' position in system
+               for i in core*; do
+                       test -f "$i" || break   # empty globbing
+                       bin=$(gdb -batch -c "$i" 2>&1 | grep "generated by" | \
+                       sed -e "s,.*generated by \`\([^ ']*\).*,\1,") || continue
+                       gdb -batch -c "$i" -x gdb_commands.txt "$(which "$bin")" || continue
                done
        fi
 
This page took 0.030288 seconds and 5 git commands to generate.