aboutsummaryrefslogtreecommitdiffstats
path: root/test/mppa/instr
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2019-01-17 13:45:42 +0100
committerCyril SIX <cyril.six@kalray.eu>2019-01-17 13:45:42 +0100
commit1848a8f4c08ef55a045d4dc1e78f517182a50442 (patch)
treebc1d3147c2db76b962c8fa3682ac5dd1e4e6cd3a /test/mppa/instr
parent15c5ca037eabb9891f7880bc2d517982ba34e769 (diff)
parentfe3fc2fd3d5a312ac526c5596e851e315782d9f6 (diff)
downloadcompcert-kvx-1848a8f4c08ef55a045d4dc1e78f517182a50442.tar.gz
compcert-kvx-1848a8f4c08ef55a045d4dc1e78f517182a50442.zip
Merge branch 'mppa_k1c' into mppa_postpass
Diffstat (limited to 'test/mppa/instr')
-rw-r--r--test/mppa/instr/Makefile56
-rw-r--r--test/mppa/instr/framework.h3
2 files changed, 31 insertions, 28 deletions
diff --git a/test/mppa/instr/Makefile b/test/mppa/instr/Makefile
index 9d1fbb5f..66e40365 100644
--- a/test/mppa/instr/Makefile
+++ b/test/mppa/instr/Makefile
@@ -1,15 +1,18 @@
K1CC ?= k1-mbr-gcc
CC ?= gcc
CCOMP ?= ccomp
-CFLAGS ?= -O2
+OPTIM ?= -O2
+CFLAGS ?= $(OPTIM) -Wl,--wrap=printf
SIMU ?= k1-mppa
-TIMEOUT ?= --signal=SIGTERM 60s
+TIMEOUT ?= --signal=SIGTERM 120s
DIR=./
SRCDIR=$(DIR)
OUTDIR=$(DIR)/out
BINDIR=$(DIR)/bin
ASMDIR=$(DIR)/asm
+LIB=../lib/system.x86-gcc.a
+K1LIB=../lib/system.gcc.a
##
# Intended flow : .c -> .gcc.s -> .gcc.bin -> .gcc.out
@@ -21,7 +24,7 @@ CCPATH=$(shell which $(CC))
CCOMPPATH=$(shell which $(CCOMP))
SIMUPATH=$(shell which $(SIMU))
-TESTNAMES=$(notdir $(subst .c,,$(wildcard $(DIR)/*.c)))
+TESTNAMES?=$(notdir $(subst .c,,$(wildcard $(DIR)/*.c)))
X86_GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .x86-gcc.out,$(TESTNAMES)))
GCC_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .gcc.out,$(TESTNAMES)))
CCOMP_OUT=$(addprefix $(OUTDIR)/,$(addsuffix .ccomp.out,$(TESTNAMES)))
@@ -37,16 +40,20 @@ BIN=$(addprefix $(BINDIR)/,$(addsuffix .x86-gcc.bin,$(TESTNAMES)))\
all: $(BIN)
+GREEN=\033[0;32m
+RED=\033[0;31m
+NC=\033[0m
+
.PHONY:
test: $(X86_GCC_OUT) $(GCC_OUT)
@echo "Comparing x86 gcc output to k1 gcc.."
@for test in $(TESTNAMES); do\
x86out=$(OUTDIR)/$$test.x86-gcc.out;\
gccout=$(OUTDIR)/$$test.gcc.out;\
- if ! diff $$x86out $$gccout; then\
- >&2 echo "ERROR: $$x86out and $$gccout differ";\
+ if diff -q $$x86out $$gccout > /dev/null; test $${PIPESTATUS[0]} -ne 0; then\
+ >&2 printf "$(RED)ERROR: $$x86out and $$gccout differ$(NC)\n";\
else\
- echo "GOOD: $$x86out and $$gccout concur";\
+ printf "$(GREEN)GOOD: $$x86out and $$gccout concur$(NC)\n";\
fi;\
done
@@ -56,10 +63,10 @@ check: $(GCC_OUT) $(CCOMP_OUT)
@for test in $(TESTNAMES); do\
gccout=$(OUTDIR)/$$test.gcc.out;\
ccompout=$(OUTDIR)/$$test.ccomp.out;\
- if ! diff $$ccompout $$gccout; then\
- >&2 echo "ERROR: $$ccompout and $$gccout differ";\
+ if diff -q $$ccompout $$gccout > /dev/null; test $${PIPESTATUS[0]} -ne 0; then\
+ >&2 printf "$(RED)ERROR: $$ccompout and $$gccout differ$(NC)\n";\
else\
- echo "GOOD: $$ccompout and $$gccout concur";\
+ printf "$(GREEN)GOOD: $$ccompout and $$gccout concur$(NC)\n";\
fi;\
done
@@ -68,20 +75,13 @@ check: $(GCC_OUT) $(CCOMP_OUT)
##
.SECONDARY:
-# Generating output
+$(LIB):
+ (cd $(dir $(LIB)) && make)
-## Version sans les timeout
-#$(OUTDIR)/%.x86-gcc.out: $(BINDIR)/%.x86-gcc.bin
-# @mkdir -p $(@D)
-# ./$< > $@; echo $$? >> $@
-#
-#$(OUTDIR)/%.gcc.out: $(BINDIR)/%.gcc.bin $(SIMUPATH)
-# @mkdir -p $(@D)
-# $(SIMU) -- $< > $@ ; echo $$? >> $@
-#
-#$(OUTDIR)/%.ccomp.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH)
-# @mkdir -p $(@D)
-# $(SIMU) -- $< > $@ ; echo $$? >> $@
+$(K1LIB):
+ (cd $(dir $(LIB)) && make)
+
+# Generating output
## Version avec timeout
$(OUTDIR)/%.x86-gcc.out: $(BINDIR)/%.x86-gcc.bin
@@ -98,17 +98,17 @@ $(OUTDIR)/%.ccomp.out: $(BINDIR)/%.ccomp.bin $(SIMUPATH)
# Assembly to binary
-$(BINDIR)/%.x86-gcc.bin: $(ASMDIR)/%.x86-gcc.s $(CCPATH)
+$(BINDIR)/%.x86-gcc.bin: $(ASMDIR)/%.x86-gcc.s $(LIB) $(CCPATH)
@mkdir -p $(@D)
- $(CC) $(CFLAGS) $< -o $@
+ $(CC) $(CFLAGS) $(filter-out $(CCPATH),$^) -o $@
-$(BINDIR)/%.gcc.bin: $(ASMDIR)/%.gcc.s $(K1CCPATH)
+$(BINDIR)/%.gcc.bin: $(ASMDIR)/%.gcc.s $(K1LIB) $(K1CCPATH)
@mkdir -p $(@D)
- $(K1CC) $(CFLAGS) $< -o $@
+ $(K1CC) $(CFLAGS) $(filter-out $(K1CCPATH),$^) -o $@
-$(BINDIR)/%.ccomp.bin: $(ASMDIR)/%.ccomp.s $(CCOMPPATH)
+$(BINDIR)/%.ccomp.bin: $(ASMDIR)/%.ccomp.s $(K1LIB) $(CCOMPPATH)
@mkdir -p $(@D)
- $(CCOMP) $(CFLAGS) $< -o $@
+ $(CCOMP) $(CFLAGS) $(filter-out $(CCOMPPATH),$^) -o $@
# Source to assembly
diff --git a/test/mppa/instr/framework.h b/test/mppa/instr/framework.h
index 52ba97bc..f43ec616 100644
--- a/test/mppa/instr/framework.h
+++ b/test/mppa/instr/framework.h
@@ -3,6 +3,8 @@
#include "../prng/prng.c"
+int printf(const char *, ...);
+
#define BEGIN_TEST_N(type, N)\
int main(void){\
type t[N], c, i, j, S;\
@@ -28,6 +30,7 @@
/* In between BEGIN_TEST and END_TEST : definition of c */
#define END_TEST()\
+ printf("%llu\n", c);\
S += c;\
}\
return S;\