X-Git-Url: https://rtime.felk.cvut.cz/gitweb/l4.git/blobdiff_plain/8fe9942cde59835eb3c3c6936d866dd3305582ef..003b628647705666de261350195da72a38f2c4d2:/l4/pkg/udis86/lib/contrib/tests/Makefile.am diff --git a/l4/pkg/udis86/lib/contrib/tests/Makefile.am b/l4/pkg/udis86/lib/contrib/tests/Makefile.am index 413026358..f7cc17bbc 100644 --- a/l4/pkg/udis86/lib/contrib/tests/Makefile.am +++ b/l4/pkg/udis86/lib/contrib/tests/Makefile.am @@ -1,111 +1,98 @@ # -# Automake definitions for ud/tests +# Automake definitions for udis86 tests # check_PROGRAMS = \ - test_dis \ - ovrrun - -test_dis_SOURCES = test_dis.c -test_dis_LDADD = $(top_builddir)/libudis86/libudis86.la -test_dis_CFLAGS = -I$(top_srcdir)/libudis86 -I$(top_srcdir) - -ovrrun_SOURCES = bufovrrun.c -ovrrun_LDADD = $(top_builddir)/libudis86/libudis86.la -ovrrun_CFLAGS = -I$(top_srcdir)/libudis86 -I$(top_srcdir) - -YASM = @YASM@ -PYTHON = @PYTHON@ - -export UD_SCRIPT_DIR - -dist_check_DATA = \ - test16.asm \ - test32.asm \ - test64.asm \ - testjmp.asm \ - testjmp.ref \ - testobscure.asm \ - testobscure.ref \ - testcorner.asm \ - testcorner.ref \ - testgen.py \ - testgen_opr.py - -ud_TESTS = \ - test16 \ - test32 \ - test64 \ - testjmp \ - testoverrun \ - testobscure \ - testcorner \ - testgen16 \ - testgen32 \ - testgen64 - -.PHONY: $(ud_TESTS) + symresolve \ + bufoverrun \ + libcheck -check-local: tests +bufoverrun_SOURCES = bufoverrun.c +bufoverrun_LDADD = $(top_builddir)/libudis86/libudis86.la +bufoverrun_CFLAGS = -I$(top_srcdir)/libudis86 -I$(top_srcdir) + +symresolve_SOURCES = symresolve.c +symresolve_LDADD = $(top_builddir)/libudis86/libudis86.la +symresolve_CFLAGS = -I$(top_srcdir)/libudis86 -I$(top_srcdir) + +libcheck_SOURCES = libcheck.c +libcheck_LDADD = $(top_builddir)/libudis86/libudis86.la +libcheck_CFLAGS = -I$(top_srcdir)/libudis86 -I$(top_srcdir) + +MAINTAINERCLEANFILES = Makefile.in + +DISTCLEANFILES = difftest.sh -SEED = 1 +YASM = @YASM@ +PYTHON = @PYTHON@ +TESTDIS = $(top_builddir)/udcli/udcli -tests: $(ud_TESTS) +EXTRA_DIST = \ + $(srcdir)/asm \ + $(srcdir)/oprgen.py \ + $(srcdir)/symresolve.ref \ + $(srcdir)/installcheck.c \ + $(srcdir)/libcheck.c -yasm_asm = $(YASM) -f bin -o $(1).bin $(1).asm +if HAVE_YASM +tests: difftest test-buf-overrun test-sym-resolver test-libcheck +else +tests: warn_no_yasm test-buf-overrun test-sym-resolver test-libcheck +endif -asm_compare = \ - @$(YASM) -f bin -o $(1).bin $(top_srcdir)/tests/$(1).asm \ - && echo "[bits $(2)]" > $(1).out \ - && $(top_builddir)/tests/test_dis -$(2) $(1).bin >> $(1).out \ - && diff -w $(top_srcdir)/tests/$(1).$(3) $(1).out \ - && echo "$@: passed." +SEED = 1984 -test16: test_dis - $(call asm_compare,test16,16,asm) -test32: test_dis - $(call asm_compare,test32,32,asm) +.PHONY: test-buf-overrun +test-buf-overrun: bufoverrun + @./bufoverrun && echo "$@: passed" -test64: test_dis - $(call asm_compare,test64,64,asm) -testobscure: test_dis - $(call asm_compare,testobscure,32,ref) +.PHONY: test-sym-resolver +test-sym-resolver: symresolve + @$(top_builddir)/tests/$< > $@.out + @diff -w $(srcdir)/symresolve.ref $@.out && echo "$@: passed." -testcorner: test_dis - $(call asm_compare,testcorner,32,ref) +.PHONY: test-libcheck +test-libcheck: libcheck + @./libcheck && echo "$@: passed" -testjmp: $(top_builddir)/udcli/udcli - @$(YASM) -f bin -o testjmp.bin $(top_srcdir)/tests/testjmp.asm - @$(top_builddir)/udcli/udcli -64 testjmp.bin > testjmp.out - @diff -w $(top_srcdir)/tests/testjmp.ref testjmp.out && echo "$@: passed." +# +# generate operand tests +# +oprtest_generate = \ + outdir=$(builddir)/_results/asm/$(1) && \ + mkdir -p $${outdir} && \ + PYTHONPATH=$(top_srcdir)/scripts $(PYTHON) $(top_srcdir)/tests/oprgen.py \ + $(top_srcdir)/docs/x86/optable.xml $(SEED) $(1) >$${outdir}/oprtest.asm + +.PHONY: oprtest +oprtest: oprgen.py + @echo "Generating operand tests." + @$(call oprtest_generate,64) + @$(call oprtest_generate,32) + @$(call oprtest_generate,16) -testgen_compare = \ - @PYTHONPATH=$(top_srcdir)/scripts $(PYTHON) $(top_srcdir)/tests/testgen.py \ - $(top_srcdir)/docs/x86/optable.xml $(SEED) $(1) > testgen__$(1).asm \ - && $(YASM) -f bin -o testgen__$(1).bin testgen__$(1).asm \ - && echo "[bits $(1)]" > testgen__$(1).out \ - && $(top_builddir)/tests/test_dis -$(1) testgen__$(1).bin >> testgen__$(1).out \ - && diff -w testgen__$(1).asm testgen__$(1).out \ - && echo "$@: passed." -testgen64: testgen.py testgen_opr.py - $(call testgen_compare,64) +.PHONY: difftest +difftest: oprtest $(builddir)/difftest.sh + @sh $(builddir)/difftest.sh -testgen32: testgen.py testgen_opr.py - $(call testgen_compare,32) -testgen16: testgen.py testgen_opr.py - $(call testgen_compare,16) +.PHONY: difftest-refup +difftest-refup: $(builddir)/difftest.sh + @sh $(builddir)/difftest.sh refup -testgen: testgen16 testgen32 testgen64 -testovrrun: ovrrun - @./ovrrun && echo "$@: passed" +.PHONY: warn_no_yasm +warn_no_yasm: + @echo "*** YASM NOT FOUND: Poor Test Coverage ***" + +check-local: tests installcheck-local: - @$(CC) $(srcdir)/test_dis.c -o test_installcheck.bin -I$(includedir) -L$(libdir) -ludis86 + @$(CC) $(srcdir)/installcheck.c -o installcheck.bin -I$(includedir) -L$(libdir) -ludis86 @echo "$@: passed" clean-local: - rm -f *.bin *.out testgen__*.asm *.pyc + rm -f $(builddir)/*.bin $(builddir)/*.out $(builddir)/*.pyc + rm -rf $(builddir)/_results