From 876faa3ab11c2bc74e77184102e0e88412480b54 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Sat, 12 Aug 2017 12:25:51 -0400 Subject: [PATCH 1/4] bash cleanups --- test/status/on-branch-test | 8 ++++---- test/status/on-branch-tracking-info-test | 8 ++++---- test/tools/libtest.sh | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/status/on-branch-test b/test/status/on-branch-test index b7f805035..1b4a68f7f 100755 --- a/test/status/on-branch-test +++ b/test/status/on-branch-test @@ -169,15 +169,15 @@ add_exec_prefix() } tig_script "all" " - $(cat < test-cases | while read -r name; do + $(while read -r name; do add_exec_prefix "$name-before" printf ':save-display all-%s.screen\n' "$name" add_exec_prefix "$name-after" - done) + done < test-cases) " test_tig status -cat < test-cases | while read -r name; do +while read -r name; do assert_equals "all-$name.screen" < "$name.expected" -done +done < test-cases diff --git a/test/status/on-branch-tracking-info-test b/test/status/on-branch-tracking-info-test index 1c21b1102..5dd53576f 100755 --- a/test/status/on-branch-tracking-info-test +++ b/test/status/on-branch-tracking-info-test @@ -91,15 +91,15 @@ add_exec_prefix() } tig_script "all" " - $(cat < test-cases | while read -r name; do + $(while read -r name; do add_exec_prefix "$name-before" printf ':save-display all-%s.screen\n' "$name" add_exec_prefix "$name-after" - done) + done < test-cases) " test_tig status -cat < test-cases | while read -r name; do +while read -r name; do assert_equals "all-$name.screen" < "$name.expected" -done +done < test-cases diff --git a/test/tools/libtest.sh b/test/tools/libtest.sh index 4f251b4b5..db0a2f5c5 100644 --- a/test/tools/libtest.sh +++ b/test/tools/libtest.sh @@ -315,7 +315,7 @@ assert_vars() die "Test must supply the expected count of assertions to assert_vars()" fi - grep -c . "$vars_file" | assert_equals "$vars_count_file" strict "$*" + grep -c . < "$vars_file" | assert_equals "$vars_count_file" strict "$*" if [ -e "$expected_vars_file" ]; then assert_equals "$vars_file" strict "$*" < "$expected_vars_file" From 9e0c5578585f79d4a7d3425d329d79c62a21a972 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Sat, 12 Aug 2017 12:28:18 -0400 Subject: [PATCH 2/4] add test timeout bonus under valgrind --- test/tools/libtest.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/tools/libtest.sh b/test/tools/libtest.sh index db0a2f5c5..834d448f7 100644 --- a/test/tools/libtest.sh +++ b/test/tools/libtest.sh @@ -205,6 +205,7 @@ trace= todos= valgrind= timeout=10 +vlg_timeout_bonus=60 ORIG_IFS="$IFS" IFS=" " @@ -540,6 +541,9 @@ test_tig() runner=exec if [ "$expected_status_code" = 0 ] && [ -n "$valgrind" ]; then runner=valgrind_exec + if [ "$timeout" -gt 0 ]; then + timeout="$((timeout + vlg_timeout_bonus))" + fi fi if [ -s "$HOME/${prefix}stdin" ]; then exec 4<"$HOME/${prefix}stdin" From f8e4c758cf6dfee84cf356b09c554c94a9d35f7d Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Sat, 12 Aug 2017 12:28:52 -0400 Subject: [PATCH 3/4] add test_timeout() variable setter --- test/tools/libtest.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/tools/libtest.sh b/test/tools/libtest.sh index 834d448f7..6bcff3636 100644 --- a/test/tools/libtest.sh +++ b/test/tools/libtest.sh @@ -389,6 +389,15 @@ test_todo() test_todo_message "$*" >> .test-skipped } +test_timeout() +{ + if [ -z "${1:-}" ]; then + die 'test_timeout requires an argument' + fi + + timeout="${1:-}" +} + require_git_version() { git_version="$(git version | sed 's/git version \([0-9\.]*\).*/\1/')" From 585cf8b329437e641cd646d4beba7a55e4073bcd Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Sat, 12 Aug 2017 12:30:29 -0400 Subject: [PATCH 4/4] raise on-branch* long test timeouts --- test/status/on-branch-test | 2 ++ test/status/on-branch-tracking-info-test | 2 ++ 2 files changed, 4 insertions(+) diff --git a/test/status/on-branch-test b/test/status/on-branch-test index 1b4a68f7f..ecc4f9e25 100755 --- a/test/status/on-branch-test +++ b/test/status/on-branch-test @@ -176,6 +176,8 @@ tig_script "all" " done < test-cases) " +test_timeout 60 + test_tig status while read -r name; do diff --git a/test/status/on-branch-tracking-info-test b/test/status/on-branch-tracking-info-test index 5dd53576f..3333131ab 100755 --- a/test/status/on-branch-tracking-info-test +++ b/test/status/on-branch-tracking-info-test @@ -98,6 +98,8 @@ tig_script "all" " done < test-cases) " +test_timeout 60 + test_tig status while read -r name; do