aboutsummaryrefslogtreecommitdiffstats
path: root/test/aarch64/gen_tests/asmb_aarch64_gen_test.sh
blob: 38235f14f3c2ca3fb1ac2b7617355c654c0e647f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash

CLEAN=0
WOFF=0
while getopts ':cw' 'OPTKEY'; do
  case ${OPTKEY} in
    c) CLEAN=1;;
    w) WOFF=1;;
  esac
done

DIRS=(
  ../c/*.c       # Special simple tests
  #../../c/*.c 
  ../../clightgen/*.c
  #../../compression/*.c
  ../../cse2/*.c

  # Monniaux test directory
  ../../monniaux/binary_search/*.c
  ../../monniaux/complex/*.c
  #../../monniaux/crypto-algorithms/*.c                    # Warnings
  ../../monniaux/cse2/*.c
  #../../monniaux/des/*.c                                  # Unsupported feature?
  ../../monniaux/expect/*.c
  ../../monniaux/fill_buffer/*.c
  ../../monniaux/genann/*.c
  #../../monniaux/heptagon_radio_transmitter/*.c           # Warnings
  ../../monniaux/idea/*.c
  ../../monniaux/jumptable/*.c
  ../../monniaux/licm/*.c
  ../../monniaux/longjmp/*.c
  ../../monniaux/loop/*.c
  ../../monniaux/lustrev4_lustrec_heater_control/*.c
  ../../monniaux/lustrev4_lv4_heater_control/*.c
  ../../monniaux/lustrev4_lv6-en-2cgc_heater_control/*.c
  #../../monniaux/lustrev6-carlightV2/*.c                  # Warnings
  #../../monniaux/lustrev6-convertible-2cgc/*.c            # Unsupported feature?
  #../../monniaux/lustrev6-convertible-en-2cgc/*.c
  #../../monniaux/lustrev6-convertible/*.c                 # Warnings
  ../../monniaux/madd/*.c
  #../../monniaux/math/*.c                                 # Unsupported feature?
  ../../monniaux/memcpy/*.c
  #../../monniaux/micro-bunzip/*.c                         # Warnings
  ../../monniaux/moves/*.c
  ../../monniaux/multithreaded_volatile/*.c
  ../../monniaux/nand/*.c
  #../../monniaux/ncompress/*.c                            # Warnings
  ../../monniaux/number_theoretic_transform/*.c
  ../../monniaux/predicated/*.c
  ../../monniaux/regalloc/*.c
  ../../monniaux/rotate/*.c
  ../../monniaux/scheduling/*.c
  ../../monniaux/send_through/*.c
  ../../monniaux/tiny-AES-c/*.c
  ../../monniaux/varargs/*.c
  ../../monniaux/xor_and_mat/*.c
  #../../monniaux/zlib-1.2.11/*.c                          # Warnings
)
#FILES=../c/*.c
CCOMP_BBLOCKS="../../../ccomp -fno-postpass"
CCOMP_REF="../../../../CompCert_kvx/ccomp"
COUNT=0

if [ $WOFF -eq 1 ]
then
  CCOMP_BBLOCKS="${CCOMP_BBLOCKS} -w"
  CCOMP_REF="${CCOMP_REF} -w"
fi

for files in ${DIRS[@]}
do
  for f in $files
  do
    BNAME=$(basename -s .c $f)
    SNAME="$BNAME".s
    SREFNAME="$BNAME"_ref.s
    ./$CCOMP_BBLOCKS -S $f -o $SNAME
    ./$CCOMP_REF -dmach -S $f -o $SREFNAME
    #diff -I '^//*' <(cut -c-5 $SNAME) <(cut -c-5 $SREFNAME) > /dev/null 2>&1 
    diff -I '^//*' $SNAME $SREFNAME > /dev/null 2>&1 

    error=$?
    if [ $error -eq 0 ]
    then
      echo "[$BNAME] OK"
      COUNT=$((COUNT + 1))
    elif [ $error -eq 1 ]
    then
      echo "[$BNAME] FAIL"
      diff -I '^//*' -y $SNAME $SREFNAME
      exit 1
    else
      echo "[$BNAME] FAIL"
      echo "[WARNING] There was something wrong with the diff command !"
      exit 1
    fi
  done
done

echo "[TOTAL] $COUNT tests PASSED"

if [ $CLEAN -eq 1 ]
then
  rm *.s *.mach
fi