]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
check: align test run metrics nicely
authorOmar Sandoval <osandov@fb.com>
Thu, 11 May 2017 19:56:47 +0000 (12:56 -0700)
committerOmar Sandoval <osandov@fb.com>
Thu, 11 May 2017 19:56:47 +0000 (12:56 -0700)
Signed-off-by: Omar Sandoval <osandov@fb.com>
check
tests/meta/012

diff --git a/check b/check
index 59bfe1ee693df6c45c505a87ef8099a039e26f4e..d2a208b009e687e999f49e45b7901c6cf785db3e 100755 (executable)
--- 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() {
index a8a27eba7b38ff5b0fbb07af2bb4d991e9a2e3e0..fcf8fbdde2aa8990f257020fb18e35fb437a4cab 100755 (executable)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-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"
 }