aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/gourdinl/postpass_alternate_str.c11
-rw-r--r--test/monniaux/csmith/Makefile95
-rw-r--r--test/monniaux/csmith/Makefile.old23
3 files changed, 114 insertions, 15 deletions
diff --git a/test/gourdinl/postpass_alternate_str.c b/test/gourdinl/postpass_alternate_str.c
new file mode 100644
index 00000000..99c50d7d
--- /dev/null
+++ b/test/gourdinl/postpass_alternate_str.c
@@ -0,0 +1,11 @@
+long a;
+short *b;
+void c() {
+ long d = &a;
+ char e = 0;
+ long f[4] = {&e};
+ if (*b)
+ if (c) {
+ long g = &d;
+ }
+}
diff --git a/test/monniaux/csmith/Makefile b/test/monniaux/csmith/Makefile
index 56313452..aa4eccab 100644
--- a/test/monniaux/csmith/Makefile
+++ b/test/monniaux/csmith/Makefile
@@ -1,23 +1,88 @@
-CSMITH?=/local/monniaux/packages/csmith-2.3.0/bin/csmith
-MAX=1000
+INCLUDES=-I csmith/include/csmith-2.3.0/
+TARGET_CCOMP=../../../ccomp
+TARGET_CC=gcc
-include ../rules.mk
-KVX_CCOMPFLAGS+=-I/local/monniaux/packages/csmith-2.3.0/include/csmith-2.3.0 -fstruct-passing -fbitfields
+ifndef EXECUTE
+EXECUTE=timeout 2s
+endif
-TARGETS_S=$(shell seq --format src%06.f.ccomp.kvx.s 0 $(MAX))
-TARGETS_C=$(shell seq --format src%06.f.c 0 $(MAX))
-TARGETS_O=$(shell seq --format src%06.f.ccomp.kvx.o 0 $(MAX))
+CFLAGS += -Wno-incompatible-pointer-types
-all: c s o
+ifndef CSMITH
+CSMITH=csmith/bin/csmith
+endif
-s: $(TARGETS_S)
-c: $(TARGETS_C)
-o: $(TARGETS_O)
+MAX=300
+PREFIX=ran%06.f
-src%.c :
- $(CSMITH) --output $@ --seed $*
+CCOMPOTS=-static
+CCOMPFLAGS+= -fstruct-passing -fbitfields -fno-cse2 -stdlib ../../../runtime
+
+TESTS_C=$(shell seq --format $(PREFIX)/source.c 1 $(MAX))
+
+TESTS_CCOMP_TARGET_S=$(TEST_C:.c=.ccomp.target.s)
+TESTS_GCC_TARGET_S=$(TEST_C:.c=.gcc.target.s)
+TESTS_GCC_HOST_S=$(TEST_C:.c=.gcc.host.s)
+TESTS_CCOMP_TARGET_OUT=$(shell seq --format $(PREFIX)/example.ccomp.target.out 1 $(MAX))
+TESTS_GCC_TARGET_OUT=$(shell seq --format $(PREFIX)/example.gcc.target.out 1 $(MAX))
+TESTS_GCC_HOST_OUT=$(shell seq --format $(PREFIX)/example.gcc.host.out 1 $(MAX))
+TESTS_CMP=$(shell seq --format $(PREFIX)/example.target.cmp 1 $(MAX)) # $(shell seq --format $(PREFIX)/example.host_target.cmp 1 $(MAX))
+
+
+all: $(TESTS_CCOMP_TARGET_OUT) $(TESTS_GCC_TARGET_OUT) $(TESTS_CCOMP_TARGET_S) $(TESTS_GCC_TARGET_S) $(TESTS_CMP) $(TESTS_C)
+
+$(TESTS_C): $(CSMITH)
+
+tests_c: $(TESTS_C)
+
+tests_s: $(TESTS_CCOMP_TARGET_S)
+
+%.ccomp.target.s : %.c
+ $(TARGET_CCOMP) $(INCLUDES) $(CCOMPOPTS) $(CCOMPFLAGS) -S -o $@ $<
+
+%.gcc.target.s : %.c
+ $(TARGET_CC) $(INCLUDES) $(CFLAGS) -S -o $@ $<
+
+%.gcc.host.s : %.c
+ $(CC) $(INCLUDES) $(CFLAGS) -S -o $@ $<
+
+%.target.o : %.target.s
+ $(TARGET_CC) -c -o $@ $<
+
+%.host.o : %.host.s
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+%.target.out : %.target
+ $(EXECUTE) $< | tee $@
+
+%.host.out : %.host
+ ./$< | tee $@
+
+ran%/example.ccomp.target: ran%/source.ccomp.target.o
+ $(TARGET_CCOMP) $(CCOMPOPTS) $(CCOMPFLAGS) $+ -o $@
+
+ran%/example.gcc.target: ran%/source.gcc.target.o
+ $(TARGET_CC) $(TARGET_CFLAGS) $+ -o $@
+
+ran%/example.gcc.host: ran%/source.gcc.host.o
+ $(CC) $(CFLAGS) $+ -o $@
+
+ran%/source.c:
+ mkdir -p ran$*
+ $(CSMITH) --seed $* --output ran$*/source.c
+
+ran%/example.target.cmp : ran%/example.gcc.target.out ran%/example.ccomp.target.out
+ cmp $+ > $@
+
+ran%/example.host_target.cmp : ran%/example.gcc.host.out ran%/example.ccomp.target.out
+ cmp $+ > $@
+
+.PHONY: all clean tests_c tests_c
clean:
- -rm -f $(TARGETS_C) $(TARGETS_S) $(TARGETS_O)
+ -rm -rf ran*
-.PHONY: s c o clean
+csmith/bin/csmith:
+ curl -L -o csmith-2.3.0.tar.gz https://embed.cs.utah.edu/csmith/csmith-2.3.0.tar.gz
+ tar xfz csmith-2.3.0.tar.gz
+ WD=`pwd` && cd csmith-2.3.0 && ./configure --prefix=$$WD/csmith && make install
diff --git a/test/monniaux/csmith/Makefile.old b/test/monniaux/csmith/Makefile.old
new file mode 100644
index 00000000..56313452
--- /dev/null
+++ b/test/monniaux/csmith/Makefile.old
@@ -0,0 +1,23 @@
+CSMITH?=/local/monniaux/packages/csmith-2.3.0/bin/csmith
+MAX=1000
+
+include ../rules.mk
+KVX_CCOMPFLAGS+=-I/local/monniaux/packages/csmith-2.3.0/include/csmith-2.3.0 -fstruct-passing -fbitfields
+
+TARGETS_S=$(shell seq --format src%06.f.ccomp.kvx.s 0 $(MAX))
+TARGETS_C=$(shell seq --format src%06.f.c 0 $(MAX))
+TARGETS_O=$(shell seq --format src%06.f.ccomp.kvx.o 0 $(MAX))
+
+all: c s o
+
+s: $(TARGETS_S)
+c: $(TARGETS_C)
+o: $(TARGETS_O)
+
+src%.c :
+ $(CSMITH) --output $@ --seed $*
+
+clean:
+ -rm -f $(TARGETS_C) $(TARGETS_S) $(TARGETS_O)
+
+.PHONY: s c o clean