public void overwriteResults(String inFileName, String outFileName) throws Exception {
    // This method can be replaced with Files.copy(source, target, REPLACE_EXISTING)
    // once Hive uses JAVA 7.
    System.out.println("Overwriting results " + inFileName + " to " + outFileName);
    int result = executeCmd(new String[]{
        "cp", getQuotedString(inFileName), getQuotedString(outFileName) }).getReturnCode();
    if (result != 0) {
      throw new IllegalStateException("Unexpected error while overwriting " + inFileName + " with " + outFileName);
    }
  }
Operations present in a given file/test.
itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestResultProcessor.java