summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-05-01 20:39:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-05-01 20:39:59 (GMT)
commitdd094c2b75401f6e1e53e7a5bbfca3c66c44f556 (patch)
treec10b122157431d5be105f48436f909bdeb345381 /t
parent6d6b412da32229bf6a5f366a72b5ad29cc70ce59 (diff)
parent8f0e9843bdf82b04591416367bee3817991e0722 (diff)
downloadgit-dd094c2b75401f6e1e53e7a5bbfca3c66c44f556.zip
git-dd094c2b75401f6e1e53e7a5bbfca3c66c44f556.tar.gz
git-dd094c2b75401f6e1e53e7a5bbfca3c66c44f556.tar.bz2
Merge branch 'es/bugreport'
The "bugreport" tool. * es/bugreport: bugreport: drop extraneous includes bugreport: add compiler info bugreport: add uname info bugreport: gather git version and build info bugreport: add tool to generate debugging info help: move list_config_help to builtin/help
Diffstat (limited to 't')
-rwxr-xr-xt/t0091-bugreport.sh61
1 files changed, 61 insertions, 0 deletions
diff --git a/t/t0091-bugreport.sh b/t/t0091-bugreport.sh
new file mode 100755
index 0000000..2e73658
--- /dev/null
+++ b/t/t0091-bugreport.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+test_description='git bugreport'
+
+. ./test-lib.sh
+
+# Headers "[System Info]" will be followed by a non-empty line if we put some
+# information there; we can make sure all our headers were followed by some
+# information to check if the command was successful.
+HEADER_PATTERN="^\[.*\]$"
+
+check_all_headers_populated () {
+ while read -r line
+ do
+ if test "$(grep "$HEADER_PATTERN" "$line")"
+ then
+ echo "$line"
+ read -r nextline
+ if test -z "$nextline"; then
+ return 1;
+ fi
+ fi
+ done
+}
+
+test_expect_success 'creates a report with content in the right places' '
+ test_when_finished rm git-bugreport-check-headers.txt &&
+ git bugreport -s check-headers &&
+ check_all_headers_populated <git-bugreport-check-headers.txt
+'
+
+test_expect_success 'dies if file with same name as report already exists' '
+ test_when_finished rm git-bugreport-duplicate.txt &&
+ >>git-bugreport-duplicate.txt &&
+ test_must_fail git bugreport --suffix duplicate
+'
+
+test_expect_success '--output-directory puts the report in the provided dir' '
+ test_when_finished rm -fr foo/ &&
+ git bugreport -o foo/ &&
+ test_path_is_file foo/git-bugreport-*
+'
+
+test_expect_success 'incorrect arguments abort with usage' '
+ test_must_fail git bugreport --false 2>output &&
+ test_i18ngrep usage output &&
+ test_path_is_missing git-bugreport-*
+'
+
+test_expect_success 'runs outside of a git dir' '
+ test_when_finished rm non-repo/git-bugreport-* &&
+ nongit git bugreport
+'
+
+test_expect_success 'can create leading directories outside of a git dir' '
+ test_when_finished rm -fr foo/bar/baz &&
+ nongit git bugreport -o foo/bar/baz
+'
+
+
+test_done