<commit_before>#!/usr/bin/env bash

trunkdir=$1
logfile=$2

if [ -z "$trunkdir" ] || [ -z "$logfile" ]; then
  echo "Usage: $0 trunkdir logfile (where logfile should be an absolute path, not a relative one)"
  exit 1
fi

# A mktemp command that works on mac/bsd and linux.
tmpdir=`mktemp -d -t tmp.XXXXXXXX` || exit 1

# Change directory to the directory that preparetest.py is in.
cd $trunkdir

python preparetest.py -tr $tmpdir
cd $tmpdir

python utf.py -T -m nm >$logfile 2>&1

result=$?

rm -rf $tmpdir

if [ "$result" != "0" ]; then
  echo "utf nm tests didn't run properly"
  exit 1
fi

#The words that indicate something went wrong in utf are "FAIL" and "ERROR".
FAILURE_WORDS="FAIL ERROR"

for word in `echo $FAILURE_WORDS`; do
  if [ ! -z "`grep -F \"$word\" $logfile`" ]; then
    echo "Encountered failure word '$word' in logfile."
    exit 1
  fi
done

#TODO(sjs25): Add a Count functionality to UTF
#(commented code left here intentionally)
#SUCCESS_STRING=" tests passed, 0 tests failed"

#if [ -z "`grep -F \"$SUCCESS_STRING\" $logfile`" ]; then
 # echo "Did not find success string '$SUCCESS_STRING' in logfile."
 # exit 1
#fi
<commit_msg>Minor changes to continuousbuild/tests/run_nodemanager_tests.sh to stop it from spitting out extra output.<commit_after>#!/usr/bin/env bash

trunkdir=$1
logfile=$2

if [ -z "$trunkdir" ] || [ -z "$logfile" ]; then
  echo "Usage: $0 trunkdir logfile (where logfile should be an absolute path, not a relative one)"
  exit 1
fi

# A mktemp command that works on mac/bsd and linux.
tmpdir=`mktemp -d -t tmp.XXXXXXXX` || exit 1

# Change directory to the directory that preparetest.py is in.
cd $trunkdir

python preparetest.py -tr $tmpdir > /dev/null
cd $tmpdir

python utf.py -T -m nm >$logfile 2>&1

result=$?

rm -rf $tmpdir

if [ "$result" != "0" ]; then
  echo "utf nm tests didn't run properly"
  exit 1
fi

#The words that indicate something went wrong in utf are "FAIL" and "ERROR".
FAILURE_WORDS="FAIL ERROR"

for word in `echo $FAILURE_WORDS`; do
  if [ ! -z "`grep -F \"$word\" $logfile`" ]; then
    echo "Encountered failure word '$word' in logfile."
    exit 1
  fi
done

#TODO(sjs25): Add a Count functionality to UTF
#(commented code left here intentionally)
#SUCCESS_STRING=" tests passed, 0 tests failed"

#if [ -z "`grep -F \"$SUCCESS_STRING\" $logfile`" ]; then
 # echo "Did not find success string '$SUCCESS_STRING' in logfile."
 # exit 1
#fi

{'fraction_non_alphanumeric': 0.12712215320910972, 'fraction_numerical': 0.011594202898550725, 'mean_word_length': 3.7559055118110236, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '362188', 'n_tokens_mistral': 876, 'n_tokens_neox': 835, 'n_words': 336}