Skip to content

Commit 5f3d9c5

Browse files
committed
Adapt tests after moving output from stderr to stdout
# Conflicts: # cpplint_clitest.py # samples/boost-sample/headers_simple.def # samples/boost-sample/simple.def # samples/chromium-sample/simple.def # samples/codelite-sample/simple.def # samples/protobuf-sample/simple.def # samples/vlc-sample/simple.def
1 parent c6f6129 commit 5f3d9c5

File tree

9 files changed

+49
-31
lines changed

9 files changed

+49
-31
lines changed

cpplint_clitest.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,24 +105,26 @@ def checkAllInFolder(self, foldername, expectedDefs):
105105
self.assertEqual(count, expectedDefs)
106106

107107
def checkDef(self, path):
108+
"""runs command and compares to expected output from def file"""
108109
# self.maxDiff = None # to see full diff
109110
with open(path, 'rb') as filehandle:
110111
datalines = filehandle.readlines()
112+
stdoutLines = int(datalines[2])
111113
self.runAndCheck(os.path.dirname(path),
112114
datalines[0].decode('utf8').strip(),
113115
int(datalines[1]),
114-
b'',
115-
[line.decode('utf8').strip() for line in datalines[2:]])
116+
[line.decode('utf8').strip() for line in datalines[3:3 + stdoutLines]],
117+
[line.decode('utf8').strip() for line in datalines[3 + stdoutLines:]])
116118

117119
def runAndCheck(self, cwd, args, expectedStatus, expectedOut, expectedErr):
118120
cmd = BASE_CMD + ' ' + args
119121
# command to reproduce, do not forget first two lines have special meaning
120-
print("cd " + cwd + ";" + cmd + " 2> <filename>")
122+
print("\ncd " + cwd + ";" + cmd + " 2> <filename>")
121123
(status, out, err) = RunShellCommand(cmd, cwd)
122124
try:
123125
self.assertEqual(expectedStatus, status)
124126
self.assertEqual(expectedErr, err.decode('utf8').split('\n'))
125-
self.assertEqual(expectedOut, out)
127+
self.assertEqual(expectedOut, out.decode('utf8').split('\n'))
126128
except AssertionError as e:
127129
print('Failed check in ' + cwd)
128130
print('for command: ' + cmd)

