Commit b41de23e authored by Andrea Gussoni's avatar Andrea Gussoni
Browse files

Modify matching scripts to use config.sh

parent 54ca0d01
......@@ -19,13 +19,13 @@ def get_change(current, previous):
return 100.0
# Function that takes as parameter a platform and computes averages and variance of the results, and saves them in two dedicated files (averages.dat and variances.dat)
def compute_matches(binaries_list, arch, output_name):
def compute_matches(binaries_list, arch, matching_folder, output_name):
average_list = []
average_dimension_list = []
for binary in binaries_list:
inputfile = 'result-' + arch + "/" + binary
inputfile = matching_folder + "/" + binary
print("Analyzing: " + inputfile)
with open(inputfile, 'r') as input:
data_dict = json.load(input)
......@@ -59,17 +59,19 @@ def main():
parser = argparse.ArgumentParser(description='My nice tool.')
parser.add_argument('binaries', metavar='BINARIESFILE', help='File containing the names of the binaries')
parser.add_argument('arch', metavar='ARCH', help='Architecture')
parser.add_argument('matching_folder', metavar='MATCHINGFOLDER', help='Folder containing matching information')
parser.add_argument('output_name', metavar='OUTPUT_NAME', help='Output Name')
args = parser.parse_args()
arch = args.arch
binaries = args.binaries
matching_folder = args.matching_folder
output_name = args.output_name
with open(binaries, 'r') as binaries_file:
binaries_list = [line.rstrip('\n') for line in binaries_file]
# Call the funciton that computes the results
compute_matches(binaries_list, arch, output_name)
compute_matches(binaries_list, arch, matching_folder, output_name)
if __name__ == "__main__":
main()
......@@ -5,20 +5,19 @@ if [ $# -eq 0 ]; then
exit 1
fi
basepath=$(pwd)
result_dir=$basepath/result-$1
arch=$1
if [ ! -d $result_dir ]; then
mkdir $result_dir;
fi
# Import the config
. ./config.sh
revng_dir=$basepath/workdir-$1/revng-json
ida_dir=$basepath/workdir-$1/ida-json-normalized
if [ ! -d $matching_dir ]; then
mkdir $matching_dir;
fi
cd $1
cd $arch
for filename in *
do
echo -e "\nAnalyzing binary: $filename"
$basepath/scripting/boundaries-comparison-scripts/compare-functions.py $ida_dir/$filename.stripped.json.ida $revng_dir/$filename.ll.isolated.json.revng $filename $result_dir/$filename $result_dir/$filename.matching
$matching_script_dir/compare-functions.py $ida_json_dir/$filename.stripped.json.ida $revng_json_dir/$filename.ll.isolated.json.revng $filename $matching_dir/$filename $matching_dir/$filename.matching
done;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment