Skip to content

Commit 93464c2

Browse files
author
Dwight Guth
committed
move test suite to new home
1 parent 52f5f94 commit 93464c2

File tree

1,121 files changed

+114
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,121 files changed

+114
-21
lines changed

Diff for: tests/unit-fail-compilation/Makefile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
TUS = $(wildcard ./*.c)
2+
TESTS = $(filter-out %-link2.c, ${TUS})
3+
KCC_COMPILED_TESTS = ${TESTS:.c=.kcc.out}
4+
TEST_COMPARISON = ${TESTS:.c=.cmp}
5+
6+
CHECK_RESULT_COMPILE = if [ $$? -eq 1 -o $$? -eq 255 ] ; then echo "passed $<"; mv $@.tmp $@; else echo "failed $<"; cat $@.tmp; exit 1; fi
7+
CHECK_RESULT_RUN = if [ $$? -eq 0 ] ; then echo "passed $<"; mv $@.tmp $@; else echo "failed $<"; cat $@.tmp; exit 1; fi
8+
9+
.PHONY: test clean reference comparison
10+
.PRECIOUS: %.kcc %.out
11+
12+
test: ${KCC_COMPILED_TESTS}
13+
14+
comparison: ${TEST_COMPARISON}
15+
16+
%-link1.kcc.out: %-link1.c %-link2.c
17+
@echo -n "Compiling $^... "
18+
@../../dist/kcc $^ > $@.tmp 2>&1; ${CHECK_RESULT_COMPILE}
19+
20+
%.kcc.out: %.c
21+
@echo -n "Compiling $<... "
22+
@../../dist/kcc $< > $@.tmp 2>&1; ${CHECK_RESULT_COMPILE}
23+
24+
%.cmp: %.kcc.out %.ref
25+
@echo -n "Comparing $^... "
26+
@diff $^ > $@.tmp 2>&1; ${CHECK_RESULT_RUN}
27+
28+
clean:
29+
rm -rf *.out *.kcc *.tmp *.cmp
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: tests/unit-fail-compilation/j055f.c

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
int x;
2+
enum e {a = (int)&x};
3+
int main(void){
4+
5+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: tests/unit-fail-compilation/j060d.c

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
int main(void){
2+
auto int f();
3+
return 0;
4+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: tests/unit-fail-compilation/j078k.c

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
int main(void) {
2+
_Thread_local int x;
3+
return 0;
4+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: tests/unit-fail/Makefile

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
TUS = $(wildcard ./*.c)
2+
TESTS = $(filter-out %-link2.c, ${TUS})
3+
KCC_COMPILED_TESTS = ${TESTS:.c=.kcc}
4+
TEST_RESULTS = ${TESTS:.c=.out}
5+
TEST_COMPARISON = ${TESTS:.c=.cmp}
6+
7+
CHECK_RESULT_COMPILE = if [ $$? -eq 0 ] ; then echo "passed $<"; mv $@.tmp.out $@.out; else echo "failed $<"; cat $@.tmp.out; exit 1; fi
8+
CHECK_RESULT_RUN = if [ $$? -eq 139 ] ; then echo "passed $<"; cat $@.tmp | head -13 > $@; rm $@.tmp; else echo "failed $<"; cat $@.tmp; exit 1; fi
9+
CHECK_RESULT_DIFF = if [ $$? -eq 0 ] ; then echo "passed $<"; mv $@.tmp $@; else echo "failed $<"; cat $@.tmp; exit 1; fi
10+
11+
.PHONY: test clean reference comparison
12+
.PRECIOUS: %.kcc %.out
13+
14+
test: ${TEST_RESULTS}
15+
16+
comparison: ${TEST_COMPARISON}
17+
18+
%.out: %.kcc
19+
@echo -n "Running $<... "
20+
@./$< > $@.tmp 2>&1; ${CHECK_RESULT_RUN}
21+
22+
%-link1.kcc: %-link1.c %-link2.c
23+
@echo -n "Compiling $^... "
24+
@../../dist/kcc -o $@ $^ > $@.tmp.out 2>&1; ${CHECK_RESULT_COMPILE}
25+
26+
%.kcc: %.c
27+
@echo -n "Compiling $<... "
28+
@../../dist/kcc -o $@ $< > $@.tmp.out 2>&1; ${CHECK_RESULT_COMPILE}
29+
30+
%.cmp: %.out %.ref
31+
@echo -n "Comparing $^... "
32+
@diff $^ > $@.tmp 2>&1; ${CHECK_RESULT_DIFF}
33+
34+
clean:
35+
rm -rf *.out *.kcc *.tmp *.cmp
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: tests/unit-fail/j060c.c

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
int main(void){
2+
int f();
3+
f;
4+
return 0;
5+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)