<commit_before>#!/bin/zsh

./setup.sh

C_UTILS=/tmp/exm-install/c-utils
TURBINE=/tmp/exm-install/turbine
STC=/tmp/exm-install/stc
MPICH=/tmp/mpich-install
path+=( $MPICH/bin $TURBINE/bin $STC/bin )

set -x

printenv

ls /tmp/mpich-install/lib

LDFLAGS="-L$MPICH/lib -lmpl"                \
./configure --prefix=$TURBINE               \
            --with-tcl=/usr                 \
            --with-mpi=$MPICH               \
            --with-c-utils=$C_UTILS         \
            --with-adlb=/tmp/exm-install/lb \
            --enable-shared
make clean

# echo "Setting exit values to 0 instead of 1"
# cd tests;
# grep "exit 1" *.sh
# sed -i 's/exit 1/echo "SOMETHING_BAD";exit 0/g' *.sh
# grep "exit 1" *.sh
# cd ..;

make V=1

make test_results
# Make should always return 0 under Jenkins even if a test failed
# We inpect test results below

cd tests
SUITE_RESULT="result_aggregate.xml";
rm -fv $SUITE_RESULT

echo "<testsuites>" >> $SUITE_RESULT
for result in *.result
do
    cat $result | grep "SOMETHING_BAD" > /dev/null
    #if [[ $? == 0 ]]
    #then
    #    echo "$result : result is BAD "
    #else
    #    echo "$result : result is GOOD "
    #fi
    cat $result | grep "SOMETHING_BAD" >/dev/null
    CODE=${?};
    if [[ ${CODE} == 0 ]]
    then
        echo "    <testcase name=\"${result}\" >"     >> $SUITE_RESULT
        echo "        <failure type=\"generic\">"     >> $SUITE_RESULT
        echo "Result file contents:"                  >> $SUITE_RESULT
        cat $result                                   >> $SUITE_RESULT
        echo ""                                       >> $SUITE_RESULT
        echo ""                                       >> $SUITE_RESULT
        echo "Out file contents:"                     >> $SUITE_RESULT
        echo "<![CDATA["                              >> $SUITE_RESULT
        cat ${result%.result}.out                     >> $SUITE_RESULT
        echo "]]>"                                    >> $SUITE_RESULT
        echo "        </failure> "                    >> $SUITE_RESULT
        echo "    </testcase>" >> $SUITE_RESULT
    else
        echo "    <testcase name=\"${result}\" />"    >> $SUITE_RESULT
    fi
done
echo "</testsuites>" >> $SUITE_RESULT<commit_msg>New attempt at error detection<commit_after>#!/bin/zsh

./setup.sh

C_UTILS=/tmp/exm-install/c-utils
TURBINE=/tmp/exm-install/turbine
STC=/tmp/exm-install/stc
MPICH=/tmp/mpich-install
path+=( $MPICH/bin $TURBINE/bin $STC/bin )

set -x

# printenv

ls /tmp/mpich-install/lib

LDFLAGS="-L$MPICH/lib -lmpl"                \
./configure --prefix=$TURBINE               \
            --with-tcl=/usr                 \
            --with-mpi=$MPICH               \
            --with-c-utils=$C_UTILS         \
            --with-adlb=/tmp/exm-install/lb \
            --enable-shared
make clean

make V=1

make test_results
# Make should always return 0 under Jenkins even if a test failed
# We inpect test results below

cd tests
SUITE_RESULT="result_aggregate.xml";
rm -fv $SUITE_RESULT

inspect_results()
{
  print "<testsuites>"
  for result in *.result
  do
    grep "ERROR" ${result} > /dev/null
    CODE=${?}

    if [[ ${CODE} == 0 ]]
    then
      # We found ERROR
      print "    <testcase name=\"${result}\" >"
      print "        <failure type=\"generic\">"
      print "Result file contents:"
      cat $result
      print ""
      print ""
      print "Out file contents:"
      print "<![CDATA["
      cat ${result%.result}.out
      print "]]>"
      print "        </failure> "
      print "    </testcase>"
    else
      # Success:
      print "    <testcase name=\"${result}\" />"
    fi
  done
  print "</testsuites>"
}

inspect_results > ${SUITE_RESULT}
{'fraction_non_alphanumeric': 0.14258760107816712, 'fraction_numerical': 0.003504043126684636, 'mean_word_length': 1.6319148936170214, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6163070', 'n_tokens_mistral': 1264, 'n_tokens_neox': 1197, 'n_words': 281}