<commit_before>#!/usr/bin/env bash
#
# this script starts each sample's service and runs a sanity
# check test. this script is intended to be run as part of
# the project's CI process.
#

SCRIPT_DIR_NAME="$( cd "$( dirname "$0" )" && pwd )"

run_sample() {
    SAMPLE_DIR=$1
    UNIT_TESTS_DIR=$2
    echo "running tests for sample \"$SAMPLE_DIR\""

    pushd "$SCRIPT_DIR_NAME" >& /dev/null
    "./db_installer/installer.py" --delete=true --create=true
    SERVICE_DOT_PY=./$SAMPLE_DIR/service.py
    SERVICE_OUTPUT=$(mktemp)
    "$SERVICE_DOT_PY" >& "$SERVICE_OUTPUT" &
    SERVICE_PID=$!
    sleep 1
    ps --pid $SERVICE_PID >& /dev/null
    if [ $? -ne 0 ]; then
        echo "error starting \"$SERVICE_DOT_PY\". pre-req's installed?" >&2
        exit 1
    fi

    nosetests "$UNIT_TESTS_DIR"

    kill -INT $SERVICE_PID
    rm "$SERVICE_OUTPUT"
    "./db_installer/installer.py" --delete=true --create=true
    echo "finished tests for sample \"$SAMPLE_DIR\""
    popd >& /dev/null
}

run_crud_sample() {
    run_sample "crud/$1" crud
}

run_non_crud_sample() {
    run_sample "$1" "$1"
}<commit_msg>minor bug fix in test_all_samples.sh<commit_after>#!/usr/bin/env bash
#
# this script starts each sample's service and runs a sanity
# check test. this script is intended to be run as part of
# the project's CI process.
#

SCRIPT_DIR_NAME="$( cd "$( dirname "$0" )" && pwd )"

run_sample() {
    SAMPLE_DIR=$1
    UNIT_TESTS_DIR=$2
    echo "running tests for sample \"$SAMPLE_DIR\""

    pushd "$SCRIPT_DIR_NAME" >& /dev/null
    "./db_installer/installer.py" --delete=true --create=true
    SERVICE_DOT_PY=./$SAMPLE_DIR/service.py
    SERVICE_OUTPUT=$(mktemp)
    "$SERVICE_DOT_PY" >& "$SERVICE_OUTPUT" &
    SERVICE_PID=$!
    sleep 1
    ps --pid $SERVICE_PID >& /dev/null
    if [ $? -ne 0 ]; then
        echo "error starting \"$SERVICE_DOT_PY\". pre-req's installed?" >&2
        exit 1
    fi

    nosetests "$UNIT_TESTS_DIR"

    kill -INT $SERVICE_PID
    rm "$SERVICE_OUTPUT"
    "./db_installer/installer.py" --delete=true --create=false
    echo "finished tests for sample \"$SAMPLE_DIR\""
    popd >& /dev/null
}

run_crud_sample() {
    run_sample "crud/$1" crud
}

run_non_crud_sample() {
    run_sample "$1" "$1"
}
{'fraction_non_alphanumeric': 0.14700625558534405, 'fraction_numerical': 0.008936550491510277, 'mean_word_length': 3.070909090909091, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '2983830', 'n_tokens_mistral': 864, 'n_tokens_neox': 835, 'n_words': 202}