<commit_before>#!/bin/bash

#Created by Rafael on Apr 08 2016

#TODO --help

#************** Command line examples ************
#sh ./runner.sh --randoop-testclass=java.util.TreeSet --source-method=test001 --package-name=java.util

#sh ./runner.sh -rtc=java.util.TreeSet -sm=test001 -pn=java.util
#*************************************************

#************** Enable debug mode ****************
#set -x 
#*************************************************
for i in "$@"
do
case $i in
	-rtc=*|--randoop-testclass=*)
    randoop_testclass="${i#*=}"
    shift # past argument=value
    ;;        
    -sm=*|--source-method=*)
    source_method="${i#*=}"
    shift # past argument=value
    ;;
    -pn=*|--package-name=*)
    package_name=="${i#*=}"
    shift # past argument=value
    ;;
    -rod=*|--randoop-output-dir=*)
    randoop_output_dir="${i#*=}"
    shift # past argument=value
    ;;
    -pod=*|--porter-output-dir=*)
    porter_output_dir="${i#*=}"
    shift # past argument=value
    ;;
    -iid=*|--intruder-input-dir=*)
    intruder_input_dir="${i#*=}"
    shift # past argument=value
    ;;        
    -iod=*|--intruder-output-dir=*)
    intruder_output_dir="${i#*=}"
    shift # past argument=value
    ;;        
    *)
    ;;
esac
done


#** Validating arguments and Setting defaults ***

timelimit=10;
RegressionTest="RegressionTest0";
#TODO: implement loop to run several tests 

if [ ! "$randoop_output_dir" ]; then
  randoop_output_dir="./randoop-gen";
fi

if [ ! "$porter_output_dir" ]; then
  porter_output_dir="./porter-gen";
fi

if [ ! "$intruder_input_dir" ]; then
  intruder_input_dir="./indruder-input";
fi

if [ ! "$intruder_output_dir" ]; then
  intruder_output_dir="./indruder-report";
fi

#TODO: validate the rest of the arguments

#*************************************************



#********* Validating output directories *********
if [ ! -d "$randoop_output_dir" ]; then
	mkdir $randoop_output_dir;
fi

if [ ! -d "$porter_output_dir" ]; then
  mkdir $porter_output_dir;
fi

if [ ! -d "$intruder_input_dir" ]; then
  mkdir $intruder_input_dir;
fi

if [ ! -d "$intruder_output_dir" ]; then
  mkdir $intruder_output_dir;
fi
#*************************************************


echo "**********************************************************"
echo "*                  Running randoop                       *"
echo "**********************************************************"

java -classpath ./plume.jar:./porter.jar:./randoop.jar randoop.main.Main gentests --testclass=$randoop_testclass --timelimit=$timelimit --junit-output-dir=$randoop_output_dir

echo "**********************************************************"
echo "*                   Running porter                       *"
echo "**********************************************************"

java -jar porter.jar --source-file $randoop_output_dir/$RegressionTest.java --source-method $source_method --package-name $package_name --output-dir $porter_output_dir

echo "**********************************************************"
echo "*                      Compiling                         *"
echo "**********************************************************"


javac -cp .:intruder/lib/junit-4.11.jar randoop-gen/"$RegressionTest".java -d $intruder_input_dir

javac $randoop_output_dir/"$RegressionTest"Driver.java -d $intruder_input_dir

echo "**********************************************************"
echo "*                      Indruding                         *"
echo "**********************************************************"

#step 3.0 run intruder
java -ea -cp $INTRUDER_CLASSPATH:./intruder-ready intruder.wrapper.Main --user-specified-test "$RegressionTest"Driver.java -amen.runwolf "true" -amen.kappa "1" -intruder-output-dir $intruder_output_dir


<commit_msg>combining javac calls<commit_after>#!/bin/bash

#Created by Rafael on Apr 08 2016

#TODO --help

#************** Command line examples ************
#sh ./runner.sh --randoop-testclass=java.util.TreeSet --source-method=test001 --package-name=java.util

#sh ./runner.sh -rtc=java.util.TreeSet -sm=test001 -pn=java.util
#*************************************************

