summaryrefslogtreecommitdiff
path: root/t/gitweb-lib.sh
AgeCommit message (Collapse)AuthorFilesLines
2019-11-18t/gitweb-lib.sh: set $REQUEST_URILibravatar Jeff King1-1/+2
In a real webserver's CGI call, gitweb.cgi would typically see $REQUEST_URI set. This variable does impact how we display our URL in the resulting page, so let's try to make our test as realistic as possible (we can just use the $PATH_INFO our caller passed in, if any). This doesn't change the outcome of any tests, but it will help us add some new tests in a future patch. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-11-18t/gitweb-lib.sh: drop confusing quotesLibravatar Jeff King1-2/+2
Some variables assignments in gitweb_run() look like this: FOO=""$1"" The extra quotes aren't doing anything. Each set opens and closes an empty string, and $1 is actually outside of any double-quotes (which is OK, because variable assignment does not do whitespace splitting on the expanded value). Let's drop them, as they're simply confusing. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-01gitweb tests: skip tests when we don't have Time::HiResLibravatar Ævar Arnfjörð Bjarmason1-0/+5
Change the gitweb tests to skip when we can't load the Time::HiRes module. Gitweb needs this module to work. It has been in perl core since v5.8, which is the oldest version we support. However CentOS (and perhaps some other distributions) carve it into its own non-core-perl package that's not installed along with /usr/bin/perl by default. Without this we'll hard fail the gitweb tests when trying to load the module. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-01gitweb tests: change confusing "skip_all" phrasingLibravatar Ævar Arnfjörð Bjarmason1-1/+1
Change the phrasing so that instead of saying that the CGI module is unusable, we say that it's not available. This came up on the git mailing list in <4b34e3a0-3da7-d821-2a7f-9a420ac1d3f6@gmail.com> from Jakub Narębski. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-11-26test: replace shebangs with descriptions in shell librariesLibravatar Jonathan Nieder1-1/+2
A #! line in these files is misleading, since these scriptlets are meant to be sourced with '.' (using whatever shell sources them) instead of run directly using the interpreter named on the #! line. Removing the #! line shouldn't hurt syntax highlighting since these files have filenames ending with '.sh'. For documentation, add a brief description of how the files are meant to be used in place of the shebang line. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-29t: use perl instead of "$PERL_PATH" where applicableLibravatar Jeff King1-1/+1
As of the last commit, we can use "perl" instead of "$PERL_PATH" when running tests, as the former is now a function which uses the latter. As the shorter "perl" is easier on the eyes, let's switch to using it everywhere. This is not quite a mechanical s/$PERL_PATH/perl/ replacement, though. There are some places where we invoke perl from a script we generate on the fly, and those scripts do not have access to our internal shell functions. The result can be double-checked by running: ln -s /bin/false bin-wrappers/perl make test which continues to pass even after this patch. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-29many small typofixesLibravatar Ondřej Bílka1-1/+1
Signed-off-by: Ondřej Bílka <neleai@seznam.cz> Reviewed-by: Marc Branchaud <marcnarc@xiplink.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-02Merge branch 'jk/maint-gitweb-test-use-sane-perl'Libravatar Junio C Hamano1-1/+1
When using a Perl script on a system where "perl" found on user's $PATH could be ancient or otherwise broken, we allow builders to specify the path to a good copy of Perl with $PERL_PATH. The gitweb test forgot to use that Perl when running its test. By Jeff King (1) and Zbigniew Jędrzejewski-Szmek (1) * jk/maint-gitweb-test-use-sane-perl: Consistently use perl from /usr/bin/ for scripts t/gitweb-lib: use $PERL_PATH to run gitweb
2012-05-01t/gitweb-lib: use $PERL_PATH to run gitwebLibravatar Jeff King1-1/+1
The current code runs "perl gitweb.cgi" to test gitweb. This will use whatever version of perl happens to be first in the PATH. We are better off using the specific perl that the user specified via PERL_PATH, which matches what gets put on the #!-line of the built gitweb.cgi. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-21gitweb: provide a way to customize html headersLibravatar Lénaïc Huard1-0/+1
This allows web sites to add some specific html headers to the pages generated by gitweb. The new variable $site_html_head_string can be set to an html snippet that will be inserted at the end of the <head> section of each page generated by gitweb. Signed-off-by: Lénaïc Huard <lenaic@lhuard.fr.eu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-06-15t/gitweb-lib.sh: skip gitweb tests when perl dependencies are not metLibravatar Junio C Hamano1-0/+5
Linus noticed that we go ahead testing gitweb and fail miserably on a box with Perl but not perl-CGI library. We already have a code to detect lack of Perl and refrain from testing gitweb in t/gitweb-lib.sh (by the way, shouldn't it be called t/lib-gitweb.sh?), so let's extend it to cover this case as well. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-21t/gitweb-lib.sh: Ensure that errors are shown for --debug --immediateLibravatar Ævar Arnfjörð Bjarmason1-1/+6
Because '--immediate' stops test suite after first error, therefore in this mode test_debug 'cat gitweb.log' was never ran, thus in effect negating effect of '--debug' option. This made finidng the cause of errors in gitweb test sute difficult. Modify the gitweb_run test subroutine to run test_debug itself in the case of errors (and also remove "test_debug 'cat gitweb.log'" from gitweb tests). This makes it possible to run *gitweb tests* with --immediate ---debug combination of options; also it makes gitweb tests to not output spurious debug data that is not considered error. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Jakub Narębski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-17Merge branch 'bg/maint-gitweb-test-lib'Libravatar Junio C Hamano1-1/+1
* bg/maint-gitweb-test-lib: t/gitweb-lib: Don't pass constant to decode_utf8 Conflicts: t/gitweb-lib.sh
2010-10-20t/gitweb-lib: Don't pass constant to decode_utf8Libravatar Brian Gernhardt1-1/+1
Encode.pm started updating the string to decode in-place when a second argument is passed in version 2.40. This causes 'decode_utf8("", Encode::FB_CROAK)' to die with a message like: Modification of a read-only value attempted at .../Encode.pm line 216. Work around this by passing an empty variable instead of a constant string. Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-30t/gitweb-lib.sh: Add support for GITWEB_TEST_INSTALLEDLibravatar Jakub Narebski1-2/+19
You can set the GITWEB_TEST_INSTALLED environment variable to the gitwebdir (the directory where gitweb is installed / deployed to) of an existing gitweb instalation, or to the pathname of installed gitweb script, to test that installation. This change is intended to make it possible to test that process of installing gitweb and the modules it depends on works correctly (after splitting gitweb). If GITWEB_TEST_INSTALLED is used, print what script are we testing to make it easy to spot that we test installed gitweb. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-12t/gitweb-lib.sh: Use tabs for indent consistentlyLibravatar Jakub Narebski1-2/+2
Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-12t/gitweb-lib.sh: Use GIT_BUILD_DIRLibravatar Jakub Narebski1-4/+4
Use "$GIT_BUILD_DIR" instead of "$TEST_DIRECTORY/.." (both defined in t/test-lib.sh) in t/gitweb-lib.sh. It better describes the intent. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-08tests: Use skip_all=* to skip testsLibravatar Ævar Arnfjörð Bjarmason1-2/+2
Change tests to skip with skip_all=* + test_done instead of using say + test_done. This is a follow-up to "tests: Skip tests in a way that makes sense under TAP" (fadb5156e4). I missed these cases when prepearing that patch, hopefully this is all of them. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-31gitweb: Move static files into seperate subdirectoryLibravatar Pavan Kumar Sunkara1-3/+3
Create a new subdirectory called 'static' in gitweb/, and move all static files required by gitweb.cgi when running, which means styles, images and Javascript code. This should make gitweb more readable and easier to maintain. Update t/gitweb-lib.sh to reflect this change.The install-gitweb now also include moving of static files into 'static' subdirectory in target directory: update Makefile, gitweb's INSTALL, README and Makefile accordingly. Signed-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com> Mentored-by: Christian Couder <chriscool@tuxfamily.org> Mentored-by: Petr Baudis <pasky@ucw.cz> Acked-by: Jakub Narebski <jnareb@gmail.com> Acked-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-30gitweb: Load checkingLibravatar John 'Warthog9' Hawley1-0/+1
This changes slightly the behavior of gitweb, so that it verifies that the box isn't inundated with before attempting to serve gitweb. If the box is overloaded, it basically returns a 503 Server Unavailable until the load falls below the defined threshold. This helps dramatically if you have a box that's I/O bound, reaches a certain load and you don't want gitweb, the I/O hog that it is, increasing the pain the server is already undergoing. This behavior is controlled by $maxload configuration variable. Default is a load of 300, which for most cases should never be hit. Unset it (set it to undefined value, i.e. undef) to turn off checking. Currently it requires that '/proc/loadavg' file exists, otherwise the load check is bypassed (load is taken to be 0). So platforms that do not implement '/proc/loadavg' currently cannot use this feature (provisions are included for additional checks to be added by others). There is simple test in t/t9501-gitweb-standalone-http-status.sh to check that it correctly returns "503 Service Unavailable" if load is too high, and also if there are any Perl warnings or errors. Signed-off-by: John 'Warthog9' Hawley <warthog9@kernel.org> Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-23t/gitweb-lib: Split HTTP response with non-GNU sedLibravatar Brian Gernhardt1-2/+12
Recognizing \r in a regex is something GNU sed will do, but other sed implementation's won't (e.g. BSD sed on OS X). Instead of two sed invocations, use a single Perl script to split output into headers and body. Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-30t/gitweb-lib.sh: Split gitweb output into headers and bodyLibravatar Jakub Narebski1-1/+5
Save HTTP headers into gitweb.headers, and the body of message into gitweb.body in gitweb_run() Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-27gitweb: split test suite into library and testsLibravatar Mark Rada1-0/+73
To accommodate additions to the test cases for gitweb, the preamble from t9500 is now in its own library so that new sets of tests for gitweb can use the same setup without copying the code. Signed-off-by: Mark Rada <marada@uwaterloo.ca> Signed-off-by: Junio C Hamano <gitster@pobox.com>