From 86d2b0555ee09d648c8d7373b0a9a4acdcb344e0 Mon Sep 17 00:00:00 2001 From: Léo Gourdin Date: Fri, 6 Nov 2020 12:05:53 +0100 Subject: Preparing the repo for debugging postpass and executing tests --- test/aarch64/asmb_aarch64_gen_test.sh | 106 --------------------- test/aarch64/c/arith_print.c | 19 ++++ test/aarch64/gen_tests/asmb_aarch64_gen_test.sh | 106 +++++++++++++++++++++ .../aarch64/postpass_tests/postpass_exec_c_test.sh | 36 +++++++ 4 files changed, 161 insertions(+), 106 deletions(-) delete mode 100755 test/aarch64/asmb_aarch64_gen_test.sh create mode 100644 test/aarch64/c/arith_print.c create mode 100755 test/aarch64/gen_tests/asmb_aarch64_gen_test.sh create mode 100755 test/aarch64/postpass_tests/postpass_exec_c_test.sh (limited to 'test/aarch64') diff --git a/test/aarch64/asmb_aarch64_gen_test.sh b/test/aarch64/asmb_aarch64_gen_test.sh deleted file mode 100755 index f816204e..00000000 --- a/test/aarch64/asmb_aarch64_gen_test.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/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" -CCOMP_REF="../../../CompCert_master/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 diff --git a/test/aarch64/c/arith_print.c b/test/aarch64/c/arith_print.c new file mode 100644 index 00000000..d404a151 --- /dev/null +++ b/test/aarch64/c/arith_print.c @@ -0,0 +1,19 @@ +int main() +{ + int num1 = 2; + int num2 = 4; + int sum, sub, mult, mod; + float div; + + /* + * Perform all arithmetic operations + */ + sum = num1 + num2; + sub = num1 - num2; + mult = num1 * num2; + div = (float)num1 / num2; + mod = num1 % num2; + + printf("%d", sum + sub + mult + div + mod); + return; +} diff --git a/test/aarch64/gen_tests/asmb_aarch64_gen_test.sh b/test/aarch64/gen_tests/asmb_aarch64_gen_test.sh new file mode 100755 index 00000000..660ff7aa --- /dev/null +++ b/test/aarch64/gen_tests/asmb_aarch64_gen_test.sh @@ -0,0 +1,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_aarch64-ref/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 diff --git a/test/aarch64/postpass_tests/postpass_exec_c_test.sh b/test/aarch64/postpass_tests/postpass_exec_c_test.sh new file mode 100755 index 00000000..73422990 --- /dev/null +++ b/test/aarch64/postpass_tests/postpass_exec_c_test.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +CLEAN=0 +WOFF=0 +SRC="" +while getopts ':cwi:' 'OPTKEY'; do + case ${OPTKEY} in + c) CLEAN=1;; + w) WOFF=1;; + i) SRC=${OPTARG};; + esac +done + +CCOMP="../../../ccomp -static" + +if [ $WOFF -eq 1 ] +then + CCOMP="${CCOMP} -w" +fi + +BNAME=$(basename -s .c $SRC) +SNAME="$BNAME".s +SREFNAME="$BNAME"_ref.s +ENAME="$BNAME" +EREFNAME="$BNAME"_ref +./$CCOMP -S $SRC -o $SNAME +./$CCOMP -fno-postpass -S $SRC -o $SREFNAME +./$CCOMP $SRC -o $ENAME +./$CCOMP -fno-postpass $SRC -o $EREFNAME + +#diff -I '^//*' -y $SNAME $SREFNAME + +if [ $CLEAN -eq 1 ] +then + rm $SNAME $SREFNAME $ENAME $EREFNAME +fi -- cgit