samples/boost-sample/headers_simple.def

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
src/tr1/*
22
1
3+
3
4+
Done processing src/tr1/c_policy.hpp
5+
Total errors found: 68
6+
37
src/tr1/c_policy.hpp:0: No #ifndef header guard found, suggested CPP variable is: SAMPLES_BOOST_SAMPLE_SRC_TR1_C_POLICY_HPP_ [build/header_guard] [5]
48
src/tr1/c_policy.hpp:9: Missing space before { [whitespace/braces] [5]
59
src/tr1/c_policy.hpp:13: Line ends in whitespace. Consider deleting these extra spaces. [whitespace/end_of_line] [4]
@@ -68,6 +72,4 @@ src/tr1/c_policy.hpp:109: Namespace should be terminated with "// namespace boo
6872
src/tr1/c_policy.hpp:109: At least two spaces is best between code and comments [whitespace/comments] [2]
6973
src/tr1/c_policy.hpp:111: Missing space before { [whitespace/braces] [5]
7074
src/tr1/c_policy.hpp:131: Namespace should be terminated with "// namespace c_policies" [readability/namespace] [5]
71-
Done processing src/tr1/c_policy.hpp
72-
Total errors found: 68
7375

samples/boost-sample/simple.def

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
include/boost/math/*
22
1
3+
3
4+
Done processing include/boost/math/octonion.hpp
5+
Total errors found: 2674
6+
37
include/boost/math/octonion.hpp:11: #ifndef header guard has wrong style, please use: SAMPLES_BOOST_SAMPLE_INCLUDE_BOOST_MATH_OCTONION_HPP_ [build/header_guard] [5]
48
include/boost/math/octonion.hpp:4250: #endif line should be "#endif // SAMPLES_BOOST_SAMPLE_INCLUDE_BOOST_MATH_OCTONION_HPP_" [build/header_guard] [5]
59
include/boost/math/octonion.hpp:18: { should almost always be at the end of the previous line [whitespace/braces] [4]
@@ -2674,6 +2678,4 @@ include/boost/math/octonion.hpp:4246: Namespace should be terminated with "// n
26742678
include/boost/math/octonion.hpp:4247: Namespace should be terminated with "// namespace math" [readability/namespace] [5]
26752679
include/boost/math/octonion.hpp:4248: Namespace should be terminated with "// namespace boost" [readability/namespace] [5]
26762680
include/boost/math/octonion.hpp:4250: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
2677-
Done processing include/boost/math/octonion.hpp
2678-
Total errors found: 2674
26792681

samples/chromium-sample/simple.def

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
src/*
22
1
3+
6
4+
Done processing src/chrome_content_renderer_client.cc
5+
Done processing src/chrome_content_renderer_client.h
6+
Done processing src/io_thread.cc
7+
Done processing src/io_thread.h
8+
Total errors found: 108
9+
310
src/chrome_content_renderer_client.cc:113: Include the directory when naming .h files [build/include_subdir] [4]
411
src/chrome_content_renderer_client.cc:118: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
512
src/chrome_content_renderer_client.cc:127: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
@@ -57,7 +64,6 @@ src/chrome_content_renderer_client.cc:1397: Uncommented text after #endif is no
5764
src/chrome_content_renderer_client.cc:1406: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
5865
src/chrome_content_renderer_client.cc:1418: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
5966
src/chrome_content_renderer_client.cc:5: samples/chromium-sample/src/chrome_content_renderer_client.cc should include its header file samples/chromium-sample/src/chrome_content_renderer_client.h [build/include] [5]
60-
Done processing src/chrome_content_renderer_client.cc
6167
src/chrome_content_renderer_client.h:5: #ifndef header guard has wrong style, please use: SAMPLES_CHROMIUM_SAMPLE_SRC_CHROME_CONTENT_RENDERER_CLIENT_H_ [build/header_guard] [5]
6268
src/chrome_content_renderer_client.h:225: #endif line should be "#endif // SAMPLES_CHROMIUM_SAMPLE_SRC_CHROME_CONTENT_RENDERER_CLIENT_H_" [build/header_guard] [5]
6369
src/chrome_content_renderer_client.h:26: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
@@ -73,7 +79,6 @@ src/chrome_content_renderer_client.h:209: Uncommented text after #endif is non-
7379
src/chrome_content_renderer_client.h:215: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
7480
src/chrome_content_renderer_client.h:218: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
7581
src/chrome_content_renderer_client.h:222: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
76-
Done processing src/chrome_content_renderer_client.h
7782
src/io_thread.cc:112: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
7883
src/io_thread.cc:116: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
7984
src/io_thread.cc:123: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
@@ -103,14 +108,11 @@ src/io_thread.cc:1155: Uncommented text after #endif is non-standard. Use a co
103108
src/io_thread.cc:1547: Missing space around colon in range-based for loop [whitespace/forcolon] [2]
104109
src/io_thread.cc:1749: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
105110
src/io_thread.cc:5: samples/chromium-sample/src/io_thread.cc should include its header file samples/chromium-sample/src/io_thread.h [build/include] [5]
106-
Done processing src/io_thread.cc
107111
src/io_thread.h:5: #ifndef header guard has wrong style, please use: SAMPLES_CHROMIUM_SAMPLE_SRC_IO_THREAD_H_ [build/header_guard] [5]
108112
src/io_thread.h:565: #endif line should be "#endif // SAMPLES_CHROMIUM_SAMPLE_SRC_IO_THREAD_H_" [build/header_guard] [5]
109113
src/io_thread.h:177: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
110114
src/io_thread.h:467: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
111115
src/io_thread.h:490: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
112116
src/io_thread.h:526: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
113117
src/io_thread.h:532: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
114-
Done processing src/io_thread.h
115-
Total errors found: 108
116118

samples/codelite-sample/simple.def

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
src/*
22
1
3+
4
4+
Done processing src/pptable.cpp
5+
Done processing src/pptable.h
6+
Total errors found: 684
7+
38
src/pptable.cpp:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5]
49
src/pptable.cpp:1: Include the directory when naming .h files [build/include_subdir] [4]
510
src/pptable.cpp:6: { should almost always be at the end of the previous line [whitespace/braces] [4]
@@ -601,7 +606,6 @@ src/pptable.cpp:660: Tab found; better to use spaces [whitespace/tab] [1]
601606
src/pptable.cpp:661: Tab found; better to use spaces [whitespace/tab] [1]
602607
src/pptable.cpp:662: Tab found; better to use spaces [whitespace/tab] [1]
603608
src/pptable.cpp:663: Tab found; better to use spaces [whitespace/tab] [1]
604-
Done processing src/pptable.cpp
605609
src/pptable.h:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5]
606610
src/pptable.h:1: #ifndef header guard has wrong style, please use: SAMPLES_CODELITE_SAMPLE_SRC_PPTABLE_H_ [build/header_guard] [5]
607611
src/pptable.h:131: #endif line should be "#endif // SAMPLES_CODELITE_SAMPLE_SRC_PPTABLE_H_" [build/header_guard] [5]
@@ -685,6 +689,4 @@ src/pptable.h:127: Tab found; better to use spaces [whitespace/tab] [1]
685689
src/pptable.h:128: Tab found; better to use spaces [whitespace/tab] [1]
686690
src/pptable.h:129: Tab found; better to use spaces [whitespace/tab] [1]
687691
src/pptable.h:131: At least two spaces is best between code and comments [whitespace/comments] [2]
688-
Done processing src/pptable.h
689-
Total errors found: 684
690692

samples/protobuf-sample/simple.def

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
src/*
22
1
3+
5
4+
Done processing src/descriptor.pb.cc
5+
Done processing src/descriptor.pb.h
6+
Done processing src/descriptor_unittest.cc
7+
Total errors found: 2656
8+
39
src/descriptor.pb.cc:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5]
410
src/descriptor.pb.cc:9: Found C system header after C++ system header. Should be: descriptor.pb.h, c system, c++ system, other. [build/include_order] [4]
511
src/descriptor.pb.cc:10: Found C system header after C++ system header. Should be: descriptor.pb.h, c system, c++ system, other. [build/include_order] [4]
@@ -1630,7 +1636,6 @@ src/descriptor.pb.cc:15146: Lines should be <= 80 characters long [whitespace/
16301636
src/descriptor.pb.cc:15150: Lines should be <= 80 characters long [whitespace/line_length] [2]
16311637
src/descriptor.pb.cc:15155: Lines should be <= 80 characters long [whitespace/line_length] [2]
16321638
src/descriptor.pb.cc:5: samples/protobuf-sample/src/descriptor.pb.cc should include its header file samples/protobuf-sample/src/descriptor.pb.h [build/include] [5]
1633-
Done processing src/descriptor.pb.cc
16341639
src/descriptor.pb.h:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5]
16351640
src/descriptor.pb.h:4: #ifndef header guard has wrong style, please use: SAMPLES_PROTOBUF_SAMPLE_SRC_DESCRIPTOR_PB_H_ [build/header_guard] [5]
16361641
src/descriptor.pb.h:7714: #endif line should be "#endif // SAMPLES_PROTOBUF_SAMPLE_SRC_DESCRIPTOR_PB_H_" [build/header_guard] [5]
@@ -2462,7 +2467,6 @@ src/descriptor.pb.h:7697: Lines should be <= 80 characters long [whitespace/li
24622467
src/descriptor.pb.h:7699: Lines should be <= 80 characters long [whitespace/line_length] [2]
24632468
src/descriptor.pb.h:7702: Lines should be <= 80 characters long [whitespace/line_length] [2]
24642469
src/descriptor.pb.h:7704: Lines should be <= 80 characters long [whitespace/line_length] [2]
2465-
Done processing src/descriptor.pb.h
24662470
src/descriptor_unittest.cc:40: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
24672471
src/descriptor_unittest.cc:43: Found C system header after C++ system header. Should be: descriptor_unittest.h, c system, c++ system, other. [build/include_order] [4]
24682472
src/descriptor_unittest.cc:44: Found C system header after C++ system header. Should be: descriptor_unittest.h, c system, c++ system, other. [build/include_order] [4]
@@ -2658,6 +2662,4 @@ src/descriptor_unittest.cc:5125: Closing ) should be moved to the previous line
26582662
src/descriptor_unittest.cc:5929: Single-parameter constructors should be marked explicit. [runtime/explicit] [5]
26592663
src/descriptor_unittest.cc:5968: Single-parameter constructors should be marked explicit. [runtime/explicit] [5]
26602664
src/descriptor_unittest.cc:6486: Redundant blank line at the end of a code block should be deleted. [whitespace/blank_line] [3]
2661-
Done processing src/descriptor_unittest.cc
2662-
Total errors found: 2656
26632665

samples/silly-sample/filters.def

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
--counting=toplevel --filter=-whitespace,-build/include_what_you_use src/*.cpp
22
1
3+
6
4+
Done processing src/sillycode.cpp
5+
Category 'legal' errors found: 1
6+
Category 'readability' errors found: 5
7+
Category 'runtime' errors found: 12
8+
Total errors found: 18
9+
310
src/sillycode.cpp:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5]
411
src/sillycode.cpp:9: Is this a non-const reference? If so, make const or use a pointer: vector<string>& v [runtime/references] [2]
512
src/sillycode.cpp:35: If/else bodies with multiple statements require braces [readability/braces] [4]
@@ -18,9 +25,4 @@ src/sillycode.cpp:203: Static/global string variables are not permitted. [runt
1825
src/sillycode.cpp:222: Static/global string variables are not permitted. [runtime/string] [4]
1926
src/sillycode.cpp:223: Using C-style cast. Use reinterpret_cast<double*>(...) instead [readability/casting] [4]
2027
src/sillycode.cpp:238: Using C-style cast. Use reinterpret_cast<derived2*>(...) instead [readability/casting] [4]
21-
Done processing src/sillycode.cpp
22-
Category 'legal' errors found: 1
23-
Category 'readability' errors found: 5
24-
Category 'runtime' errors found: 12
25-
Total errors found: 18
2628

samples/silly-sample/simple.def

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
src/*.cpp
22
1
3+
3
4+
Done processing src/sillycode.cpp
5+
Total errors found: 106
6+
37
src/sillycode.cpp:0: No copyright message found. You should have a line: "Copyright [year] <Copyright Owner>" [legal/copyright] [5]
48
src/sillycode.cpp:3: public: should be indented +1 space inside class Date [whitespace/indent] [3]
59
src/sillycode.cpp:9: Is this a non-const reference? If so, make const or use a pointer: vector<string>& v [runtime/references] [2]
@@ -106,6 +110,4 @@ src/sillycode.cpp:252: Tab found; better to use spaces [whitespace/tab] [1]
106110
src/sillycode.cpp:252: At least two spaces is best between code and comments [whitespace/comments] [2]
107111
src/sillycode.cpp:255: Empty loop bodies should use {} or continue [whitespace/empty_loop_body] [5]
108112
src/sillycode.cpp:255: At least two spaces is best between code and comments [whitespace/comments] [2]
109-
Done processing src/sillycode.cpp
110-
Total errors found: 106
111113

samples/vlc-sample/simple.def

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
src/*
22
1
3+
5
4+
Done processing src/libvlc.c
5+
Done processing src/libvlc.h
6+
Done processing src/missing.c
7+
Total errors found: 619
8+
39
src/libvlc.c:37: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
410
src/libvlc.c:41: Found C system header after other header. Should be: libvlc.h, c system, c++ system, other. [build/include_order] [4]
511
src/libvlc.c:47: Found C system header after other header. Should be: libvlc.h, c system, c++ system, other. [build/include_order] [4]
@@ -371,7 +377,6 @@ src/libvlc.c:627: Missing space before ( in if( [whitespace/parens] [5]
371377
src/libvlc.c:629: Extra space after ( in function call [whitespace/parens] [4]
372378
src/libvlc.c:629: Extra space before ) [whitespace/parens] [2]
373379
src/libvlc.c:640: { should almost always be at the end of the previous line [whitespace/braces] [4]
374-
Done processing src/libvlc.c
375380
src/libvlc.h:0: No #ifndef header guard found, suggested CPP variable is: SAMPLES_VLC_SAMPLE_SRC_LIBVLC_H_ [build/header_guard] [5]
376381
src/libvlc.h:34: Extra space before ( in function call [whitespace/parens] [4]
377382
src/libvlc.h:35: Extra space before ( in function call [whitespace/parens] [4]
@@ -427,7 +432,6 @@ src/libvlc.h:223: Extra space before ( in function call [whitespace/parens] [4
427432
src/libvlc.h:224: Extra space before ( in function call [whitespace/parens] [4]
428433
src/libvlc.h:224: Extra space before ) [whitespace/parens] [2]
429434
src/libvlc.h:229: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
430-
Done processing src/libvlc.h
431435
src/missing.c:36: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
432436
src/missing.c:44: Extra space before ( in function call [whitespace/parens] [4]
433437
src/missing.c:45: { should almost always be at the end of the previous line [whitespace/braces] [4]
@@ -621,6 +625,4 @@ src/missing.c:399: Extra space before ( in function call [whitespace/parens] [
621625
src/missing.c:400: { should almost always be at the end of the previous line [whitespace/braces] [4]
622626
src/missing.c:401: Extra space before ( in function call [whitespace/parens] [4]
623627
src/missing.c:404: Uncommented text after #endif is non-standard. Use a comment. [build/endif_comment] [5]
624-
Done processing src/missing.c
625-
Total errors found: 619
626628

0 commit comments

Comments
 (0)