#************** Enable debug mode ****************
#set -x 
#*************************************************
for i in "$@"
do
case $i in
	-rtc=*|--randoop-testclass=*)
    randoop_testclass="${i#*=}"
    shift # past argument=value
    ;;        
    -sm=*|--source-method=*)
    source_method="${i#*=}"
    shift # past argument=value
    ;;
    -pn=*|--package-name=*)
    package_name=="${i#*=}"
    shift # past argument=value
    ;;
    -rod=*|--randoop-output-dir=*)
    randoop_output_dir="${i#*=}"
    shift # past argument=value
    ;;
    -pod=*|--porter-output-dir=*)
    porter_output_dir="${i#*=}"
    shift # past argument=value
    ;;
    -iid=*|--intruder-input-dir=*)
    intruder_input_dir="${i#*=}"
    shift # past argument=value
    ;;        
    -iod=*|--intruder-output-dir=*)
    intruder_output_dir="${i#*=}"
    shift # past argument=value
    ;;        
    *)
    ;;
esac
done


#** Validating arguments and Setting defaults ***

timelimit=10;
RegressionTest="RegressionTest0";
export CTRIGGER=OFF
export INTRUDER_CLASSPATH=./lib/sootall-2.3.0.jar:./lib/concurrent.jar:./lib/randoop.jar:./lib/tools.jar:./lib/collections.jar:./lib/jsr305-1.3.9.jar:./lib/junit-4.11.jar:./lib/amen.jar:./lib/geotools_r.jar:./lib/jts-1.8.jar

#TODO: implement loop to run several tests 

if [ ! "$randoop_output_dir" ]; then
  randoop_output_dir="randoop-gen";
fi

if [ ! "$porter_output_dir" ]; then
  porter_output_dir="porter-gen";
fi

if [ ! "$intruder_input_dir" ]; then
  intruder_input_dir="intruder-input";
fi

if [ ! "$intruder_output_dir" ]; then
  intruder_output_dir="intruder-report";
fi

#TODO: validate the rest of the arguments

#*************************************************



#********* Validating output directories *********
if [ ! -d "$randoop_output_dir" ]; then
	mkdir $randoop_output_dir;
fi

if [ ! -d "$porter_output_dir" ]; then
  mkdir $porter_output_dir;
fi

if [ ! -d "$intruder_input_dir" ]; then
  mkdir $intruder_input_dir;
fi

if [ ! -d "$intruder_output_dir" ]; then
  mkdir $intruder_output_dir;
fi
#*************************************************


echo "**********************************************************"
echo "*                  Running randoop                       *"
echo "**********************************************************"

java -classpath ./plume.jar:./porter.jar:./randoop.jar randoop.main.Main gentests --testclass=$randoop_testclass --timelimit=$timelimit --junit-output-dir=$randoop_output_dir

echo "**********************************************************"
echo "*                   Running porter                       *"
echo "**********************************************************"

java -jar porter.jar --source-file $randoop_output_dir/$RegressionTest.java --source-method $source_method --package-name $package_name --output-dir $porter_output_dir

echo "**********************************************************"
echo "*                      Compiling                         *"
echo "**********************************************************"


javac -cp .:intruder/lib/junit-4.11.jar $randoop_output_dir/"$RegressionTest".java $randoop_output_dir/"$RegressionTest"Driver.java -d $intruder_input_dir


#javac -cp .:intruder/lib/junit-4.11.jar randoop-gen/"$RegressionTest".java -d $intruder_input_dir


#javac -cp .:$intruder_input_dir/"$RegressionTest".class $randoop_output_dir/"$RegressionTest"Driver.java -d $intruder_input_dir

echo "**********************************************************"
echo "*                      Indruding                         *"
echo "**********************************************************"

cd intruder

#step 3.0 run intruder
java -ea -cp $INTRUDER_CLASSPATH:../intruder-ready intruder.wrapper.Main --user-specified-test ../$randoop_output_dir/"$RegressionTest"Driver.java -amen.runwolf "true" -amen.kappa "1" -intruder-output-dir ../$intruder_output_dir


cd ..
{'fraction_non_alphanumeric': 0.31238355483790836, 'fraction_numerical': 0.007328282200968823, 'mean_word_length': 3.850602409638554, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2693865', 'n_tokens_mistral': 2655, 'n_tokens_neox': 2455, 'n_words': 434}