int checkBackupPathForRepair() throws IOException {
    if (cfg.backupPath == null) {
      SecureRandom random = new SecureRandom();
      long randomLong = random.nextLong();
      cfg.backupPath = "/tmp/" + BACKUP_DIR_PREFIX + randomLong;
    }

    StoragePath backupPath = new StoragePath(cfg.backupPath);
    if (metaClient.getStorage().exists(backupPath)
        && metaClient.getStorage().listDirectEntries(backupPath).size() > 0) {
      LOG.error(String.format("Cannot use backup path %s: it is not empty", cfg.backupPath));
      return -1;
    }

    return checkBackupPathAgainstBasePath();
  }
@Test
  public void testCheckBackupPathForRepair() throws IOException {
    for (Arguments arguments: configPathParamsWithFS().collect(Collectors.toList())) {
      Object[] args = arguments.get();
      String backupPath = (String) args[0];
      String basePath = (String) args[1];
      int expectedResult = (Integer) args[2];

      HoodieRepairTool.Config config = new HoodieRepairTool.Config();
      config.backupPath = backupPath;
      config.basePath = basePath;
      HoodieRepairTool tool = new HoodieRepairTool(jsc, config);
      assertEquals(expectedResult, tool.checkBackupPathForRepair());
      if (backupPath == null) {
        // Backup path should be created if not provided
        assertNotNull(config.backupPath);
      }
    }
  }