3 # Copyright (c) 2008 Jakub Narebski
4 # Copyright (c) 2008 Lea Wiemann
7 # This test supports the --long-tests option.
9 # This test only runs on Perl 5.8 and later versions, since both
10 # Gitweb and Test::WWW::Mechanize::CGI require Perl 5.8.
12 test_description
='gitweb tests (using WWW::Mechanize)
14 This test uses Test::WWW::Mechanize::CGI to test gitweb.'
20 if [ "$(git config --get core.filemode)" = false
]
22 git update-index
--chmod="$1" "$2"
28 # check if test can be run
29 "$PERL_PATH" -e 'use 5.008' >/dev
/null
2>&1 ||
{
31 'skipping gitweb tests, Perl 5.8 or newer required' :
36 "$PERL_PATH" -MTest::WWW
::Mechanize
::CGI
-e '' >/dev
/null
2>&1 ||
{
38 'skipping gitweb tests, Test::WWW::Mechanize::CGI not found' :
43 # set up test repository
44 test_expect_success
'set up test repository' '
46 echo "Not an empty file." > file &&
48 test_tick && git commit -a -m "Initial commit." &&
51 echo "New file" > new_file &&
53 test_tick && git commit -a -m "File added." &&
55 safe_chmod +x new_file &&
56 test_tick && git commit -a -m "Mode changed." &&
58 git mv new_file renamed_file &&
59 test_tick && git commit -a -m "File renamed." &&
62 ln -s file renamed_file &&
63 test_tick && git commit -a -m "File to symlink." &&
64 git tag with-symlink &&
66 git rm renamed_file &&
68 test_tick && git commit -a -m "File removed." &&
72 test_tick && git commit -a -m "File copied." &&
74 echo "New line" >> file2 &&
75 safe_chmod +x file2 &&
76 test_tick && git commit -a -m "Mode change and modification." &&
79 echo "New file with a \"pickaxe test string\"" > dir1/file1 &&
81 test_tick && git commit -a -m "File added in subdirectory." &&
82 git tag -m "creating a tag object" tag-object
87 test_tick && git commit -a -m "On branch" &&
88 git checkout master &&
89 test_tick && git merge b
92 # set up empty repository
93 # create this as a subdirectory of trash directory; not pretty, but simple
94 test_expect_success
'set up empty repository' '
102 # set up gitweb configuration
103 safe_pwd
="$("$PERL_PATH" -MPOSIX=getcwd -e 'print quotemeta(getcwd)')"
104 large_cache_root
="$TEST_DIRECTORY/t9503/large_cache.tmp"
105 test_expect_success
'create file cache directory' \
106 'mkdir -p "$large_cache_root"'
107 cat >gitweb_config.perl
<<EOF
108 # gitweb configuration for tests
110 our \$version = "current";
111 our \$GIT = "$GIT_EXEC_PATH/git";
112 our \$projectroot = "$safe_pwd";
113 our \$project_maxdepth = 8;
114 our \$home_link_str = "projects";
115 our \$site_name = "[localhost]";
116 our \$site_header = "";
117 our \$site_footer = "";
118 our \$home_text = "indextext.html";
119 our @stylesheets = ("file:///stylesheet");
120 our \$logo = "file:///logo";
121 our \$favicon = "file:///favicon";
122 our \$projects_list = "";
123 our \$export_ok = "";
124 our \$strict_export = "";
126 \$feature{'blame'}{'default'} = [1];
128 our \$large_cache_root = "$large_cache_root";
129 if (eval { require Cache::MemoryCache; 1 }) {
130 our \$cache = Cache::MemoryCache->new;
138 cat >.git
/description
<<EOF
139 t9503-gitweb-Mechanize test repository
142 GITWEB_CONFIG
="$(pwd)/gitweb_config.perl"
148 'test gitweb output' \
149 "$PERL_PATH" "$TEST_DIRECTORY/t9503/test.pl"
151 test_expect_success
'remove file cache directory' \
152 'rm -rf "$large_cache_root"'