3131
3232"""Command Line interface integration test for cpplint.py."""
3333
34+ import glob
3435import os
36+ import platform
3537import sys
3638import subprocess
3739import unittest
3840import shutil
3941import tempfile
42+
4043from testfixtures import compare
4144
4245BASE_CMD = sys .executable + ' ' + os .path .abspath ('./cpplint.py ' )
@@ -58,6 +61,7 @@ def RunShellCommand(cmd, cwd='.'):
5861 stderr = stderr_target )
5962 out , err = proc .communicate ()
6063
64+ # TODO: These transforms break testing of Windows --output=sed.
6165 # Make output system-agnostic, aka support Windows
6266 if os .sep == '\\ ' :
6367 out , err = out .replace (b'\\ ' , b'/' ), err .replace (b'\\ ' , b'/' )
@@ -132,8 +136,21 @@ def _checkDef(self, path):
132136 with open (path , 'rb' ) as filehandle :
133137 datalines = filehandle .readlines ()
134138 stdoutLines = int (datalines [2 ])
139+ filenames = datalines [0 ].decode ('utf8' ).strip ()
140+ args , _ , filenames = filenames .rpartition (" " )
141+ if '--output=sed' in args and platform .system () == 'Windows' :
142+ # TODO: Testing of Windows --output=sed is either broken
143+ # by the transforms in `RunShellCommand`.
144+ return
145+ if '*' in filenames :
146+ rel_cwd = os .path .dirname (path )
147+ filenames = ' ' .join (
148+ filename [len (rel_cwd )+ 1 :]
149+ for filename in glob .glob (rel_cwd + '/' + filenames )
150+ )
151+ args += ' ' + filenames
135152 self ._runAndCheck (path ,
136- datalines [ 0 ]. decode ( 'utf8' ). strip () ,
153+ args ,
137154 int (datalines [1 ]),
138155 [line .decode ('utf8' ).strip () for line in datalines [3 :3 + stdoutLines ]],
139156 [line .decode ('utf8' ).strip () for line in datalines [3 + stdoutLines :]])
0 commit comments