Build the python binding as part of the tests

This commit is contained in:
Pierre Pronchery 2014-08-29 21:28:49 +02:00
parent 97631153fe
commit 0b9e2daa31
5 changed files with 60 additions and 11 deletions

View File

@ -174,6 +174,7 @@ dist:
$(PACKAGE)-$(VERSION)/tests/yasep16.asm \
$(PACKAGE)-$(VERSION)/tests/yasep32.asm \
$(PACKAGE)-$(VERSION)/tests/Makefile \
$(PACKAGE)-$(VERSION)/tests/python.sh \
$(PACKAGE)-$(VERSION)/tests/tests.sh \
$(PACKAGE)-$(VERSION)/tests/project.conf \
$(PACKAGE)-$(VERSION)/Makefile \

View File

@ -64,7 +64,7 @@ sparc64.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a sparc64
template.o_OBJS = template.o
template.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a template -f flat
tests.log: amd64.o arm.o armeb.o armel.o i386.o i386_real.o i486.o i586.o i686.o sparc.o sparc64.o tests.sh yasep.o yasep16.o yasep32.o
tests.log: amd64.o arm.o armeb.o armel.o i386.o i386_real.o i486.o i586.o i686.o python.sh sparc.o sparc64.o tests.sh yasep.o yasep16.o yasep32.o
./tests.sh -P "$(PREFIX)" -- "tests.log"
yasep.o_OBJS = yasep.o

View File

@ -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,template.o,tests.log,yasep.o,yasep16.o,yasep32.o
as=../src/asm-static
dist=Makefile,tests.sh
dist=Makefile,python.sh,tests.sh
[amd64.o]
type=object
@ -141,7 +141,7 @@ depends=../src/asm
[tests.log]
type=script
script=./tests.sh
depends=amd64.o,arm.o,armeb.o,armel.o,i386.o,i386_real.o,i486.o,i586.o,i686.o,sparc.o,sparc64.o,tests.sh,yasep.o,yasep16.o,yasep32.o
depends=amd64.o,arm.o,armeb.o,armel.o,i386.o,i386_real.o,i486.o,i586.o,i686.o,python.sh,sparc.o,sparc64.o,tests.sh,yasep.o,yasep16.o,yasep32.o
[yasep.o]
type=object

24
tests/python.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
#$Id$
#Copyright (c) 2014 Pierre Pronchery <khorben@defora.org>
#This file is part of DeforaOS Devel Asm
#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 <http://www.gnu.org/licenses/>.
#variables
#executables
MAKE="make"
(cd ../src/python && $MAKE clean all)

View File

@ -17,6 +17,7 @@
#variables
#executables
DATE="date"
DEASM="../src/deasm-static"
DEBUG="_debug"
@ -46,6 +47,25 @@ _debug()
}
#fail
_fail()
{
test="$1"
shift
echo -n "$test:" 1>&2
(echo
echo "Testing: ./$test" "$@"
"./$test" "$@") >> "$target" 2>&1
res=$?
if [ $res -ne 0 ]; then
echo " FAIL (error $res)" 1>&2
else
echo " PASS" 1>&2
fi
}
#test
_test()
{
@ -54,16 +74,18 @@ _test()
shift
echo -n "$test:" 1>&2
echo
(echo
echo "Testing: $test" "$@"
"$test" "$@" 2>&1
"$test" "$@") >> "$target" 2>&1
res=$?
if [ $res -ne 0 ]; then
echo " FAILED" 1>&2
echo " FAIL" 1>&2
FAILED="$FAILED $test($arch, error $res)"
return 2
else
echo " $arch PASS" 1>&2
return 0
fi
echo " $arch PASS" 1>&2
}
@ -77,7 +99,7 @@ _usage()
#main
clean=0
while getopts "cP:" "name"; do
while getopts "cP:" name; do
case "$name" in
c)
clean=1
@ -100,9 +122,9 @@ target="$1"
[ "$clean" -ne 0 ] && exit 0
$DATE > "$target"
FAILED=
(echo "Performing tests:" 1>&2
$DATE
echo "Performing tests:" 1>&2
_test _deasm amd64
_test _deasm arm
_test _deasm armeb
@ -119,7 +141,9 @@ _test _deasm sparc64
_test _deasm template flat
_test _deasm yasep flat
_test _deasm yasep16 flat
_test _deasm yasep32 flat) > "$target"
_test _deasm yasep32 flat
echo "Expected failures:" 1>&2
_fail "python.sh"
if [ -n "$FAILED" ]; then
echo "Failed tests:$FAILED" 1>&2
exit 2