From: Omar Sandoval Date: Thu, 11 May 2017 19:56:47 +0000 (-0700) Subject: check: align test run metrics nicely X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=db10b35acb329d3c20f51acdf32b449392b5091f;p=users%2Fsagi%2Fblktests.git check: align test run metrics nicely Signed-off-by: Omar Sandoval --- diff --git a/check b/check index 59bfe1e..d2a208b 100755 --- a/check +++ b/check @@ -205,14 +205,16 @@ _output_last_test_run() { _output_status "$TEST_NAME" "" fi + ( local key value while IFS= read -r key; do if [[ $key =~ ^date|status|reason|exit_status$ ]]; then continue fi value="${LAST_TEST_RUN["$key"]}" - echo " ${key} ${value} ..." + printf ' %s\t%s\t...\n' "${key}" "${value}" done < <(printf '%s\n' "${!LAST_TEST_RUN[@]}" | sort) + ) | column -t -s $'\t' } _output_test_run() { @@ -228,6 +230,7 @@ _output_test_run() { _output_status "$TEST_NAME" "${TEST_RUN[status]}ed" fi + ( local key last_value value while IFS= read -r key; do if [[ $key =~ ^date|status|reason|exit_status$ ]]; then @@ -235,7 +238,7 @@ _output_test_run() { fi last_value="${LAST_TEST_RUN["$key"]}" value="${TEST_RUN["$key"]}" - echo " ${key} ${last_value} ... ${value}" + printf ' %s\t%s\t...\t%s\n' "$key" "$last_value" "$value" done < <(printf '%s\n' "${!LAST_TEST_RUN[@]}" | sort) while IFS= read -r key; do @@ -245,8 +248,9 @@ _output_test_run() { continue fi value="${TEST_RUN["$key"]}" - echo " ${key} ... ${value}" + printf ' %s\t\t...\t%s\n' "$key" "$value" done < <(printf '%s\n' "${!TEST_RUN[@]}" | sort) + ) | column -t -s $'\t' } _cleanup() { diff --git a/tests/meta/012 b/tests/meta/012 index a8a27eb..fcf8fbd 100755 --- a/tests/meta/012 +++ b/tests/meta/012 @@ -17,10 +17,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -DESCRIPTION="record pid" +DESCRIPTION="record pid and random junk" test() { echo "Running ${TEST_NAME}" + sleep 1 TEST_RUN[pid]=$$ + TEST_RUN[random]="$(od -N $((4 * (RANDOM % 4))) -An -vtx1 /dev/urandom | tr -d ' \n')" + TEST_RUN[$$]=hello echo "Test complete" }