Compare commits

...

5 Commits

4 changed files with 25 additions and 5 deletions

3
tests/.gitignore vendored
View File

@ -1,3 +1,6 @@
/*.gcda
/*.gcno
/*.c.gcov
/array
/config
/event

View File

@ -4,7 +4,7 @@ PREFIX = /usr/local
DESTDIR =
BINDIR = $(PREFIX)/bin
SBINDIR = $(PREFIX)/sbin
CC = cc
CC = gcc -fprofile-arcs -ftest-coverage
CPPFLAGSF= -I ../include
CPPFLAGS=
CFLAGSF =

View File

@ -1,4 +1,5 @@
targets=array,config,error,event,includes,pylint.log,string,variable,tests.log
cc=gcc -fprofile-arcs -ftest-coverage
cppflags_force=-I ../include
cflags=-W -Wall -g -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector-all
ldflags_force=-L$(OBJDIR)../src -Wl,-rpath,$(OBJDIR)../src -lSystem

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2011-2016 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2011-2017 Pierre Pronchery <khorben@defora.org>
#This file is part of DeforaOS System libSystem
#
#Redistribution and use in source and binary forms, with or without
@ -30,7 +30,9 @@
PROGNAME="tests.sh"
#executables
DATE="date"
GCOV="gcov"
PKGCONFIG="pkg-config"
RM="rm -f"
#functions
@ -45,6 +47,14 @@ _date()
}
#debug
_debug()
{
echo "$@" 1>&2
"$@"
}
#fail
_fail()
{
@ -58,15 +68,16 @@ _run()
test="$1"
sep=
[ $# -eq 1 ] || sep=" "
testexe="./$test"
[ -x "$OBJDIR$test" ] && testexe="$OBJDIR$test"
shift
echo -n "$test:" 1>&2
(echo
echo "Testing: $test" "$@"
testexe="./$test"
[ -x "$OBJDIR$test" ] && testexe="$OBJDIR$test"
LD_LIBRARY_PATH="$OBJDIR../src" "$testexe" "$@") 2>&1
res=$?
[ -f "$test.gcda" ] && LD_LIBRARY_PATH="$OBJDIR../src" $GCOV "$testexe" 2>&1
if [ $res -ne 0 ]; then
echo "Test: $test$sep$@: FAIL (error $res)"
echo " FAIL" 1>&2
@ -135,7 +146,12 @@ while [ $# -ne 0 ]; do
target="$1"
shift
[ "$clean" -eq 0 ] || break
if [ $clean -eq 1 ]; then
for test in $tests; do
$DEBUG $RM -- "$test.c.gcov" "$test.gcda" "$test.gcno"
done
break
fi
_date > "$target"
FAILED=