aboutsummaryrefslogtreecommitdiffstats
path: root/test/mppa
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2018-04-11 16:28:49 +0200
committerCyril SIX <cyril.six@kalray.eu>2018-04-11 16:28:49 +0200
commitd407e23fe62ce837082820f777564c0050cf66c1 (patch)
tree1a3b3f260a61c7dcc2d096e0133a8b1dcc42a257 /test/mppa
parent1ecd47e848d3073c7317dc39c4fa72dbac66dd60 (diff)
downloadcompcert-kvx-d407e23fe62ce837082820f777564c0050cf66c1.tar.gz
compcert-kvx-d407e23fe62ce837082820f777564c0050cf66c1.zip
MPPA - Automatic generation of expected value for tests
Diffstat (limited to 'test/mppa')
-rw-r--r--test/mppa/Makefile9
-rw-r--r--test/mppa/general/branch.c1
-rw-r--r--test/mppa/general/branchz.c1
-rw-r--r--test/mppa/general/branchzu.c1
-rw-r--r--test/mppa/general/call.c2
-rw-r--r--test/mppa/general/for.c2
-rw-r--r--test/mppa/general/forvar.c2
-rw-r--r--test/mppa/general/forvarl.c2
-rw-r--r--test/mppa/general/output/branch.bin.exp1
-rw-r--r--test/mppa/general/output/branchz.bin.exp1
-rw-r--r--test/mppa/general/output/branchzu.bin.exp1
-rw-r--r--test/mppa/general/output/call.bin.exp1
-rw-r--r--test/mppa/general/output/for.bin.exp1
-rw-r--r--test/mppa/general/output/forvar.bin.exp1
-rw-r--r--test/mppa/general/output/forvarl.bin.exp1
-rw-r--r--test/mppa/general/output/simple.bin.exp1
-rw-r--r--test/mppa/general/simple.c2
-rw-r--r--test/mppa/generate.sh12
18 files changed, 32 insertions, 10 deletions
diff --git a/test/mppa/Makefile b/test/mppa/Makefile
index f8b3f68c..0e0b2eb2 100644
--- a/test/mppa/Makefile
+++ b/test/mppa/Makefile
@@ -23,10 +23,13 @@ $(DIR)/$(ASMDIR)/%.s: $(DIR)/%.c $(CCOMP)
@mkdir -p $(@D)
ccomp $(DEBUG) -O0 -v -S $< -o $@
-$(DIR)/$(BINDIR)/%.tok: $(DIR)/$(BINDIR)/%.bin
+$(DIR)/$(BINDIR)/%.tok: $(DIR)/$(BINDIR)/%.bin $(DIR)/output/%.bin.exp
@mkdir -p $(@D)
@bash check.sh $< $@
+$(DIR)/output/%.bin.exp: $(DIR)/%.c
+ @bash generate.sh $< $@
+
.PHONY: FORCE
FORCE:
@@ -45,7 +48,9 @@ clean:
rm -f $(DIR)/*.parsed.c
rm -f $(DIR)/*.rtl.?
rm -f $(DIR)/$(ASMDIR)/*.s
- rm -f $(DIR)/$(BINDIR)/*.[bin,tok]
+ rm -f $(DIR)/$(BINDIR)/*.bin
+ rm -f $(DIR)/$(BINDIR)/*.tok
rm -f $(DIR)/output/*.out
+ rm -f $(DIR)/output/*.exp
rm -rf $(DIR)/profile/
rm -f $(ELF)
diff --git a/test/mppa/general/branch.c b/test/mppa/general/branch.c
index dee15568..c9bb3865 100644
--- a/test/mppa/general/branch.c
+++ b/test/mppa/general/branch.c
@@ -10,3 +10,4 @@ int main(void){
return b;
}
+/* RETURN VALUE: 5 */
diff --git a/test/mppa/general/branchz.c b/test/mppa/general/branchz.c
index 5e3226d5..685d3961 100644
--- a/test/mppa/general/branchz.c
+++ b/test/mppa/general/branchz.c
@@ -10,3 +10,4 @@ int main(void){
return b;
}
+/* RETURN VALUE: 3 */
diff --git a/test/mppa/general/branchzu.c b/test/mppa/general/branchzu.c
index 0ff25763..16bbc4c1 100644
--- a/test/mppa/general/branchzu.c
+++ b/test/mppa/general/branchzu.c
@@ -10,3 +10,4 @@ int main(void){
return b;
}
+/* RETURN VALUE: 3 */
diff --git a/test/mppa/general/call.c b/test/mppa/general/call.c
index 3f58b756..f35473b6 100644
--- a/test/mppa/general/call.c
+++ b/test/mppa/general/call.c
@@ -14,3 +14,5 @@ int main(void){
return sum(make_42(), make_18());
//return make_42() + make_18();
}
+
+/* RETURN VALUE: 60 */
diff --git a/test/mppa/general/for.c b/test/mppa/general/for.c
index 6a3a6cc8..41669146 100644
--- a/test/mppa/general/for.c
+++ b/test/mppa/general/for.c
@@ -7,3 +7,5 @@ int main(void){
return a;
}
+
+/* RETURN VALUE: 16 */
diff --git a/test/mppa/general/forvar.c b/test/mppa/general/forvar.c
index 1a075734..5ada4357 100644
--- a/test/mppa/general/forvar.c
+++ b/test/mppa/general/forvar.c
@@ -8,3 +8,5 @@ int main(void){
return a;
}
+
+/* RETURN VALUE: 16 */
diff --git a/test/mppa/general/forvarl.c b/test/mppa/general/forvarl.c
index 90de7411..0ab31998 100644
--- a/test/mppa/general/forvarl.c
+++ b/test/mppa/general/forvarl.c
@@ -9,3 +9,5 @@ int main(void)
return 0;
}
+
+/* RETURN VALUE: 0 */
diff --git a/test/mppa/general/output/branch.bin.exp b/test/mppa/general/output/branch.bin.exp
deleted file mode 100644
index 7ed6ff82..00000000
--- a/test/mppa/general/output/branch.bin.exp
+++ /dev/null
@@ -1 +0,0 @@
-5
diff --git a/test/mppa/general/output/branchz.bin.exp b/test/mppa/general/output/branchz.bin.exp
deleted file mode 100644
index 00750edc..00000000
--- a/test/mppa/general/output/branchz.bin.exp
+++ /dev/null
@@ -1 +0,0 @@
-3
diff --git a/test/mppa/general/output/branchzu.bin.exp b/test/mppa/general/output/branchzu.bin.exp
deleted file mode 100644
index 00750edc..00000000
--- a/test/mppa/general/output/branchzu.bin.exp
+++ /dev/null
@@ -1 +0,0 @@
-3
diff --git a/test/mppa/general/output/call.bin.exp b/test/mppa/general/output/call.bin.exp
deleted file mode 100644
index abdfb053..00000000
--- a/test/mppa/general/output/call.bin.exp
+++ /dev/null
@@ -1 +0,0 @@
-60
diff --git a/test/mppa/general/output/for.bin.exp b/test/mppa/general/output/for.bin.exp
deleted file mode 100644
index b6a7d89c..00000000
--- a/test/mppa/general/output/for.bin.exp
+++ /dev/null
@@ -1 +0,0 @@
-16
diff --git a/test/mppa/general/output/forvar.bin.exp b/test/mppa/general/output/forvar.bin.exp
deleted file mode 100644
index b6a7d89c..00000000
--- a/test/mppa/general/output/forvar.bin.exp
+++ /dev/null
@@ -1 +0,0 @@
-16
diff --git a/test/mppa/general/output/forvarl.bin.exp b/test/mppa/general/output/forvarl.bin.exp
deleted file mode 100644
index 573541ac..00000000
--- a/test/mppa/general/output/forvarl.bin.exp
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/test/mppa/general/output/simple.bin.exp b/test/mppa/general/output/simple.bin.exp
deleted file mode 100644
index 7f8f011e..00000000
--- a/test/mppa/general/output/simple.bin.exp
+++ /dev/null
@@ -1 +0,0 @@
-7
diff --git a/test/mppa/general/simple.c b/test/mppa/general/simple.c
index 725aff68..451522fc 100644
--- a/test/mppa/general/simple.c
+++ b/test/mppa/general/simple.c
@@ -4,3 +4,5 @@ int main(void){
return (a+b);
}
+
+/* RETURN VALUE: 7 */
diff --git a/test/mppa/generate.sh b/test/mppa/generate.sh
new file mode 100644
index 00000000..cfe6f7bb
--- /dev/null
+++ b/test/mppa/generate.sh
@@ -0,0 +1,12 @@
+# $1: c file to examine
+# $2: write file
+
+cfile="$1"
+writefile="$2"
+
+if [ ! -f $cfile ]; then
+ >&2 echo "ERROR: $cfile not found"
+ shift; continue
+fi
+
+sed -n "s/^.*\/\*\s*RETURN VALUE:\s*\([0-9]*\)\s*\*\//\1/p" $1 > $2