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 <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
This commit is contained in:
Ramsay Jones 2013-10-06 21:50:46 +01:00 коммит произвёл Jonathan Nieder
Родитель 592ea4173a
Коммит 7202db8647
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -654,9 +654,11 @@ cat >>gitweb_config.perl <<\EOF
$feature{'highlight'}{'override'} = 1;
EOF
highlight --version >/dev/null 2>&1
highlight_version=$(highlight --version </dev/null 2>/dev/null)
if [ $? -eq 127 ]; then
say "Skipping syntax highlighting test, because 'highlight' was not found"
say "Skipping syntax highlighting tests: 'highlight' not found"
elif test -z "$highlight_version"; then
say "Skipping syntax highlighting tests: incorrect 'highlight' found"
else
test_set_prereq HIGHLIGHT
fi