diff --git a/Makefile b/Makefile index 7a4fff26..68dc7359 100644 --- a/Makefile +++ b/Makefile @@ -115,5 +115,13 @@ styleclean: $(STYLECHECKFILES:=.styleclean) %.styleclean: $(Q)rm -f $*.stylecheck; -.PHONY: build lib $(LIB_DIRS) install doc clean stylecheck styleclean +LDTESTS :=$(wildcard ld/tests/*.data) +LDTESTS :=$(LDTESTS:.data=) +genlinktests: + @for i in $(LDTESTS); do \ + printf " TEST\t$$i\t: "; \ + ./scripts/genlinktest.sh $$i || exit 1; \ + done + +.PHONY: build lib $(LIB_DIRS) install doc clean generatedheaders cleanheaders stylecheck genlinktests diff --git a/ld/tests/single.data b/ld/tests/single.data new file mode 100644 index 00000000..f8d505e0 --- /dev/null +++ b/ld/tests/single.data @@ -0,0 +1 @@ +single END A B C D diff --git a/ld/tests/single.result b/ld/tests/single.result new file mode 100644 index 00000000..d9d51797 --- /dev/null +++ b/ld/tests/single.result @@ -0,0 +1 @@ + -DA -DB -DC -DD diff --git a/scripts/genlinktest.sh b/scripts/genlinktest.sh new file mode 100644 index 00000000..cfbebeb0 --- /dev/null +++ b/scripts/genlinktest.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# run test +PAAT=`basename $1`; +awk -v PAT="$PAAT" -f scripts/genlink.awk $1.data > $1.out; + +#check test +if ! diff -q $1.out $1.result >/dev/null; then + printf "FAILED\n"; + exit 1; +fi + +#remove workout only if it is OK +rm -f $1.out + +printf "OK\n"; +exit 0 \ No newline at end of file