From 07963dbf8fa624765efef42a80cc1e6629230c1c Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Wed, 6 Jun 2012 23:20:48 +0000 Subject: [PATCH] Added a script for tests --- Makefile | 1 + tests/Makefile | 7 +++-- tests/project.conf | 9 ++++-- tests/tests.sh | 69 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 4 deletions(-) create mode 100755 tests/tests.sh diff --git a/Makefile b/Makefile index 3a0a5df..64ac347 100644 --- a/Makefile +++ b/Makefile @@ -139,6 +139,7 @@ dist: $(PACKAGE)-$(VERSION)/tests/yasep16.asm \ $(PACKAGE)-$(VERSION)/tests/yasep32.asm \ $(PACKAGE)-$(VERSION)/tests/Makefile \ + $(PACKAGE)-$(VERSION)/tests/tests.sh \ $(PACKAGE)-$(VERSION)/tests/project.conf \ $(PACKAGE)-$(VERSION)/Makefile \ $(PACKAGE)-$(VERSION)/COPYING \ diff --git a/tests/Makefile b/tests/Makefile index 3dcc9cd..ece0791 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,4 +1,4 @@ -TARGETS = amd64.o arm.o armeb.o armel.o dalvik.o i386.o i386_real.o i486.o i586.o i686.o mips.o mipseb.o mipsel.o java.o sparc.o sparc64.o yasep.o yasep16.o yasep32.o +TARGETS = amd64.o arm.o armeb.o armel.o dalvik.o i386.o i386_real.o i486.o i586.o i686.o mips.o mipseb.o mipsel.o java.o sparc.o sparc64.o tests yasep.o yasep16.o yasep32.o PREFIX = /usr/local DESTDIR = BINDIR = $(PREFIX)/bin @@ -60,6 +60,9 @@ sparc.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a sparc sparc64.o_OBJS = sparc64.o sparc64.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a sparc64 +tests: amd64.o arm.o armeb.o armel.o i386.o i486.o i586.o i686.o sparc.o sparc64.o yasep.o yasep16.o yasep32.o + ./tests.sh -P "$(PREFIX)" -- "tests" + yasep.o_OBJS = yasep.o yasep.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a yasep -f flat @@ -127,7 +130,7 @@ yasep32.o: yasep32.asm ../src/asm yasep.asm $(AS) $(yasep32.o_ASFLAGS) -o yasep32.o yasep32.asm clean: - $(RM) -- $(amd64.o_OBJS) $(arm.o_OBJS) $(armeb.o_OBJS) $(armel.o_OBJS) $(dalvik.o_OBJS) $(i386.o_OBJS) $(i386_real.o_OBJS) $(i486.o_OBJS) $(i586.o_OBJS) $(i686.o_OBJS) $(mips.o_OBJS) $(mipseb.o_OBJS) $(mipsel.o_OBJS) $(java.o_OBJS) $(sparc.o_OBJS) $(sparc64.o_OBJS) $(yasep.o_OBJS) $(yasep16.o_OBJS) $(yasep32.o_OBJS) + $(RM) -- $(amd64.o_OBJS) $(arm.o_OBJS) $(armeb.o_OBJS) $(armel.o_OBJS) $(dalvik.o_OBJS) $(i386.o_OBJS) $(i386_real.o_OBJS) $(i486.o_OBJS) $(i586.o_OBJS) $(i686.o_OBJS) $(mips.o_OBJS) $(mipseb.o_OBJS) $(mipsel.o_OBJS) $(java.o_OBJS) $(sparc.o_OBJS) $(sparc64.o_OBJS) $(tests_OBJS) $(yasep.o_OBJS) $(yasep16.o_OBJS) $(yasep32.o_OBJS) distclean: clean $(RM) -- $(TARGETS) diff --git a/tests/project.conf b/tests/project.conf index dd72dd9..8eff09e 100644 --- a/tests/project.conf +++ b/tests/project.conf @@ -1,6 +1,6 @@ -targets=amd64.o,arm.o,armeb.o,armel.o,dalvik.o,i386.o,i386_real.o,i486.o,i586.o,i686.o,mips.o,mipseb.o,mipsel.o,java.o,sparc.o,sparc64.o,yasep.o,yasep16.o,yasep32.o +targets=amd64.o,arm.o,armeb.o,armel.o,dalvik.o,i386.o,i386_real.o,i486.o,i586.o,i686.o,mips.o,mipseb.o,mipsel.o,java.o,sparc.o,sparc64.o,tests,yasep.o,yasep16.o,yasep32.o as=../src/asm-static -dist=Makefile +dist=Makefile,tests.sh [amd64.o] type=object @@ -130,6 +130,11 @@ sources=sparc64.asm asflags=-a sparc64 depends=../src/asm +[tests] +type=script +script=./tests.sh +depends=amd64.o,arm.o,armeb.o,armel.o,i386.o,i486.o,i586.o,i686.o,sparc.o,sparc64.o,yasep.o,yasep16.o,yasep32.o + [yasep.o] type=object sources=yasep.asm diff --git a/tests/tests.sh b/tests/tests.sh new file mode 100755 index 0000000..432bb7b --- /dev/null +++ b/tests/tests.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env sh +#$Id$ +#Copyright (c) 2012 Pierre Pronchery +#This file is part of DeforaOS System libc +#This program is free software: you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation, version 3 of the License. +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +#along with this program. If not, see . + + + +#variables +DEASM="../src/deasm" +DEBUG="debug" +DEVNULL="/dev/null" + + +#functions +#deasm +deasm() +{ + [ $# -lt 1 ] && return 1 + file="$1.o" + arch="$1" + cmd="$DEASM" + format="" + [ $# -eq 2 ] && format="$2" + + [ -n "$format" ] && cmd="$cmd -a $arch -f $format" + $DEBUG $cmd "$file" > $DEVNULL +} + + +#debug +debug() +{ + echo $@ 1>&2 + $@ +} + + +#main +FAILED= +deasm amd64 || FAILED="$FAILED amd64(error $?)" +deasm arm || FAILED="$FAILED arm(error $?)" +deasm armeb || FAILED="$FAILED armeb(error $?)" +deasm armel || FAILED="$FAILED armel(error $?)" +deasm dalvik dex || FAILED="$FAILED dalvik(error $?)" +deasm i386 || FAILED="$FAILED i386(error $?)" +deasm i486 || FAILED="$FAILED i486(error $?)" +deasm i586 || FAILED="$FAILED i586(error $?)" +deasm i686 || FAILED="$FAILED i686(error $?)" +deasm java flat || FAILED="$FAILED java(error $?)" +deasm sparc || FAILED="$FAILED sparc(error $?)" +deasm sparc64 || FAILED="$FAILED sparc64(error $?)" +deasm yasep flat || FAILED="$FAILED yasep(error $?)" +deasm yasep16 flat || FAILED="$FAILED yasep16(error $?)" +deasm yasep32 flat || FAILED="$FAILED yasep32(error $?)" +[ -z "$FAILED" ] && exit 0 +echo "Failed tests:$FAILED" 1>&2 +#XXX ignore errors for now +#exit 2