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

Re: [RFC/PATCH (WIP)] gitweb: Use Test::WWW::Mechanize::CGI to test gitweb output

From
LWLea Wiemann <lewiemann@gmail.com>
Date
Jun 14, 2008, 14:40 UTC
Message-ID
<4853D84D.5010303@gmail.com>
In-Reply-To
<200806141447.28052.jnareb@gmail.com>
Jakub Narebski wrote:
> This test requires [PATCH] t/test-lib.sh: add test_external and test_external_without_stderr

For everyone's convenience, here's the raw patch: http://article.gmane.org/gmane.comp.version-control.git/83415/raw (When repo.or.cz is up again you can also locate a version with fixed whitespace in my repo: <http://repo.or.cz/w/git/gitweb-caching.git>)

> This test uses Perl module Test::WWW::Mechanize::CGI to check
> gitweb output, using HTML::Lint (if present) to validate HTML.

Awesome, thank you so much for making a start here! Here are some quick comments.

> NOTE: Currently test_external_without_stderr fails because when trying
> to access URL for non-existent commit gitweb writes to STDERR; it is
> not necessarily a bug because it is not written to web server logs

Without having looked at the cause of that, I think that gitweb should not be writing stuff to stderr unless an internal or serious error occurs; in particular trying to access invalid commits shouldn't cause messages on stderr, only to log files if at all.

That said, as long as it isn't fixed, here's my workaround to temporarily discard stderr (from my t/t9710/test.pl):

our $old_stderr;
sub discard_stderr {
         open our $old_stderr, ">&", STDERR or die "cannot save STDERR";
         close STDERR;
}
sub restore_stderr {
         open STDERR, ">&", $old_stderr or die "cannot restore STDERR";
}
It works on Unix, but I don't know about other platforms.
> +cat >gitweb_config.perl <<EOF
> [...]
> +our \$GIT = "git";

t9500 seems to be doing the same(?) thing, but this somehow doesn't work with your t9503 test:

$ git     # no git in PATH to make sure it picks up the right git binary
bash: git: command not found
$ ./t9500-gitweb-standalone-no-errors.sh | grep passed
* passed all 75 test(s)
$ ./t9503-gitweb-Mechanize.sh -v
[...]
	gitweb.perl: Can't exec "git": No such file or directory at 
/home/lea/source/git/fresh-git/gitweb/gitweb.perl line 380.
-- Lea
Previous: Jakub NarebskiNext: Jakub Narebski
Message 2 of 41 in “gitweb: Use Test::WWW::Mechanize::CGI to test gitweb output”
  1. gitweb: Use Test::WWW::Mechanize::CGI to test gitweb outputJakub Narebski, Jun 14, 2008
  2. Lea WiemannJun 14, 2008
  3. Jakub NarebskiJun 14, 2008
  4. Lea WiemannJun 14, 2008
  5. Jakub NarebskiJun 14, 2008
  6. Lea WiemannJun 14, 2008
  7. Jakub NarebskiJun 15, 2008
  8. Lea WiemannJun 14, 2008
  9. Jakub NarebskiJun 14, 2008
  10. gitweb: add test suite with Test::WWW::Mechanize::CGILea Wiemann, Jun 14, 2008
  11. Jakub NarebskiJun 15, 2008
  12. Lea WiemannJun 15, 2008
  13. Jakub NarebskiJun 16, 2008
  14. Lea WiemannJun 16, 2008
  15. Jakub NarebskiJun 16, 2008
  16. gitweb: add test suite with Test::WWW::Mechanize::CGILea Wiemann, Jun 20, 2008
  17. Jakub NarebskiJun 20, 2008
  18. Lea WiemannJun 20, 2008
  19. Jakub NarebskiJun 20, 2008
  20. Lea WiemannJun 20, 2008
  21. gitweb: add test suite with Test::WWW::Mechanize::CGILea Wiemann, Jun 20, 2008
  22. gitweb: add test suite with Test::WWW::Mechanize::CGILea Wiemann, Jun 23, 2008
  23. gitweb: add test suite with Test::WWW::Mechanize::CGILea Wiemann, Jun 23, 2008
  24. Junio C HamanoJun 23, 2008
  25. Lea WiemannJun 23, 2008
  26. Jakub NarebskiJun 23, 2008
  27. Lea WiemannJun 23, 2008
  28. Jakub NarebskiJun 23, 2008
  29. Lea WiemannJun 24, 2008
  30. gitweb: add test suite with Test::WWW::Mechanize::CGILea Wiemann, Jun 24, 2008
  31. gitweb: add test suite with Test::WWW::Mechanize::CGILea Wiemann, Jun 26, 2008
  32. gitweb: add test suite with Test::WWW::Mechanize::CGILea Wiemann, Jun 26, 2008
  33. Jakub NarebskiJun 29, 2008
  34. Lea WiemannJun 29, 2008
  35. Jakub NarebskiJun 29, 2008
  36. Lea WiemannJun 30, 2008
  37. Jakub NarebskiJun 30, 2008
  38. Junio C HamanoJun 24, 2008
  39. Lea WiemannJun 24, 2008
  40. Jakub NarebskiJun 24, 2008
  41. Jakub NarebskiJun 30, 2008

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.