diff options
| author | Tomi Ollila <tomi.ollila@iki.fi> | 2015-03-29 18:30:36 +0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2015-04-03 09:27:57 +0900 |
| commit | 3d1483df12050dec8a2df95249576162a0e79302 (patch) | |
| tree | 893c8d6dbf3ce39f077c22fb9571ea7c2a992186 | |
| parent | 0fa9cf75e51957f775fd74a7ca266e7a8edd7941 (diff) | |
test/thread-order: more robust loop exit in case of broken input
When creating $THREADS data it may end of not having 'None' at all
or the numbers in line output yields a loop.
To avoid loop the value in current array index is set to 'None'
so that if the same item is reached again the loop will end.
Also empty string as next array index will end the loop.
| -rwxr-xr-x | test/T260-thread-order.sh | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/T260-thread-order.sh b/test/T260-thread-order.sh index 99f58336..5239bd44 100755 --- a/test/T260-thread-order.sh +++ b/test/T260-thread-order.sh @@ -45,9 +45,12 @@ for ((n = 0; n < 4; n++)); do while read -a parents; do references="" parent=${parents[$n]} - while [[ $parent != None ]]; do + while [[ ${parent:-None} != None ]]; do references="<m$parent@t$thread> $references" + pp=$parent parent=${parents[$parent]} + # Avoid looping over broken input (if ever) + parents[$pp]="None" done generate_message \ |
