diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Makefile | 26 | ||||
| -rw-r--r-- | tests/addr/addr.qbt (renamed from tests/addr.qbt) | 0 | ||||
| -rw-r--r-- | tests/addr/source.mk | 1 | ||||
| -rw-r--r-- | tests/blit/blit.qbt (renamed from tests/blit.qbt) | 0 | ||||
| -rw-r--r-- | tests/blit/source.mk | 1 | ||||
| -rw-r--r-- | tests/empty/empty.qbt (renamed from tests/empty.qbt) | 0 | ||||
| -rw-r--r-- | tests/empty/source.mk | 1 | ||||
| -rw-r--r-- | tests/hello_world/hello_world.qbt (renamed from tests/hello_world.qbt) | 0 | ||||
| -rw-r--r-- | tests/hello_world/source.mk | 1 | ||||
| -rw-r--r-- | tests/save/save.qbt (renamed from tests/save.qbt) | 4 | ||||
| -rw-r--r-- | tests/save/source.mk | 1 | ||||
| -rwxr-xr-x | tests/scripts/gen-simple | 14 | ||||
| -rwxr-xr-x | tests/scripts/gen-simple-xfail | 29 | ||||
| -rw-r--r-- | tests/scripts/makefile | 16 | ||||
| -rw-r--r-- | tests/simple_args/simple_args.qbt (renamed from tests/simple_args.qbt) | 0 | ||||
| -rw-r--r-- | tests/simple_args/source.mk | 1 | ||||
| -rw-r--r-- | tests/simple_external_putchar/simple_external_putchar.qbt (renamed from tests/simple_external_putchar.qbt) | 0 | ||||
| -rw-r--r-- | tests/simple_external_putchar/source.mk | 1 | ||||
| -rw-r--r-- | tests/simple_loop/simple_loop.qbt (renamed from tests/simple_loop.qbt) | 0 | ||||
| -rw-r--r-- | tests/simple_loop/source.mk | 1 | ||||
| -rw-r--r-- | tests/unreachable/source.mk | 1 | ||||
| -rw-r--r-- | tests/unreachable/unreachable.qbt (renamed from tests/unreachable.qbt) | 0 |
22 files changed, 96 insertions, 2 deletions
diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..1f37445 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,26 @@ +check: + $(MAKE) -f scripts/makefile check + +.DEFAULT: + $(MAKE) -f scripts/makefile $< + +SOURCES != echo */source.mk +DO != echo -n > tests.mk && rm -rf reports + +SIMPLE := +SIMPLE_XFAIL := + +include $(SOURCES) + +# pass through xargs to 'trick' it into expanding each SIMPLE_XFAIL into a +# separate argument for the script, as make would otherwise just split at each space +# this way we can pass spaces as arguments to the generator scripts, pretty neat +# huh? +DO != echo "$(SIMPLE)" | xargs ./scripts/gen-simple +DO != echo "$(SIMPLE_XFAIL)" | xargs ./scripts/gen-simple-xfail + +RM ?= rm + +.PHONY: clean +clean: + $(RM) -rf reports diff --git a/tests/addr.qbt b/tests/addr/addr.qbt index efe149c..efe149c 100644 --- a/tests/addr.qbt +++ b/tests/addr/addr.qbt diff --git a/tests/addr/source.mk b/tests/addr/source.mk new file mode 100644 index 0000000..bc4b83e --- /dev/null +++ b/tests/addr/source.mk @@ -0,0 +1 @@ +SIMPLE_XFAIL += addr,'unimplemented insn: ADDR' diff --git a/tests/blit.qbt b/tests/blit/blit.qbt index b8fa0d3..b8fa0d3 100644 --- a/tests/blit.qbt +++ b/tests/blit/blit.qbt diff --git a/tests/blit/source.mk b/tests/blit/source.mk new file mode 100644 index 0000000..6bc4045 --- /dev/null +++ b/tests/blit/source.mk @@ -0,0 +1 @@ +SIMPLE_XFAIL += blit,'unimplemented insn: BLIT' diff --git a/tests/empty.qbt b/tests/empty/empty.qbt index 9c63342..9c63342 100644 --- a/tests/empty.qbt +++ b/tests/empty/empty.qbt diff --git a/tests/empty/source.mk b/tests/empty/source.mk new file mode 100644 index 0000000..ee6c598 --- /dev/null +++ b/tests/empty/source.mk @@ -0,0 +1 @@ +SIMPLE += empty diff --git a/tests/hello_world.qbt b/tests/hello_world/hello_world.qbt index 8419208..8419208 100644 --- a/tests/hello_world.qbt +++ b/tests/hello_world/hello_world.qbt diff --git a/tests/hello_world/source.mk b/tests/hello_world/source.mk new file mode 100644 index 0000000..be3b9ae --- /dev/null +++ b/tests/hello_world/source.mk @@ -0,0 +1 @@ +SIMPLE += hello_world diff --git a/tests/save.qbt b/tests/save/save.qbt index 71b7bb6..725d10b 100644 --- a/tests/save.qbt +++ b/tests/save/save.qbt @@ -3,9 +3,9 @@ main() i27 r0 = 20; i27 r1 = 30; i27 r2 = 50; - &_putchar (i9 'H') => (r4); + &_putchar ('H') => (r4); i27 r0 = r0 + r1; i27 r0 = r0 + r2; - &_putchar (i9 'e') => (r5); + &_putchar ('e') => (r5); => (r0); } diff --git a/tests/save/source.mk b/tests/save/source.mk new file mode 100644 index 0000000..60a2498 --- /dev/null +++ b/tests/save/source.mk @@ -0,0 +1 @@ +SIMPLE += save diff --git a/tests/scripts/gen-simple b/tests/scripts/gen-simple new file mode 100755 index 0000000..b8ddd9f --- /dev/null +++ b/tests/scripts/gen-simple @@ -0,0 +1,14 @@ +#!/bin/sh + +mkdir -p $(for d in "${@}"; do echo "$d"; done | uniq | sed "s|^|reports/|") + +for s in "${@}" +do + echo ".PHONY: $s" >> tests.mk + echo "$s:" >> tests.mk + echo " @../qbt $s/$s.qbt > reports/$s/log 2>&1 \\" >> tests.mk + echo " && echo OK > reports/$s/OK \\" >> tests.mk + echo " || echo ERR > reports/$s/OK" >> tests.mk +done + +echo "TESTS += " "${@}" >> tests.mk diff --git a/tests/scripts/gen-simple-xfail b/tests/scripts/gen-simple-xfail new file mode 100755 index 0000000..41c272a --- /dev/null +++ b/tests/scripts/gen-simple-xfail @@ -0,0 +1,29 @@ +#!/bin/sh + +mkdir -p $(for d in "${@}"; do echo "$d"; done \ + | sed "s|,.*||" | uniq | sed "s|^|reports/|") + +for s in "${@}" +do + NAME=${s%%,*} + EMSG=${s#${NAME},} + echo ".PHONY: $NAME" >> tests.mk + echo "$NAME:" >> tests.mk + echo " @../qbt $NAME/$NAME.qbt > reports/$NAME/log 2>&1 \\" >> tests.mk + echo " && echo 'Wrong retval' > reports/$NAME/OK \\" >> tests.mk + echo " || :" >> tests.mk + echo " @grep '$EMSG' reports/$NAME/log > /dev/null; \\" >> tests.mk + echo " [ \$\$? -eq 0 ] \\" >> tests.mk + echo " && echo OK > reports/$NAME/OK \\" >> tests.mk + echo " || echo EMSG > reports/$NAME/OK" >> tests.mk +done + +echo -n "TESTS +=" >> tests.mk +for s in "${@}" +do + NAME=${s%%,*} + echo -n " $NAME" >> tests.mk +done + +# append newline +echo "" >> tests.mk diff --git a/tests/scripts/makefile b/tests/scripts/makefile new file mode 100644 index 0000000..a85d373 --- /dev/null +++ b/tests/scripts/makefile @@ -0,0 +1,16 @@ +.PHONY: all +all: check + +TESTS := +include tests.mk + +.PHONY: check +check: $(TESTS) + @cd reports; for d in * ; do \ + if [ ! -f "$$d/OK" ]; then \ + echo "BROKEN: $$d" ; \ + elif [ "$$(tail -n1 $$d/OK)" != "OK" ]; then \ + echo "FAIL: $$d" ; \ + fi \ + done + @echo "Done." diff --git a/tests/simple_args.qbt b/tests/simple_args/simple_args.qbt index 5dcb3d8..5dcb3d8 100644 --- a/tests/simple_args.qbt +++ b/tests/simple_args/simple_args.qbt diff --git a/tests/simple_args/source.mk b/tests/simple_args/source.mk new file mode 100644 index 0000000..9422cb3 --- /dev/null +++ b/tests/simple_args/source.mk @@ -0,0 +1 @@ +SIMPLE += simple_args diff --git a/tests/simple_external_putchar.qbt b/tests/simple_external_putchar/simple_external_putchar.qbt index b76844c..b76844c 100644 --- a/tests/simple_external_putchar.qbt +++ b/tests/simple_external_putchar/simple_external_putchar.qbt diff --git a/tests/simple_external_putchar/source.mk b/tests/simple_external_putchar/source.mk new file mode 100644 index 0000000..a226f93 --- /dev/null +++ b/tests/simple_external_putchar/source.mk @@ -0,0 +1 @@ +SIMPLE += simple_external_putchar diff --git a/tests/simple_loop.qbt b/tests/simple_loop/simple_loop.qbt index 32e544f..32e544f 100644 --- a/tests/simple_loop.qbt +++ b/tests/simple_loop/simple_loop.qbt diff --git a/tests/simple_loop/source.mk b/tests/simple_loop/source.mk new file mode 100644 index 0000000..4ec9398 --- /dev/null +++ b/tests/simple_loop/source.mk @@ -0,0 +1 @@ +SIMPLE += simple_loop diff --git a/tests/unreachable/source.mk b/tests/unreachable/source.mk new file mode 100644 index 0000000..a647456 --- /dev/null +++ b/tests/unreachable/source.mk @@ -0,0 +1 @@ +SIMPLE += unreachable diff --git a/tests/unreachable.qbt b/tests/unreachable/unreachable.qbt index b97f9e1..b97f9e1 100644 --- a/tests/unreachable.qbt +++ b/tests/unreachable/unreachable.qbt |
