<commit_before>#!/bin/bash

project=${1:-"openstack/compute-hyperv"}
tests_dir=${2:-"/opt/stack/tempest"}
parallel_tests=${3:-8}
max_attempts=${4:-3}
test_suite=${5:-"default"}
log_file=${6:-"/home/ubuntu/tempest/subunit-output.log"}
results_html_file=${7:-"/home/ubuntu/tempest/results.html"}
tempest_output_file="/home/ubuntu/tempest/tempest-output.log"
subunit_stats_file="/home/ubuntu/tempest/subunit_stats.log"
TEMPEST_DIR="/home/ubuntu/tempest"

basedir="/home/ubuntu/bin"

project_name=$(basename $project)

mkdir -p $TEMPEST_DIR

pushd $basedir

. $basedir/utils.sh

echo "Activating virtual env."
set +u
source $tests_dir/.tox/full/bin/activate
set -u

tests_file=$(tempfile)
$basedir/get-tests.sh $tests_dir > $tests_file

echo "Started running tests."

if [ ! -d "$tests_dir/.testrepository" ]; then
    push_dir
    cd $tests_dir
    echo "Initializing testr"
    testr init
    pop_dir
fi

$basedir/parallel-test-runner.sh $tests_file $tests_dir $log_file \
    $parallel_tests $max_attempts || true

rm $tests_file

isolated_tests_list_file=$basedir/isolated-tests.txt
if [ -f "$isolated_tests_list_file" ]; then
    echo "Running isolated tests from: $isolated_tests_list_file"
    isolated_tests_file=$(tempfile)
    $basedir/get-isolated-tests.sh $tests_dir > $isolated_tests_file
    log_tmp=$(tempfile)
    $basedir/parallel-test-runner.sh $isolated_tests_file $tests_dir $log_tmp \
        $parallel_tests $max_attempts 1 || true
    cp $log_tmp /home/ubuntu/tempest/isolated-tests-output.log
    cat $log_tmp >> $log_file
    rm $isolated_tests_file
    rm $log_tmp
fi

echo "Generating HTML report..."
python $basedir/subunit2html.py $log_file $results_html_file

cat $log_file | subunit-trace -n -f > $tempest_output_file 2>&1 || true

subunit-stats $log_file > $subunit_stats_file
exit_code=$?

echo "Total execution time: $SECONDS seconds."

popd

exit $exit_code
<commit_msg>Fix formatting of results.html<commit_after>#!/bin/bash

project=${1:-"openstack/compute-hyperv"}
tests_dir=${2:-"/opt/stack/tempest"}
parallel_tests=${3:-8}
max_attempts=${4:-3}
test_suite=${5:-"default"}
log_file=${6:-"/home/ubuntu/tempest/subunit-output.log"}
results_html_file=${7:-"/home/ubuntu/tempest/results.html"}
tempest_output_file="/home/ubuntu/tempest/tempest-output.log"
subunit_stats_file="/home/ubuntu/tempest/subunit_stats.log"
TEMPEST_DIR="/home/ubuntu/tempest"

basedir="/home/ubuntu/bin"

project_name=$(basename $project)

mkdir -p $TEMPEST_DIR

pushd $basedir

. $basedir/utils.sh

echo "Activating virtual env."
set +u
source $tests_dir/.tox/full/bin/activate
set -u

tests_file=$(tempfile)
$basedir/get-tests.sh $tests_dir > $tests_file

echo "Started running tests."

if [ ! -d "$tests_dir/.testrepository" ]; then
    push_dir
    cd $tests_dir
    echo "Initializing testr"
    testr init
    pop_dir
fi

$basedir/parallel-test-runner.sh $tests_file $tests_dir $log_file \
    $parallel_tests $max_attempts || true

rm $tests_file

isolated_tests_list_file=$basedir/isolated-tests.txt
if [ -f "$isolated_tests_list_file" ]; then
    echo "Running isolated tests from: $isolated_tests_list_file"
    isolated_tests_file=$(tempfile)
    $basedir/get-isolated-tests.sh $tests_dir > $isolated_tests_file
    log_tmp=$(tempfile)
    $basedir/parallel-test-runner.sh $isolated_tests_file $tests_dir $log_tmp \
        $parallel_tests $max_attempts 1 || true
    cp $log_tmp /home/ubuntu/tempest/isolated-tests-output.log
    cat $log_tmp >> $log_file
    rm $isolated_tests_file
    rm $log_tmp
fi

echo "Generating HTML report..."
$basedir/get-results-html.sh $log_file $results_html_file

cat $log_file | subunit-trace -n -f > $tempest_output_file 2>&1 || true

subunit-stats $log_file > $subunit_stats_file
exit_code=$?

echo "Total execution time: $SECONDS seconds."

popd

exit $exit_code

{'fraction_non_alphanumeric': 0.13757861635220126, 'fraction_numerical': 0.006551362683438155, 'mean_word_length': 4.836391437308868, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '1342101', 'n_tokens_mistral': 1473, 'n_tokens_neox': 1397, 'n_words': 252}