<commit_before>#!/usr/bin/env bash
set -eo pipefail
scriptDir=$(cd $(dirname $0); pwd) # works on mac osx too
rootDir=$scriptDir/..

# NOTE: This script requires ducttape to be in PATH
# (see Makefile)

echo >&2 $PATH
DUCTTAPE=$(which ducttape)

tutorialDir=$(cd $rootDir/tutorial; pwd)
for tape in $tutorialDir/*.tape; do
    dir=$(dirname $tape)
    basefile=$(basename $tape .tape)
    customSh=$dir/$basefile.sh
    if [ -e $customSh ]; then
        # Run via the custom script, which may give additional arguments such as a .conf file
        CMD=$customSh
    else
        # Just directly execute the .tape file with ducttape
        CMD="$DUCTTAPE $tape"
    fi
    output=$(mktemp -d $tape.XXXXXX)
    echo "==================="
    echo "Running test: $CMD"
    echo "Output: $output"
    echo "==================="
    cd $dir
    $CMD -y -O $output

    # Remove output, if test was successful
    rm -rf $output
done<commit_msg>More helpful directory names in regression testing<commit_after>#!/usr/bin/env bash
set -eo pipefail
scriptDir=$(cd $(dirname $0); pwd) # works on mac osx too
rootDir=$scriptDir/..

# NOTE: This script requires ducttape to be in PATH
# (see Makefile)

echo >&2 $PATH
DUCTTAPE=$(which ducttape)

tutorialDir=$(cd $rootDir/tutorial; pwd)
for tape in $tutorialDir/*.tape; do
    dir=$(dirname $tape)
    basefile=$(basename $tape .tape)
    customSh=$dir/$basefile.sh
    if [ -e $customSh ]; then
        # Run via the custom script, which may give additional arguments such as a .conf file
        CMD=$customSh
    else
        # Just directly execute the .tape file with ducttape
        CMD="$DUCTTAPE $tape"
    fi
    output=$(mktemp -d tmp.regression.$tape.XXXXXX)
    echo "==================="
    echo "Running test: $CMD"
    echo "Output: $output"
    echo "==================="
    cd $dir
    $CMD -y -O $output

    # Remove output, if test was successful
    rm -rf $output
done
{'fraction_non_alphanumeric': 0.15320910973084886, 'fraction_numerical': 0.002070393374741201, 'mean_word_length': 3.1040339702760087, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4506410', 'n_tokens_mistral': 652, 'n_tokens_neox': 620, 'n_words': 215}