summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2017-07-22 05:19:02 +0000
committerJose Ivan Vargas <jvargas@gitlab.com>2017-07-24 11:31:04 -0500
commite696e8426c4d31a190782967b14a384f7da8d4b1 (patch)
tree5acf52cfa7f9473d7e07c8cb957a79d04caa0806
parent1b24cb18359a8969f57067d61f59dad5375ff539 (diff)
downloadgitlab-ce-e696e8426c4d31a190782967b14a384f7da8d4b1.tar.gz
Merge branch '35368-fix-gcovr-regexp-matching' into 'master'
Fix the gcovr coverage regex by removing line separators before scanning Closes #35368 See merge request !13025
-rw-r--r--lib/gitlab/ci/trace/stream.rb1
-rw-r--r--spec/lib/gitlab/ci/trace/stream_spec.rb7
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/gitlab/ci/trace/stream.rb b/lib/gitlab/ci/trace/stream.rb
index 5d6977106d6..aaba034474c 100644
--- a/lib/gitlab/ci/trace/stream.rb
+++ b/lib/gitlab/ci/trace/stream.rb
@@ -74,6 +74,7 @@ module Gitlab
match = ""
reverse_line do |line|
+ line.chomp!
matches = regex.scan(line)
next unless matches.is_a?(Array)
next if matches.empty?
diff --git a/spec/lib/gitlab/ci/trace/stream_spec.rb b/spec/lib/gitlab/ci/trace/stream_spec.rb
index 13f0338b6aa..3a132fb9989 100644
--- a/spec/lib/gitlab/ci/trace/stream_spec.rb
+++ b/spec/lib/gitlab/ci/trace/stream_spec.rb
@@ -300,5 +300,12 @@ describe Gitlab::Ci::Trace::Stream do
include_examples 'malicious regexp'
end
+
+ context 'multi-line data with rooted regexp' do
+ let(:data) { "\n65%\n" }
+ let(:regex) { '^(\d+)\%$' }
+
+ it { is_expected.to eq('65') }
+ end
end
end