public String outPath(String outDir, String testName) {
    String ret = (new File(outDir, testName)).getPath();
    // List of configurations. Currently the list consists of hadoop version and execution mode only
    List<String> configs = new ArrayList<String>();
    configs.add(miniClusters.getClusterType().getQOutFileExtensionPostfix());

    Deque<String> stack = new LinkedList<String>();
    StringBuilder sb = new StringBuilder();
    sb.append(testName);
    stack.push(sb.toString());

    // example file names are input1.q.out_mr_0.17 or input2.q.out_0.17
    for (String s : configs) {
      sb.append('_');
      sb.append(s);
      stack.push(sb.toString());
    }
    while (stack.size() > 0) {
      String fileName = stack.pop();
      File f = new File(outDir, fileName);
      if (f.exists()) {
        ret = f.getPath();
        break;
      }
    }
    return ret;
  }
Given the current configurations (e.g., hadoop version and execution mode), return
the correct file name to compare with the current test run output.

@param outDir   The directory where the reference log files are stored.
@param testName The test file name (terminated by ".out").
@return The file name appended with the configuration values if it exists.
itests/util/src/main/java/org/apache/hadoop/hive/ql/QTestUtil.java