<commit_before>start_xml_results() {
  cat >/tmp/results.xml.$$ << EOF
<?xml version="1.0" encoding="UTF-8"?>
  <testsuite tests="TOTALTESTS" name="FreeNAS QA Tests">
EOF
}

#          $1 = true/false
#          $2 = error message
#  $CLASSNAME = Sub class of test results
#   $TESTNAME = Specific test name
# $TESTSTDOUT = stdout file of test results
# $TESTSTDERR = stderr file of test results
add_xml_result() {

  # If called when no tests have been setup, we can safely return
  if [ -z "$TESTNAME" ] ; then return 0 ; fi

  if [ -n "$TIMESTART" -a "$TIMESTART" != "0" ] ; then
    TIMEEND=`date +%s`
    TIMEELAPSED=`expr $TIMEEND - $TIMESTART`
  fi

  if [ "$1" = "true" ] ; then
    cat >>/tmp/results.xml.$$ << EOF
    <testcase classname="$CLASSNAME" name="$TESTNAME" time="$TIMEELAPSED">
EOF
  elif [ "$1" = "skipped" ] ; then
    cat >>/tmp/results.xml.$$ << EOF
    <testcase classname="$CLASSNAME" name="$TESTNAME"><skipped/>
EOF
  else
    # Failed!
    cat >>/tmp/results.xml.$$ << EOF
    <testcase classname="$CLASSNAME" name="$TESTNAME" time="$TIMEELAPSED">
        <failure type="failure">$2</failure>
EOF
  fi

  # Optional stdout / stderr logs
  if [ -n "$TESTSTDOUT" -a -e "$TESTSTDOUT" ] ; then
    echo "         <system-out>`cat $TESTSTDOUT | sed 's|<||g' | sed 's|>||g' | awk '{printf "%s<br>",$0} END {print ""}' | tr -d '\r\n'`</system-out>" >> /tmp/results.xml.$$
  fi
  if [ -n "$TESTSTDERR" -a -e "$TESTSTDERR" ] ; then
    echo "         <system-err>`cat $TESTSTDERR | sed 's|<||g' | sed 's|>||g' | awk '{printf "%s<br>",$0} END {print ""}' | tr -d '\r\n'`</system-err>" >> /tmp/results.xml.$$
  fi

  # Close the error tag
  cat >>/tmp/results.xml.$$ << EOF
    </testcase>
EOF

  unset TESTNAME TESTSTDOUT TESTSTDERR
}

finish_xml_results() {<commit_msg>Disable stdout / stderr of tests until we can determine why it breaks XML parsing<commit_after>start_xml_results() {
  cat >/tmp/results.xml.$$ << EOF
<?xml version="1.0" encoding="UTF-8"?>
  <testsuite tests="TOTALTESTS" name="FreeNAS QA Tests">
EOF
}

#          $1 = true/false
#          $2 = error message
#  $CLASSNAME = Sub class of test results
#   $TESTNAME = Specific test name
# $TESTSTDOUT = stdout file of test results
# $TESTSTDERR = stderr file of test results
add_xml_result() {

  # If called when no tests have been setup, we can safely return
  if [ -z "$TESTNAME" ] ; then return 0 ; fi

  if [ -n "$TIMESTART" -a "$TIMESTART" != "0" ] ; then
    TIMEEND=`date +%s`
    TIMEELAPSED=`expr $TIMEEND - $TIMESTART`
  fi

  if [ "$1" = "true" ] ; then
    cat >>/tmp/results.xml.$$ << EOF
    <testcase classname="$CLASSNAME" name="$TESTNAME" time="$TIMEELAPSED">
EOF
  elif [ "$1" = "skipped" ] ; then
    cat >>/tmp/results.xml.$$ << EOF
    <testcase classname="$CLASSNAME" name="$TESTNAME"><skipped/>
EOF
  else
    # Failed!
    cat >>/tmp/results.xml.$$ << EOF
    <testcase classname="$CLASSNAME" name="$TESTNAME" time="$TIMEELAPSED">
        <failure type="failure">$2</failure>
EOF
  fi

# Optional stdout / stderr logs
#  if [ -n "$TESTSTDOUT" -a -e "$TESTSTDOUT" ] ; then
#   echo "         <system-out>`cat $TESTSTDOUT | sed 's|<||g' | sed 's|>||g' | awk '{printf "%s<br>",$0} END {print ""}' | tr -d '\r\n'`</system-out>" >> /tmp/results.xml.$$
#  fi
#  if [ -n "$TESTSTDERR" -a -e "$TESTSTDERR" ] ; then
#    echo "         <system-err>`cat $TESTSTDERR | sed 's|<||g' | sed 's|>||g' | awk '{printf "%s<br>",$0} END {print ""}' | tr -d '\r\n'`</system-err>" >> /tmp/results.xml.$$
#  fi

  # Close the error tag
  cat >>/tmp/results.xml.$$ << EOF
    </testcase>
EOF

  unset TESTNAME TESTSTDOUT TESTSTDERR
}

finish_xml_results() {
{'fraction_non_alphanumeric': 0.19375171279802686, 'fraction_numerical': 0.006577144423129624, 'mean_word_length': 3.161915621436716, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 2, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 22}, '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': '1989196', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1326, 'n_words': 363}