<commit_before>#!/bin/bash
#
# statserver.sh - Worker script for load testing the server
#
# Project: BluebirdCRM
# Author: <NAME>
# Organization: New York State Senate
# Date: 2011-12-02
# Revised: 2011-12-02
#
prog=`basename $0`
bin_dir=`dirname $0`
root_dir=$bin_dir/../
config_file=$root_dir/config.ini
tests_file=$root_dir/resources/tests.ini

usage () {
  echo "Usage: $prog user requests"
}

if [ ! $# -eq 2 ]; then
  usage
  exit 1
fi

worker="Worker $1"; shift;
count=$1; shift;

# Load up the test configuration section
eval `sed -e 's/[[:space:]]*\=[[:space:]]*/=/g' \
    -e 's/;.*$//' \
    -e 's/[[:space:]]*$//' \
    -e 's/^[[:space:]]*//' \
    -e "s/^\(.*\)=\([^\"']*\)$/\1=\"\2\"/" \
   < $config_file \
    | sed -n -e "/^\[test\]/,/^\s*\[/{/^[^;].*\=.*/p;}"`

tests=(`cat $tests_file | grep '\[[A-Za-z0-9_ \-]\+\]' | sed -e 's/^\[\([A-Za-z0-9_ \-]\+\)\].*/\1/' | sed -e ':a;N;$!ba;s/\n/ /g'`)
for ((i=0; i<${#tests[*]}; i++)); do
    args=`sed \
        -e 's/[[:space:]]*\=[[:space:]]*/=/g' \
        -e 's/;.*$//' \
        -e 's/[[:space:]]*$//' \
        -e 's/^[[:space:]]*//' \
        -e "s/^\(.*\)=\([^\"']*\)$/-d \1=\2/" \
       < $tests_file | sed -n -e "/^\[${tests[$i]}\]/,/^\s*\[/{/^[^;].*\=.*/p;}" | sed ':a;N;$!ba;s/\n/ /g'`
    urls[$i]="curl -i -s --user $user:$pass --url $url $args"
done

for ((i=0; i<$count; i++)); do
    index=`expr $RANDOM % 9`
    output=`${urls[$index]} | grep "HTTP/1.1" | sed -e "s/HTTP\/1.1 \([0-9]\+\).*/\1/"`
    printf "[$worker] Running %-15s: %s\n" "${tests[$index]}" "$output"
done<commit_msg>Changed grep on HTTP header to print of first line of HTTP response.<commit_after>#!/bin/bash
#
# statserver.sh - Worker script for load testing the server
#
# Project: BluebirdCRM
# Author: <NAME>
# Organization: New York State Senate
# Date: 2011-12-02
# Revised: 2011-12-02
#
prog=`basename $0`
bin_dir=`dirname $0`
root_dir=$bin_dir/../
config_file=$root_dir/config.ini
tests_file=$root_dir/resources/tests.ini

usage () {
  echo "Usage: $prog user requests"
}

if [ ! $# -eq 2 ]; then
  usage
  exit 1
fi

worker="Worker $1"; shift;
count=$1; shift;

# Load up the test configuration section
eval `sed -e 's/[[:space:]]*\=[[:space:]]*/=/g' \
    -e 's/;.*$//' \
    -e 's/[[:space:]]*$//' \
    -e 's/^[[:space:]]*//' \
    -e "s/^\(.*\)=\([^\"']*\)$/\1=\"\2\"/" \
   < $config_file \
    | sed -n -e "/^\[test\]/,/^\s*\[/{/^[^;].*\=.*/p;}"`

tests=(`cat $tests_file | grep '\[[A-Za-z0-9_ \-]\+\]' | sed -e 's/^\[\([A-Za-z0-9_ \-]\+\)\].*/\1/' | sed -e ':a;N;$!ba;s/\n/ /g'`)
for ((i=0; i<${#tests[*]}; i++)); do
    args=`sed \
        -e 's/[[:space:]]*\=[[:space:]]*/=/g' \
        -e 's/;.*$//' \
        -e 's/[[:space:]]*$//' \
        -e 's/^[[:space:]]*//' \
        -e "s/^\(.*\)=\([^\"']*\)$/-d \1=\2/" \
       < $tests_file | sed -n -e "/^\[${tests[$i]}\]/,/^\s*\[/{/^[^;].*\=.*/p;}" | sed ':a;N;$!ba;s/\n/ /g'`
    urls[$i]="curl -i -s --user $user:$pass --url $url $args"
done

for ((i=0; i<$count; i++)); do
    index=`expr $RANDOM % 9`
    output=`${urls[$index]} | head -1`
    printf "[$worker] Running %-15s: %s\n" "${tests[$index]}" "$output"
done
{'fraction_non_alphanumeric': 0.34161886551943915, 'fraction_numerical': 0.025493945188017845, 'mean_word_length': 2.4156692056583244, 'pattern_counts': {'":': 0, '<': 13, '<?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': '6225622', 'n_tokens_mistral': 1508, 'n_tokens_neox': 1429, 'n_words': 287}