<commit_before>def call(body) {
  def config = [:]
  body.resolveStrategy = Closure.DELEGATE_FIRST
  body.delegate = config
  body()

  def FILES_TO_ARCHIVE = [
    "**/*.log", "**/out.*", "**/*py.out.txt", "**/java*out.txt", "**/*ipynb.out.txt",
    "**/results/*", "**/*tmp_model*",
    "**/h2o-py/tests/testdir_dynamic_tests/testdir_algos/glm/Rsandbox*/*.csv",
    "**/tests.txt", "**/*lib_h2o-flow_build_js_headless-test.js.out.txt",
    "**/*.code", "**/package_version_check_out.txt"
  ]

  if (config.archiveFiles == null) {
    config.archiveFiles = true
  }

  if (config.hasJUnit == null) {
    config.hasJUnit = true
  }

  if (config.h2o3dir == null) {
    config.h2o3dir = 'h2o-3'
  }

  try {
    execMake(config.target, config.h2o3dir)
  } finally {
    if (config.hasJUnit) {
      junit testResults: "${config.h2o3dir}/**/test-results/*.xml", allowEmptyResults: true, keepLongStdio: true
    }
    if (config.archiveFiles) {
      archiveArtifacts artifacts: FILES_TO_ARCHIVE.collect{"${config.h2o3dir}/${it}"}.join(', '), allowEmptyArchive: true
    }
  }
}

def execMake(target, String h2o3dir) {
  sh """
    export JAVA_HOME=/usr/lib/jvm/java-8-oracle
    locale

    echo "Activating Python ${env.PYTHON_VERSION}"
    . /envs/h2o_env_python${env.PYTHON_VERSION}/bin/activate

    echo "Activating R ${env.R_VERSION}"
    activate_R_${env.R_VERSION}

    cd ${h2o3dir}
    echo "Linking small and bigdata"
    rm -f smalldata
    ln -s -f /home/0xdiag/smalldata
    rm -f bigdata
    ln -s -f /home/0xdiag/bigdata

    # The Gradle fails if there is a special character, in these variables
    unset CHANGE_AUTHOR_DISPLAY_NAME
    unset CHANGE_TITLE

    echo "Running Make"
    make -f docker/Makefile.jenkins ${target}
  """
}

return this
<commit_msg>[ITA-88] Post-process the test results xml files (#1702)<commit_after>def call(body) {
  def config = [:]
  body.resolveStrategy = Closure.DELEGATE_FIRST
  body.delegate = config
  body()

  def FILES_TO_ARCHIVE = [
    "**/*.log", "**/out.*", "**/*py.out.txt", "**/java*out.txt", "**/*ipynb.out.txt",
    "**/results/*", "**/*tmp_model*",
    "**/h2o-py/tests/testdir_dynamic_tests/testdir_algos/glm/Rsandbox*/*.csv",
    "**/tests.txt", "**/*lib_h2o-flow_build_js_headless-test.js.out.txt",
    "**/*.code", "**/package_version_check_out.txt"
  ]

  if (config.archiveFiles == null) {
    config.archiveFiles = true
  }

  if (config.hasJUnit == null) {
    config.hasJUnit = true
  }

  if (config.h2o3dir == null) {
    config.h2o3dir = 'h2o-3'
  }

  try {
    execMake(config.target, config.h2o3dir)
  } finally {
    if (config.hasJUnit) {
      def findCmd = "find ${config.h2o3dir} -type f -name '*.xml'"
      def replaceCmd = "${findCmd} -exec sed -i 's/&#8;//g' {} +"
      echo "Post-processing following test result files:"
      sh findCmd
      sh replaceCmd
      junit testResults: "${config.h2o3dir}/**/test-results/*.xml", allowEmptyResults: true, keepLongStdio: true
    }
    if (config.archiveFiles) {
      archiveArtifacts artifacts: FILES_TO_ARCHIVE.collect{"${config.h2o3dir}/${it}"}.join(', '), allowEmptyArchive: true
    }
  }
}

def execMake(target, String h2o3dir) {
  sh """
    export JAVA_HOME=/usr/lib/jvm/java-8-oracle
    locale

    echo "Activating Python ${env.PYTHON_VERSION}"
    . /envs/h2o_env_python${env.PYTHON_VERSION}/bin/activate

    echo "Activating R ${env.R_VERSION}"
    activate_R_${env.R_VERSION}

    cd ${h2o3dir}
    echo "Linking small and bigdata"
    rm -f smalldata
    ln -s -f /home/0xdiag/smalldata
    rm -f bigdata
    ln -s -f /home/0xdiag/bigdata

    # The Gradle fails if there is a special character, in these variables
    unset CHANGE_AUTHOR_DISPLAY_NAME
    unset CHANGE_TITLE

    echo "Running Make"
    make -f docker/Makefile.jenkins ${target}
  """
}

return this

{'fraction_non_alphanumeric': 0.16199947657681235, 'fraction_numerical': 0.013870714472651138, 'mean_word_length': 3.1052631578947367, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6601442', 'n_tokens_mistral': 1505, 'n_tokens_neox': 1461, 'n_words': 276}