Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
62a41570
Commit
62a41570
authored
7 years ago
by
Florian Angerer
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Fuzzy compare did not properly synchronize.
parent
82c52bb3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mx.fastr/mx_fastr_pkgs.py
+14
-8
14 additions, 8 deletions
mx.fastr/mx_fastr_pkgs.py
with
14 additions
and
8 deletions
mx.fastr/mx_fastr_pkgs.py
+
14
−
8
View file @
62a41570
...
@@ -674,34 +674,40 @@ def _fuzzy_compare(gnur_content, fastr_content, gnur_filename, fastr_filename, v
...
@@ -674,34 +674,40 @@ def _fuzzy_compare(gnur_content, fastr_content, gnur_filename, fastr_filename, v
if
fastr_content
[
fastr_i
].
startswith
(
'
NULL
'
)
and
not
gnur_line
.
startswith
(
'
NULL
'
):
if
fastr_content
[
fastr_i
].
startswith
(
'
NULL
'
)
and
not
gnur_line
.
startswith
(
'
NULL
'
):
# ignore additional visible NULL
# ignore additional visible NULL
fastr_i
=
fastr_i
+
1
fastr_i
=
fastr_i
+
1
contin
ue
sync
=
Tr
ue
if
gnur_line
.
startswith
(
'
Warning
'
)
and
gnur_i
+
1
<
gnur_end
and
'
closing unused connection
'
in
gnur_content
[
gnur_i
+
1
]:
el
if
gnur_line
.
startswith
(
'
Warning
'
)
and
gnur_i
+
1
<
gnur_end
and
'
closing unused connection
'
in
gnur_content
[
gnur_i
+
1
]:
# ignore message about closed connection
# ignore message about closed connection
gnur_i
=
gnur_i
+
2
gnur_i
=
gnur_i
+
2
contin
ue
sync
=
Tr
ue
if
gnur_i
>
0
and
gnur_content
[
gnur_i
-
1
].
startswith
(
'
user system elapsed
'
):
el
if
gnur_i
>
0
and
gnur_content
[
gnur_i
-
1
].
startswith
(
'
user system elapsed
'
):
# ignore differences in timing
# ignore differences in timing
gnur_i
=
gnur_i
+
1
gnur_i
=
gnur_i
+
1
fastr_i
=
fastr_i
+
1
fastr_i
=
fastr_i
+
1
contin
ue
sync
=
Tr
ue
# we are fuzzy on Error/Warning as FastR often differs
# we are fuzzy on Error/Warning as FastR often differs
# in the context/format of the error/warning message AND GnuR is sometimes
# in the context/format of the error/warning message AND GnuR is sometimes
# inconsistent over which error message it uses. Unlike the unit test environment,
# inconsistent over which error message it uses. Unlike the unit test environment,
# we cannot tag tests in any way, so we simply check that FastR does report
# we cannot tag tests in any way, so we simply check that FastR does report
# an error. We then scan forward to try to get the files back in sync, as the
# an error. We then scan forward to try to get the files back in sync, as the
# the number of error/warning lines may differ.
# the number of error/warning lines may differ.
if
'
Error
'
in
gnur_line
or
'
Warning
'
in
gnur_line
:
el
if
'
Error
'
in
gnur_line
or
'
Warning
'
in
gnur_line
:
to_match
=
'
Error
'
if
'
Error
'
in
gnur_line
else
'
Warning
'
to_match
=
'
Error
'
if
'
Error
'
in
gnur_line
else
'
Warning
'
if
to_match
not
in
fastr_line
:
if
to_match
not
in
fastr_line
:
result
=
1
result
=
1
else
:
else
:
# accept differences in the error/warning messages but we need to synchronize
# accept differences in the error/warning messages but we need to synchronize
gnur_i
=
gnur_i
+
1
fastr_i
=
fastr_i
+
1
sync
=
True
sync
=
True
elif
_is_ignored_function
(
"
sessionInfo
"
,
gnur_content
,
gnur_cur_statement_start
,
fastr_content
,
fastr_cur_statement_start
):
elif
_is_ignored_function
(
"
sessionInfo
"
,
gnur_content
,
gnur_cur_statement_start
,
fastr_content
,
fastr_cur_statement_start
):
# ignore differences in 'sessionInfo' output
# ignore differences in 'sessionInfo' output
gnur_i
=
gnur_i
+
1
fastr_i
=
fastr_i
+
1
sync
=
True
sync
=
True
elif
_is_ignored_function
(
"
extSoftVersion
"
,
gnur_content
,
gnur_cur_statement_start
,
fastr_content
,
fastr_cur_statement_start
):
elif
_is_ignored_function
(
"
extSoftVersion
"
,
gnur_content
,
gnur_cur_statement_start
,
fastr_content
,
fastr_cur_statement_start
):
# ignore differences in 'extSoftVersion' output
# ignore differences in 'extSoftVersion' output
gnur_i
=
gnur_i
+
1
fastr_i
=
fastr_i
+
1
sync
=
True
sync
=
True
else
:
else
:
# genuine difference (modulo whitespace)
# genuine difference (modulo whitespace)
...
@@ -717,6 +723,8 @@ def _fuzzy_compare(gnur_content, fastr_content, gnur_filename, fastr_filename, v
...
@@ -717,6 +723,8 @@ def _fuzzy_compare(gnur_content, fastr_content, gnur_filename, fastr_filename, v
print
fastr_line
.
strip
()
print
fastr_line
.
strip
()
# we need to synchronize the indices such that we can continue
# we need to synchronize the indices such that we can continue
gnur_i
=
gnur_i
+
1
fastr_i
=
fastr_i
+
1
sync
=
True
sync
=
True
# report the last statement to produce different output
# report the last statement to produce different output
assert
fastr_cur_statement_start
!=
-
1
assert
fastr_cur_statement_start
!=
-
1
...
@@ -734,8 +742,6 @@ def _fuzzy_compare(gnur_content, fastr_content, gnur_filename, fastr_filename, v
...
@@ -734,8 +742,6 @@ def _fuzzy_compare(gnur_content, fastr_content, gnur_filename, fastr_filename, v
# synchronize: skip until lines match (or file end reached)
# synchronize: skip until lines match (or file end reached)
if
sync
:
if
sync
:
gnur_i
=
gnur_i
+
1
fastr_i
=
fastr_i
+
1
if
gnur_i
==
gnur_end
-
1
:
if
gnur_i
==
gnur_end
-
1
:
# at end (there is always a blank line)
# at end (there is always a blank line)
break
break
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment