217
217
# Specifying None means: any output is accepted
219
219
if actual is None:
220
test_case.fail('Unexpected: %s' % actual)
220
test_case.fail('We expected output: %r, but found None'
221
222
matching = self.output_checker.check_output(
222
223
expected, actual, self.check_options)
290
291
inputs.append(self._read_input(None, in_name))
291
292
except IOError, e:
292
if e.errno == errno.ENOENT:
293
# Some filenames are illegal on Windows and generate EINVAL
294
# rather than just saying the filename doesn't exist
295
if e.errno in (errno.ENOENT, errno.EINVAL):
294
297
'%s: No such file or directory\n' % (in_name,))
295
299
# Basically cat copy input to output
296
300
output = ''.join(inputs)
297
301
# Handle output redirections
299
303
output = self._write_output(output, out_name, out_mode)
300
304
except IOError, e:
301
if e.errno == errno.ENOENT:
305
# If out_name cannot be created, we may get 'ENOENT', however if
306
# out_name is something like '', we can get EINVAL
307
if e.errno in (errno.ENOENT, errno.EINVAL):
302
308
return 1, None, '%s: No such file or directory\n' % (out_name,)
303
310
return 0, output, None
305
312
def do_echo(self, test_case, input, args):
306
313
(in_name, out_name, out_mode, args) = _scan_redirection_options(args)
308
raise SyntaxError('Specify parameters OR use redirection')
315
raise SyntaxError('echo doesn\'t read from stdin')
310
317
input = ' '.join(args)
312
input = self._read_input(input, in_name)
314
if e.errno == errno.ENOENT:
315
return 1, None, '%s: No such file or directory\n' % (in_name,)
316
318
# Always append a \n'
322
324
output = self._write_output(output, out_name, out_mode)
323
325
except IOError, e:
324
if e.errno == errno.ENOENT:
326
if e.errno in (errno.ENOENT, errno.EINVAL):
325
327
return 1, None, '%s: No such file or directory\n' % (out_name,)
326
329
return 0, output, None
328
331
def _get_jail_root(self, test_case):