<commit_before>#!/bin/bash
# testOne.sh functional test script $Revision$ # 1.10.2.1
# Call with test platform, test-program test-set [,options [,arguments]]
# test-set is a char usually 1-9 for the various .out files, usually use 1 for .out1
# e.g. "./testOne.sh pentium hello"
# or   "./testOne.sh sparc fibo 1 '' 10" 
# or   "./testOne.sh sparc switch_cc 6 '-Td -nG' '2 3 4 5 6'"
# Note: options and arguments are quoted strings
# $1 = platform $2 = test $3 = test-set $4 = options $5 = parameters to the recompiled executable
#
# 06 Feb 05 - Mike: Pass the test-set parameter to testOne.sh
# 24 Dec 05 - Gerard: Support for more than one switch added
# 29 Dec 05 - Gerard: Nicer output
#

echo $* > functest.res
rm -f functest/$2/$2.c

SPACES="                                                 "
RES="Result for $1"
WHITE=${SPACES:0:(18 - ${#RES})}
RES="$RES$WHITE $2:"
WHITE=${SPACES:0:(34 - ${#RES})}
RES=$RES$WHITE
echo -n -e "$RES"

sh -c "./boomerang -o functest $4 test/$1/$2 2>/dev/null >/dev/null"
ret=$?
if [[ ret -ge 128 ]]; then
	SIGNAL="signal $((ret-128))"
	if [ "$SIGNAL" = "signal 9" ]; then SIGNAL="a kill signal"; fi
	if [ "$SIGNAL" = "signal 11" ]; then SIGNAL="a segmentation fault"; fi
	if [ "$SIGNAL" = "signal 15" ]; then SIGNAL="a termination signal"; fi
	RESULT="Boomerang FAILED set $3 with $SIGNAL"
else
	if [[ ! -f functest/$2/$2.c ]]; then
		RESULT="NO BOOMERANG OUTPUT set $3!"
	else
		cp functest/$2/$2.c functest.c
		# if test/$1/$2.sed exists, use it to make "known error" corrections to the source code
		if [[ -f test/$1/$2.sed ]]; then
			echo Warning... $1/$2.sed used >> functest.res
			sed -f test/$1/$2.sed functest.c > functest.tmp
			ret=$?
			if [[ ret -ne 0 ]]; then
				echo test/$1/$2.sed FAILED! >> functest.res
				exit 10
			fi
			mv functest.tmp functest.c
		fi
		gcc -o functest.exe functest.c >> functest.res 2>&1
		if [[ $? != 0 ]]; then
			RESULT="Compile FAILED"
		else
			rm -f functest.out
			sh -c "./functest.exe $5 >> functest.out 2>&1"
			ret=$?
			if [[ ret -ge 128 ]]; then
				SIGNAL="signal $((ret-128))"<commit_msg>Handle clusters by concatenating all *.c output<commit_after>#!/bin/bash
# testOne.sh functional test script $Revision$ # 1.10.2.1
# Call with test platform, test-program test-set [,options [,arguments]]
# test-set is a char usually 1-9 for the various .out files, usually use 1 for .out1
# e.g. "./testOne.sh pentium hello"
# or   "./testOne.sh sparc fibo 1 '' 10" 
# or   "./testOne.sh sparc switch_cc 6 '-Td -nG' '2 3 4 5 6'"
# Note: options and arguments are quoted strings
# $1 = platform $2 = test $3 = test-set $4 = options $5 = parameters to the recompiled executable
#
# 06 Feb 05 - Mike: Pass the test-set parameter to testOne.sh
# 24 Dec 05 - Gerard: Support for more than one switch added
# 29 Dec 05 - Gerard: Nicer output
#

echo $* > functest.res
rm -f functest/$2/*

SPACES="                                                 "
RES="Result for $1"
WHITE=${SPACES:0:(18 - ${#RES})}
RES="$RES$WHITE $2:"
WHITE=${SPACES:0:(34 - ${#RES})}
RES=$RES$WHITE
echo -n -e "$RES"

sh -c "./boomerang -o functest $4 test/$1/$2 2>/dev/null >/dev/null"
ret=$?
if [[ ret -ge 128 ]]; then
	SIGNAL="signal $((ret-128))"
	if [ "$SIGNAL" = "signal 9" ]; then SIGNAL="a kill signal"; fi
	if [ "$SIGNAL" = "signal 11" ]; then SIGNAL="a segmentation fault"; fi
	if [ "$SIGNAL" = "signal 15" ]; then SIGNAL="a termination signal"; fi
	RESULT="Boomerang FAILED set $3 with $SIGNAL"
else
	if [[ ! -f functest/$2/$2.c ]]; then
		RESULT="NO BOOMERANG OUTPUT set $3!"
	else
		cat functest/$2/*.c > functest.c
		# if test/$1/$2.sed exists, use it to make "known error" corrections to the source code
		if [[ -f test/$1/$2.sed ]]; then
			echo Warning... $1/$2.sed used >> functest.res
			sed -f test/$1/$2.sed functest.c > functest.tmp
			ret=$?
			if [[ ret -ne 0 ]]; then
				echo test/$1/$2.sed FAILED! >> functest.res
				exit 10
			fi
			mv functest.tmp functest.c
		fi
		gcc -o functest.exe functest.c >> functest.res 2>&1
		if [[ $? != 0 ]]; then
			RESULT="Compile FAILED"
		else
			rm -f functest.out
			sh -c "./functest.exe $5 >> functest.out 2>&1"
			ret=$?
			if [[ ret -ge 128 ]]; then
				SIGNAL="signal $((ret-128))"
{'fraction_non_alphanumeric': 0.17051678971183615, 'fraction_numerical': 0.042867349368897356, 'mean_word_length': 2.867403314917127, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3127154', 'n_tokens_mistral': 1774, 'n_tokens_neox': 1567, 'n_words': 523}