constantPropagationTest.sh 1.34 KB
Newer Older
1
2
3
#!/bin/bash

VALID_EXAMPLES=(
4
                 "/propagation"
5
                 "/evaluation"
6
7
                )

8
9
VALID_EXAMPLES_SRC_DIR="./src/test/custom/valid/constantPropagation"
ASSEMBLY_OUTPUT_DIR="./log/assembly/constantPropagation"
10
11
12

mkdir log
mkdir $ASSEMBLY_OUTPUT_DIR
13
14

# counters to represent the total number of test files to be processed
15
TOTAL_COUNT=$(find "${VALID_EXAMPLES[@]/#/${VALID_EXAMPLES_SRC_DIR}}" -name "*.wacc" | wc -l)
16
17
COUNTER=0

18
19
20
21
22
for folder in ${VALID_EXAMPLES[@]}; do
  ASSEMBLY_OUTPUT_VALID_FOLDER="${ASSEMBLY_OUTPUT_DIR}${folder}"
  mkdir $ASSEMBLY_OUTPUT_VALID_FOLDER
  for file in $(find "${VALID_EXAMPLES_SRC_DIR}${folder}" -name "*.wacc")
  do
23
    FILE_NAME=$(basename "${file%.*}")
24
25
26
27
    EXECUTABLE_FILE_NAME="${ASSEMBLY_OUTPUT_VALID_FOLDER}/${FILE_NAME}"
    echo $file
    ./compile -t -o1 $file > "${EXECUTABLE_FILE_NAME}.log.txt"

28
29
30
     if diff "${EXECUTABLE_FILE_NAME}.log.txt" "${VALID_EXAMPLES_SRC_DIR}${folder}/${FILE_NAME}.log" -I scope; then
       (( COUNTER += 1 ))
     fi
31
32
33


    echo "$COUNTER / $(($TOTAL_COUNT)) files have been executed"
34
35
36
37
38
39
  done

  echo "========================================================================================"
  echo "Test Folder" $folder "has been processed" "($COUNTER / $(($TOTAL_COUNT)))"
  echo "========================================================================================"
done