get_test_count() and get_test_enabled() were broken for test numbers above 9 due to awk interpreting a field specification like '$0010' as octal rather than decimal. Fix it by stripping the leading zeroes.
Unified · Split
| @@ -505,18 +505,23 @@ function test_num() · 504 unmodified lines | |||
| 505 | fi | 505 | fi |
| 506 | } | 506 | } |
| 507 | 507 | ||
| 508 | function get_test_count() | 508 | function get_test_data() |
| 509 | { | 509 | { |
| 510 | test_num $1 | 510 | test_num $1 |
| 511 | TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}') | 511 | local field_num=$(echo $1 | sed 's/^0*//') |
| 512 | echo $ALL_TESTS | awk '{print $'$field_num'}' | ||
| 513 | } | ||
| 514 | |||
| 515 | function get_test_count() | ||
| 516 | { | ||
| 517 | TEST_DATA=$(get_test_data $1) | ||
| 512 | LAST_TWO=${TEST_DATA#*:*} | 518 | LAST_TWO=${TEST_DATA#*:*} |
| 513 | echo ${LAST_TWO%:*} | 519 | echo ${LAST_TWO%:*} |
| 514 | } | 520 | } |
| 515 | 521 | ||
| 516 | function get_test_enabled() | 522 | function get_test_enabled() |
| 517 | { | 523 | { |
| 518 | test_num $1 | 524 | TEST_DATA=$(get_test_data $1) |
| 519 | TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}') | ||
| 520 | echo ${TEST_DATA#*:*:} | 525 | echo ${TEST_DATA#*:*:} |
| 521 | } | 526 | } |
| 522 | 527 | ||