<commit_before>#!/bin/bash
set -o pipefail

function invoke-test() {
    local RUNDIR=$(mktemp -d)
    cd "$RUNDIR"
    echo "RUNDIR: $RUNDIR"

    the-test
    local SUCCESS=$?
    
    [[ $SUCCESS -eq 0 ]] && echo "PASSED" || echo "FAILED"

    if [[ "$@" == *stop* ]]; then
        bash -i
    fi

    rm -rf "$RUNDIR"
    exit $SUCCESS
}

function invoke-all() {
    local TESTDIR="$1"
    local PASSED_COUNT=0
    local FAILED_COUNT=0
    
    if [[ -z "$LOGFILE" ]]; then
        local LOGFILE="/dev/null"
    fi

    for test in $(ls $TESTDIR); do
        [[ "$(basename $test)" == "all.sh" ]] && continue
        
        [[ -s "$LOGFILE" ]] && echo >>"$LOGFILE"
        echo "=== TEST: $(basename $TESTDIR)/$test - $(date -Imin) ===" >>"$LOGFILE"
        >&2 echo -n "TEST: $test... "
        "$SCRIPT_DIR/$test" |& cat >>"$LOGFILE"
        
        if [[ $? -eq 0 ]]; then
            echo "PASSED"
            (( PASSED_COUNT++ ))
        else
            echo "FAILED"
            (( FAILED_COUNT++ ))
        fi
    done

    echo "PASSED: $PASSED_COUNT FAILED: $FAILED_COUNT"
    exit $FAILED_COUNT
}<commit_msg>Trace test execution<commit_after>#!/bin/bash
set -o pipefail

function invoke-test() {
    local RUNDIR=$(mktemp -d)
    cd "$RUNDIR"
    echo "RUNDIR: $RUNDIR"

    # define prefix character for test tracing
    # -> a character different than '+' allows for easier tracing of the git
    #    command under test
    PS4="==> "
    
    set -x
    the-test
    local SUCCESS=$?
    set +x
    
    [[ $SUCCESS -eq 0 ]] && echo "PASSED" || echo "FAILED"

    if [[ "$@" == *stop* ]]; then
        bash -i
    fi

    rm -rf "$RUNDIR"
    exit $SUCCESS
}

function invoke-all() {
    local TESTDIR="$1"
    local PASSED_COUNT=0
    local FAILED_COUNT=0
    
    if [[ -z "$LOGFILE" ]]; then
        local LOGFILE="/dev/null"
    fi

    for test in $(ls $TESTDIR); do
        [[ "$(basename $test)" == "all.sh" ]] && continue
        
        [[ -s "$LOGFILE" ]] && echo >>"$LOGFILE"
        echo "=== TEST: $(basename $TESTDIR)/$test - $(date -Imin) ===" >>"$LOGFILE"
        >&2 echo -n "TEST: $test... "
        "$SCRIPT_DIR/$test" |& cat >>"$LOGFILE"
        
        if [[ $? -eq 0 ]]; then
            echo "PASSED"
            (( PASSED_COUNT++ ))
        else
            echo "FAILED"
            (( FAILED_COUNT++ ))
        fi
    done

    echo "PASSED: $PASSED_COUNT FAILED: $FAILED_COUNT"
    exit $FAILED_COUNT
}
{'fraction_non_alphanumeric': 0.17121891561353444, 'fraction_numerical': 0.005299633102323685, 'mean_word_length': 1.8668224299065421, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '1595240', 'n_tokens_mistral': 878, 'n_tokens_neox': 858, 'n_words': 225}