Skip to content

Commit 7202db8

Browse files
Ramsay Jonesjrn
authored andcommitted
gitweb test: fix highlight test hang on Linux Mint
Linux Mint has an implementation of the highlight command (unrelated to the one from http://www.andre-simon.de) that works as a simple filter. The script uses 'sed' to add terminal colour escape codes around text matching a regular expression. When t9500-*.sh attempts to run "highlight --version", the script simply hangs waiting for input. (See https://bugs.launchpad.net/linuxmint/+bug/815005). The tool required by gitweb can be installed from the 'highlight' package. Unfortunately, given the default $PATH, this leads to the tool having lower precedence than the script. In order to avoid hanging the test, add '</dev/null' to the command line of the highlight invocation. Also, since the 'highlight' tool requred by gitweb produces '--version' output (and the script does not), saving the command output allows a simple check for the wrong 'highlight'. Signed-off-by: Ramsay Jones <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]>
1 parent 592ea41 commit 7202db8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

t/t9500-gitweb-standalone-no-errors.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,9 +654,11 @@ cat >>gitweb_config.perl <<\EOF
654654
$feature{'highlight'}{'override'} = 1;
655655
EOF
656656

657-
highlight --version >/dev/null 2>&1
657+
highlight_version=$(highlight --version </dev/null 2>/dev/null)
658658
if [ $? -eq 127 ]; then
659-
say "Skipping syntax highlighting test, because 'highlight' was not found"
659+
say "Skipping syntax highlighting tests: 'highlight' not found"
660+
elif test -z "$highlight_version"; then
661+
say "Skipping syntax highlighting tests: incorrect 'highlight' found"
660662
else
661663
test_set_prereq HIGHLIGHT
662664
fi

0 commit comments

Comments
 (0)