File tree 38 files changed +105
-97
lines changed
Quantifiers-initialisation
Quantifiers-initialisation2
Quantifiers-invalid-var-range
Quantifiers-two-dimension-array
single-line-windows-line-ends
38 files changed +105
-97
lines changed Original file line number Diff line number Diff line change 8
8
^\[main.assertion.4\] NotExists-Forall: failed: FAILURE$
9
9
^\[main.assertion.5\] NotForall-Forall: successful: SUCCESS$
10
10
^\[main.assertion.6\] NotForall-NotForall: successful: SUCCESS$
11
-
12
11
^\*\* 2 of 6 failed \(2 iterations\)$
13
12
^\VERIFICATION FAILED$
Original file line number Diff line number Diff line change 6
6
^\[main.assertion.2\] assertion y: FAILURE$
7
7
^\[main.assertion.3\] assertion z1: SUCCESS$
8
8
^\[main.assertion.4\] assertion z2: SUCCESS$
9
-
10
9
^\*\* 1 of 4 failed \(2 iterations\)$
11
10
^\VERIFICATION FAILED$
Original file line number Diff line number Diff line change 7
7
^\[main.assertion.3\] assertion b\[.*\] == 2: SUCCESS$
8
8
^\[main.assertion.4\] assertion b\[.*\] == 3: SUCCESS$
9
9
^\[main.assertion.5\] assertion b\[.*\] == 4: SUCCESS$
10
-
11
10
^\*\* 0 of 5 failed \(1 iteration\)$
12
11
^VERIFICATION SUCCESSFUL$
Original file line number Diff line number Diff line change 7
7
^\[main.assertion.3\] success 1: SUCCESS$
8
8
^\[main.assertion.4\] failure 3: FAILURE$
9
9
^\[main.assertion.5\] success 2: SUCCESS$
10
-
11
10
^\*\* 3 of 5 failed \(2 iterations\)$
12
11
^\VERIFICATION FAILED$
Original file line number Diff line number Diff line change 7
7
^\[main.assertion.3\] assertion a\[.*\] == 3: SUCCESS$
8
8
^\[main.assertion.4\] assertion a\[.*\] == 4: SUCCESS$
9
9
^\[main.assertion.5\] assertion a\[.*\] == 5: SUCCESS$
10
-
11
10
^\*\* 0 of 5 failed \(1 iteration\)$
12
11
^VERIFICATION SUCCESSFUL$
Original file line number Diff line number Diff line change 7
7
^\[main.assertion.3\] assertion a\[.*\] > a\[.*\]: FAILURE$
8
8
^\[main.assertion.4\] forall c\[\]: SUCCESS$
9
9
^\[main.assertion.5\] assertion c\[.*\] >= c\[.*\]: SUCCESS$
10
-
11
10
^\*\* 1 of 5 failed \(2 iterations\)$
12
11
^VERIFICATION FAILED$
Original file line number Diff line number Diff line change 2
2
main.c
3
3
4
4
^\*\* Results:$
5
-
6
5
^\*\* 0 of 1 failed \(1 iteration\)$
7
6
^VERIFICATION SUCCESSFUL$
Original file line number Diff line number Diff line change 8
8
^\[main.assertion.4\] assertion tmp_if_expr\$9: SUCCESS$
9
9
^\[main.assertion.5\] assertion tmp_if_expr\$12: SUCCESS$
10
10
^\[main.assertion.6\] assertion tmp_if_expr\$15: SUCCESS$
11
-
12
11
^\*\* 0 of 6 failed \(1 iteration\)$
13
12
^\VERIFICATION SUCCESSFUL$
Original file line number Diff line number Diff line change 7
7
^\[main.assertion.3\] failure 1: FAILURE$
8
8
^\[main.assertion.4\] success 3: SUCCESS$
9
9
^\[main.assertion.5\] failure 2: FAILURE$
10
-
11
10
^\*\* 2 of 5 failed \(2 iterations\)$
12
11
^\VERIFICATION FAILED$
Original file line number Diff line number Diff line change 7
7
^\[main.assertion.3\] assertion a\[.*\]\[.*\] == 1: SUCCESS$
8
8
^\[main.assertion.4\] assertion a\[.*\]\[.*\] == 2: SUCCESS$
9
9
^\[main.assertion.5\] assertion tmp_if_expr\$3: SUCCESS$
10
-
11
10
^\*\* 0 of 5 failed \(1 iteration\)$
12
11
^VERIFICATION SUCCESSFUL$
Original file line number Diff line number Diff line change 4
4
^\*\* Results:$
5
5
^\[main.assertion.1\] assertion tmp_if_expr\$1: FAILURE$
6
6
^\[main.assertion.2\] assertion tmp_if_expr\$2: SUCCESS$
7
-
8
7
^\*\* 1 of 2 failed \(2 iterations\)$
9
8
^\VERIFICATION FAILED$
Original file line number Diff line number Diff line change 1
1
default : tests.log
2
2
3
3
test :
4
- @../test.pl -c ../../../src/goto-analyzer/goto-analyzer
4
+ @if ! ../test.pl -c ../../../src/goto-analyzer/goto-analyzer ; then \
5
+ ../failed-tests-printer.pl ; \
6
+ exit 1 ; \
7
+ fi
5
8
6
9
tests.log : ../test.pl
7
- @../test.pl -c ../../../src/goto-analyzer/goto-analyzer
10
+ @if ! ../test.pl -c ../../../src/goto-analyzer/goto-analyzer ; then \
11
+ ../failed-tests-printer.pl ; \
12
+ exit 1 ; \
13
+ fi
8
14
9
15
show :
10
16
@for dir in * ; do \
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
CORE
2
- program.c
2
+ test.txt
3
3
4
4
^Hello$
5
5
--
Original file line number Diff line number Diff line change
1
+ Hello
2
+ World
3
+
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
KNOWNBUG
2
- program.c
2
+ test.txt
3
3
4
4
^Hello$
5
5
--
Original file line number Diff line number Diff line change
1
+ Hello
2
+ World
3
+
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
KNOWNBUG
2
- program.c
2
+ test.txt
3
3
4
4
activate-multi-line-match
5
5
Hello\nAnother\nWorld
Original file line number Diff line number Diff line change
1
+ Hello
2
+ World
3
+
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
KNOWNBUG
2
- program.c
2
+ test.txt
3
3
4
4
^Goodbye$
5
5
--
Original file line number Diff line number Diff line change
1
+ Hello
2
+ World
3
+
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
CORE
2
- program.c
2
+ test.txt
3
3
4
4
activate-multi-line-match
5
5
Hello\nWorld
Original file line number Diff line number Diff line change
1
+ Hello
2
+ World
3
+
Original file line number Diff line number Diff line change 2
2
3
3
set -e
4
4
5
- gcc $1 -o a.out
6
- ./a.out
5
+ cat $1
Original file line number Diff line number Diff line change
1
+ CORE
2
+ test.txt
3
+
4
+ ^Hello$
5
+ --
Original file line number Diff line number Diff line change
1
+ Hello
2
+ World
3
+
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
CORE
2
- program.c
2
+ test.txt
3
3
4
4
^Hello$
5
5
--
Original file line number Diff line number Diff line change
1
+ Hello
2
+ World
3
+
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ ($$$$$)
73
73
$options =~ s / $ign// g if (defined ($ign ));
74
74
75
75
my $output = $input ;
76
- $output =~ s /\. (c|i|gb|cpp|ii|xml|class|jar) $/ .out/ ;
76
+ $output =~ s /\. [^.]* $/ .out/ ;
77
77
78
78
if ($output eq $input ) {
79
79
print (" Error in test file -- $test \n " );
@@ -125,13 +125,15 @@ ($$$$$)
125
125
local $/ = undef ;
126
126
binmode $fh ;
127
127
my $whole_file = <$fh >;
128
+ $whole_file =~ s /\r\n / \n / g ;
128
129
my $is_match = $whole_file =~ / $result / ;
129
130
$r = ($included ? !$is_match : $is_match );
130
131
}
131
132
else
132
133
{
133
134
my $found_line = 0;
134
135
while (my $line = <$fh >) {
136
+ $line =~ s /\r $// ;
135
137
if ($line =~ / $result / ) {
136
138
# We've found the line, therefore if it is included we set
137
139
# the result to 0 (OK) If it is excluded, we set the result
Original file line number Diff line number Diff line change @@ -1145,6 +1145,7 @@ def RepositoryName(self):
1145
1145
os .path .exists (os .path .join (current_dir , ".hg" )) or
1146
1146
os .path .exists (os .path .join (current_dir , ".svn" ))):
1147
1147
root_dir = current_dir
1148
+ break ;
1148
1149
current_dir = os .path .dirname (current_dir )
1149
1150
1150
1151
if (os .path .exists (os .path .join (root_dir , ".git" )) or
Original file line number Diff line number Diff line change 8
8
print >> sys .stderr , "Usage: filter_lint_by_diff.py diff.patch repository_root_directory < cpplint_warnings.txt"
9
9
sys .exit (1 )
10
10
11
- added_lines = set ()
12
11
repository_root = sys .argv [2 ]
13
12
14
- diff = unidiff .PatchSet .from_filename (sys .argv [1 ])
15
- for diff_file in diff :
13
+ # Create a set of all the files and the specific lines within that file that are in the diff
14
+ added_lines = set ()
15
+ for diff_file in unidiff .PatchSet .from_filename (sys .argv [1 ]):
16
16
filename = diff_file .target_file
17
17
# Skip files deleted in the tip (b side of the diff):
18
18
if filename == "/dev/null" :
25
25
if diff_line .line_type == "+" :
26
26
added_lines .add ((filename , diff_line .target_line_no ))
27
27
28
- for l in sys .stdin :
29
- bits = l .split (":" )
30
- if len (bits ) < 3 :
28
+ # Print the lines that are in the set
29
+ for line in sys .stdin :
30
+ line_parts = line .split (":" )
31
+ if len (line_parts ) < 3 :
31
32
continue
32
- filename = os .path .join (repository_root , bits [0 ])
33
- linenum = int (bits [1 ])
33
+ filename = os .path .join (repository_root , line_parts [0 ])
34
+ linenum = int (line_parts [1 ])
34
35
if (filename , linenum ) in added_lines :
35
- sys .stdout .write (l )
36
+ sys .stdout .write (line )
Original file line number Diff line number Diff line change 3
3
set -e
4
4
5
5
script_folder=` dirname $0 `
6
- absolute_repository_root=` readlink -f $script_folder /.. `
6
+ absolute_repository_root=` git rev-parse --show-toplevel `
7
7
8
8
if [[ " $# " -gt 2 ]]
9
9
then
20
20
exit 1
21
21
fi
22
22
23
+ if ! [[ -e $script_folder /filter_lint_by_diff.py ]]
24
+ then
25
+ echo " Lint filter script could not be found in the $script_folder directory"
26
+ echo " Ensure filter_lint_by_diff.py is inside the $script_folder directory then run again"
27
+ exit 1
28
+ fi
29
+
23
30
if [[ " $# " -gt 0 ]]
24
31
then
25
32
git_start=$1
@@ -62,7 +69,7 @@ for file in $diff_files; do
62
69
63
70
# Run the linting script and filter:
64
71
# The errors from the linter go to STDERR so must be redirected to STDOUT
65
- result=` $script_folder /cpplint.py $file 2>&1 | $script_folder /filter_lint_by_diff.py $diff_file $absolute_repository_root `
72
+ result=` $script_folder /cpplint.py $file 2>&1 > /dev/null | $script_folder /filter_lint_by_diff.py $diff_file $absolute_repository_root `
66
73
67
74
# Providing some errors were relevant we print them out
68
75
if [ " $result " ]
You can’t perform that action at this time.
0 commit comments