コード例 #1
0
def fixFileExpectingNoChange(file):
  command, infile, outfile, status, stdout = fixFileHelper(file)
  if status != 0:
    return 1
  status, stdout, stderr = runCommand('diff ' + outfile + ' ' + infile)
  if status != 0:
    logging.error(file + ': expected file to remain unchanged')
    return 1
  return 0
コード例 #2
0
def fixFileExpectingSuccess(file, extra_input_files=None):
  command, infile, outfile, status, stdout = fixFileHelper(file,
                                                           extra_input_files=extra_input_files)
  if status != 0:
    print("FAILED: " + infile)
    emitStdoutAsError(stdout)
    return 1
  status, stdout, stderr = runCommand('diff ' + outfile + ' ' + infile + '.gold')
  if status != 0:
    print("FAILED: " + infile)
    emitStdoutAsError(stdout + stderr)
    return 1
  return 0
コード例 #3
0
def Diff(result_file, golden_file):
  """Execute diff command with unified form

  Args:
    result_file: result proto file
    golden_file: golden proto file

  Returns:
    output and status code
  """
  command = 'diff -u '
  command += result_file + ' '
  command += golden_file
  status, stdout, stderr = runCommand(command)
  return [status, stdout, stderr]
コード例 #4
0
def runCheckFormat(operation, filename):
  command = check_format + " " + operation + " " + filename
  status, stdout, stderr = runCommand(command)
  return (command, status, stdout + stderr)
コード例 #5
0
def runCheckFormat(operation, filename):
    command = check_spelling + " --test-ignore-exts " + operation + " " + filename
    status, stdout, stderr = runCommand(command)
    return (command, status, stdout + stderr)