git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 6/6] gitweb.perl : the optional DEBUG functionality is now unit-tested

From
JKJim Klimov <jim@jimklimov.com>
Date
Mar 11, 2016, 13:24 UTC
Message-ID
<1457702689-9084-6-git-send-email-jim@jimklimov.com>
In-Reply-To
<1457702689-9084-1-git-send-email-jim@jimklimov.com>
---
 t/t9502-gitweb-standalone-parse-output.sh | 35 +++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
diff --git a/t/t9502-gitweb-standalone-parse-output.sh b/t/t9502-gitweb-standalone-parse-output.sh
index a2ae5c4..4f1ddbf 100755
--- a/t/t9502-gitweb-standalone-parse-output.sh
+++ b/t/t9502-gitweb-standalone-parse-output.sh
@@ -253,6 +253,41 @@ test_expect_success 'snapshot certain objects: have expected content in xx/test
 test_debug 'cat gitweb.headers && cat file_list'
 
 # ----------------------------------------------------------------------
+# optional debugging in log, if allowed on server and requested by user
+
+test_expect_success 'snapshot: debugging logged as forbidden when not defined in server environment' '
+	rm -f gitweb.body gitweb.log gitweb.headers gitweb.output &&
+	gitweb_run "p=.git;a=snapshot;h=master;sf=tar;debug=yes" &&
+	grep "GITWEB_MAY_DEBUG=yes is not set" < gitweb.log >/dev/null
+'
+test_debug 'cat gitweb.headers gitweb.log'
+
+test_expect_success 'snapshot: debugging logged as forbidden when not allowed in server environment' '
+	rm -f gitweb.body gitweb.log gitweb.headers gitweb.output &&
+	GITWEB_MAY_DEBUG=xxx && export GITWEB_MAY_DEBUG &&
+	gitweb_run "p=.git;a=snapshot;h=master;sf=tar;debug=yes" &&
+	grep "GITWEB_MAY_DEBUG=yes is not set" < gitweb.log >/dev/null
+'
+test_debug 'cat gitweb.headers gitweb.log'
+
+test_expect_success 'snapshot: debugging present when allowed in server environment' '
+	rm -f gitweb.body gitweb.log gitweb.headers gitweb.output &&
+	GITWEB_MAY_DEBUG=yes && export GITWEB_MAY_DEBUG &&
+	gitweb_run "p=.git;a=snapshot;h=master;sf=tar;debug=yes" &&
+	! grep "GITWEB_MAY_DEBUG=yes is not set" < gitweb.log >/dev/null &&
+	grep "git-archive" < gitweb.log >/dev/null
+'
+test_debug 'cat gitweb.headers gitweb.log'
+
+test_expect_success 'snapshot: debugging absent when not allowed in server environment' '
+	rm -f gitweb.body gitweb.log gitweb.headers gitweb.output &&
+	GITWEB_MAY_DEBUG=xxx && export GITWEB_MAY_DEBUG &&
+	gitweb_run "p=.git;a=snapshot;h=master;sf=tar;debug=yes" &&
+	! grep "git-archive" < gitweb.log >/dev/null
+'
+test_debug 'cat gitweb.headers gitweb.log'
+
+# ----------------------------------------------------------------------
 # forks of projects
 
 test_expect_success 'forks: setup' '
-- 
2.1.4
Previous: Jim Klimov
Message 6 of 6 in “gitweb.perl : added ability to "git archive" just certain paths (files or subdirs, not whole repo) via gitweb interface”
  1. 1/6 gitweb.perl : added ability to "git archive" just certain paths (files or subdirs, not whole repo) via gitweb interfaceJim Klimov, Mar 11, 2016
  2. 2/6 gitweb.perl : added ability to debug requests coming through gitweb interface by adding an option to request URL (also requires server-side envvar "GITWEB_MAY_DEBUG=yes")Jim Klimov, Mar 11, 2016
  3. 3/6 gitweb.perl : added ability to DEBUG progression through "git archive"Jim Klimov, Mar 11, 2016
  4. 4/6 gitweb.perl support for snapshots with lists of specified files is now testedJim Klimov, Mar 11, 2016
  5. 5/6 gitweb.perl changed (and tested) to return HTTP-404 when missing objects are requested via snapshotJim Klimov, Mar 11, 2016
  6. 6/6 gitweb.perl : the optional DEBUG functionality is now unit-testedJim Klimov, Mar 11, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.