Skip to content

Commit 12dc677

Browse files
authored
Handle space in filename. See #384. (#386)
Signed-off-by: Henry Cox <[email protected]>
1 parent f53848b commit 12dc677

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

bin/geninfo

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,8 @@ sub find_files
972972
} else {
973973
$lcovutil::profileData{find}{$directory} = $time;
974974
}
975-
my @found = split(' ', $stdout);
975+
# split on crlf
976+
my @found = split(/[\x0A\x0D]/, $stdout);
976977
if (!@found) {
977978
if (!defined($processGcno) || $processGcno != 2) {
978979
# delay message: might be a file of other type here

tests/lcov/extract/extract.sh

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set +x
55

66
source ../../common.tst
77

8-
rm -rf *.gcda *.gcno a.out *.info* *.txt* *.json dumper* testRC *.gcov *.gcov.* *.log *.o errs *.msg *.dat
8+
rm -rf *.gcda *.gcno a.out *.info* *.txt* *.json dumper* testRC *.gcov *.gcov.* *.log *.o errs *.msg *.dat mytest spaces
99
rm -rf rcOptBug
1010

1111
if [ -d separate ] ; then
@@ -885,6 +885,36 @@ if [ 0 == $? ] ; then
885885
fi
886886
fi
887887
888+
# test filename containing spaces
889+
rm -rf ./mytest
890+
mkdir -pv ./mytest
891+
echo "int main(){}" > './mytest/main space.cpp'
892+
( cd ./mytest ; ${CXX} -c 'main space.cpp' --coverage )
893+
894+
$COVER $CAPTURE mytest -i -o spaces.info
895+
if [ 0 != $? ] ; then
896+
echo "Error: unexpected error from filename containing space"
897+
if [ $KEEP_GOING == 0 ] ; then
898+
exit 1
899+
fi
900+
fi
901+
902+
$COVER $LCOV_TOOL --list spaces.info
903+
if [ 0 != $? ] ; then
904+
echo "Error: unable to list filename containing space"
905+
if [ $KEEP_GOING == 0 ] ; then
906+
exit 1
907+
fi
908+
fi
909+
910+
$COVER $GENHTML_TOOL -o spaces spaces.info
911+
if [ 0 != $? ] ; then
912+
echo "Error: unable to generate HTML for filename containing space"
913+
if [ $KEEP_GOING == 0 ] ; then
914+
exit 1
915+
fi
916+
fi
917+
888918
889919
echo "Tests passed"
890920

0 commit comments

Comments
 (0)