]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/lib-gitweb: test against the build version of gitweb
authorPatrick Steinhardt <ps@pks.im>
Wed, 16 Oct 2024 08:12:56 +0000 (10:12 +0200)
committerTaylor Blau <me@ttaylorr.com>
Wed, 16 Oct 2024 21:00:49 +0000 (17:00 -0400)
When testing gitweb we set up the CGI script as "gitweb.perl", which is
the source file of the build target "gitweb.cgi". This file doesn't have
a patched shebang and still contains `++REPLACEMENT++` markers, but
things generally work because we replace the configuration with our own
test configuration.

But this only works as long as "$GIT_BUILD_DIR" actually points to the
source tree, because "gitweb.cgi" and "gitweb.perl" happen to sit next
to each other. This is not the case though once you have out-of-tree
builds like with CMake, where the source and built versions live in
different directories. Consequently, "$GIT_BUILD_DIR/gitweb/gitweb.perl"
won't exist there.

While we could ask build systems with out-of-tree builds to instead set
up GITWEB_TEST_INSTALLED, which allows us to override the location of
the script, it goes against the spirit of this environment variable. We
_don't_ want to test against an installed version, we want to use the
version we have just built.

Fix this by using "gitweb.cgi" instead. This means that you cannot run
test scripts without building that file, but in general we do expect
developers to build stuff before they test it anyway.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
t/lib-gitweb.sh

index 1f32ca66ea5128baf8ecec6adebea07853e5b2f9..7f9808ec2024d62edc3a3f1c01fb255d0fd37cb2 100644 (file)
@@ -48,8 +48,8 @@ EOF
                test -f "$SCRIPT_NAME" ||
                error "Cannot find gitweb at $GITWEB_TEST_INSTALLED."
                say "# Testing $SCRIPT_NAME"
-       else # normal case, use source version of gitweb
-               SCRIPT_NAME="$GIT_BUILD_DIR/gitweb/gitweb.perl"
+       else # normal case, use built version of gitweb
+               SCRIPT_NAME="$GIT_BUILD_DIR/gitweb/gitweb.cgi"
        fi
        export SCRIPT_NAME
 }