Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
faa5dffb
Commit
faa5dffb
authored
Apr 13, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
After Trace#limit, we seek to the next line in case
of breaking ANSI sequence or Unicode
parent
7629c9ec
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
3 deletions
+32
-3
lib/gitlab/ci/trace/stream.rb
lib/gitlab/ci/trace/stream.rb
+1
-0
spec/fixtures/trace/ansi-sequence-and-unicode
spec/fixtures/trace/ansi-sequence-and-unicode
+5
-0
spec/lib/gitlab/ci/trace/stream_spec.rb
spec/lib/gitlab/ci/trace/stream_spec.rb
+21
-1
spec/support/fixture_helpers.rb
spec/support/fixture_helpers.rb
+5
-2
No files found.
lib/gitlab/ci/trace/stream.rb
View file @
faa5dffb
...
@@ -30,6 +30,7 @@ module Gitlab
...
@@ -30,6 +30,7 @@ module Gitlab
last_bytes
=
stream_size
last_bytes
=
stream_size
end
end
stream
.
seek
(
-
last_bytes
,
IO
::
SEEK_END
)
stream
.
seek
(
-
last_bytes
,
IO
::
SEEK_END
)
stream
.
readline
end
end
def
append
(
data
,
offset
)
def
append
(
data
,
offset
)
...
...
spec/fixtures/trace/ansi-sequence-and-unicode
0 → 100644
View file @
faa5dffb
[0m[01;34m.[0m
[30;42m..[0m
😺
ヾ(´༎ຶД༎ຶ`)ノ
[01;32m許功蓋[0m
spec/lib/gitlab/ci/trace/stream_spec.rb
View file @
faa5dffb
...
@@ -21,7 +21,7 @@ describe Gitlab::Ci::Trace::Stream do
...
@@ -21,7 +21,7 @@ describe Gitlab::Ci::Trace::Stream do
end
end
end
end
it
'if size is larger we start from beg
gi
ning'
do
it
'if size is larger we start from beg
in
ning'
do
stream
.
limit
(
10
)
stream
.
limit
(
10
)
expect
(
stream
.
tell
).
to
eq
(
0
)
expect
(
stream
.
tell
).
to
eq
(
0
)
...
@@ -32,6 +32,26 @@ describe Gitlab::Ci::Trace::Stream do
...
@@ -32,6 +32,26 @@ describe Gitlab::Ci::Trace::Stream do
expect
(
stream
.
tell
).
to
eq
(
6
)
expect
(
stream
.
tell
).
to
eq
(
6
)
end
end
context
'when the trace contains ANSI sequence and Unicode'
do
let
(
:stream
)
do
described_class
.
new
do
File
.
open
(
expand_fixture_path
(
'trace/ansi-sequence-and-unicode'
))
end
end
it
'forwards to the next linefeed, case 1'
do
stream
.
limit
(
7
)
expect
(
stream
.
raw
).
to
eq
(
''
)
end
it
'forwards to the next linefeed, case 2'
do
stream
.
limit
(
29
)
expect
(
stream
.
raw
).
to
eq
(
"
\e
[01;32m許功蓋
\e
[0m
\n
"
)
end
end
end
end
describe
'#append'
do
describe
'#append'
do
...
...
spec/support/fixture_helpers.rb
View file @
faa5dffb
module
FixtureHelpers
module
FixtureHelpers
def
fixture_file
(
filename
)
def
fixture_file
(
filename
)
return
''
if
filename
.
blank?
return
''
if
filename
.
blank?
file_path
=
File
.
expand_path
(
Rails
.
root
.
join
(
'spec/fixtures/'
,
filename
))
File
.
read
(
expand_fixture_path
(
filename
))
File
.
read
(
file_path
)
end
def
expand_fixture_path
(
filename
)
File
.
expand_path
(
Rails
.
root
.
join
(
'spec/fixtures/'
,
filename
))
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment