Browse Source

i had to remove the cool plugin stuff for my tests, as i found no working way to use this with autotools. Now all works.

master
Georg Hopp 14 years ago
parent
commit
58a2aba86e
  1. 26
      ChangeLog
  2. 5
      Makefile.in
  3. 8445
      aclocal.m4
  4. 4
      configure
  5. 5
      include/Makefile.in
  6. 5
      src/Makefile.in
  7. 15
      tests/Makefile.am
  8. 76
      tests/Makefile.in
  9. 18
      tests/cclassTest.c
  10. 6
      tests/mock/class.h
  11. 90
      tests/runtest.c
  12. 9
      tests/runtest.h

26
ChangeLog

@ -1,6 +1,30 @@
2011-11-16 19:32:44 +0100 Georg Hopp
* i had to remove the cool plugin stuff for my tests, as i found no working way to use this with autotools. Now all works. (HEAD, master)
2011-11-16 18:14:51 +0100 Georg Hopp
* the new testing framework works and the tests for cclass are done...actually i try to figure out how to tell autotools to build this correctly.
2011-11-16 09:09:32 +0100 Georg Hopp
* work on test <<framework>> (origin/master, origin/HEAD)
2011-11-15 21:26:08 +0100 Georg Hopp
* add copyright note to all source files
2011-11-15 14:50:57 +0100 Georg Hopp
* Merge branch 'master' of 192.168.10.10:/var/lib/git/token
2011-11-15 14:49:51 +0100 Georg Hopp
* use autotools now with ebuild
2011-11-15 14:49:51 +0100 Georg Hopp
* use autotools now with ebuild (HEAD, origin/master, origin/HEAD, master)
* use autotools now with ebuild
2011-11-15 14:35:15 +0100 Georg Hopp

5
Makefile.in

@ -42,10 +42,7 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
compile config.guess config.sub depcomp install-sh ltmain.sh \
missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \

8445
aclocal.m4
File diff suppressed because it is too large
View File

4
configure

@ -7895,10 +7895,6 @@ _lt_linker_boilerplate=`cat conftest.err`
$RM -r conftest*
## CAVEAT EMPTOR:
## There is no encapsulation within the following macros, do not change
## the running order or otherwise move them around unless you know exactly
## what you are doing...
if test -n "$compiler"; then
lt_prog_compiler_no_builtin_flag=

5
include/Makefile.in

@ -38,10 +38,7 @@ subdir = include
DIST_COMMON = $(nobase_include_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

5
src/Makefile.in

@ -37,10 +37,7 @@ host_triplet = @host@
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d

15
tests/Makefile.am

@ -1,8 +1,7 @@
ACLOCAL_AMFLAGS = -I m4
TESTS = crypt decrypt dyntype hash packet runtest
check_PROGRAMS = crypt decrypt dyntype hash packet runtest
noinst_LTLIBRARIES = cclassTest.la
TESTS = crypt decrypt dyntype hash packet cclassTest
check_PROGRAMS = crypt decrypt dyntype hash packet cclassTest
crypt_SOURCES = crypt.c ../base64.c
crypt_LDADD = ../src/libtoken.la $(LIBOBJS)
@ -24,10 +23,6 @@ packet_SOURCES = packet.c
packet_LDADD = ../src/libtoken.la $(LIBOBJS)
packet_CFLAGS = -I ../include -I ..
cclassTest_la_SOURCES = cclassTest.c
cclassTest_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
cclassTest_la_CFLAGS = -nostartfiles -fPIC -I. -I../include
runtest_SOURCES = runtest.c
runtest_LDADD = ../src/libtoken.la $(LIBOBJS) -ldl
runtest_CFLAGS = -rdynamic
cclassTest_SOURCES = runtest.c cclassTest.c mock/class.c
cclassTest_LDADD = ../src/libtoken.la $(LIBOBJS)
cclassTest_CFLAGS = -I ../include -I .. -I .

76
tests/Makefile.in

@ -34,22 +34,26 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
TESTS = crypt$(EXEEXT) decrypt$(EXEEXT) dyntype$(EXEEXT) hash$(EXEEXT) \
packet$(EXEEXT)
packet$(EXEEXT) cclassTest$(EXEEXT)
check_PROGRAMS = crypt$(EXEEXT) decrypt$(EXEEXT) dyntype$(EXEEXT) \
hash$(EXEEXT) packet$(EXEEXT)
hash$(EXEEXT) packet$(EXEEXT) cclassTest$(EXEEXT)
subdir = tests
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am_cclassTest_OBJECTS = cclassTest-runtest.$(OBJEXT) \
cclassTest-cclassTest.$(OBJEXT) cclassTest-class.$(OBJEXT)
cclassTest_OBJECTS = $(am_cclassTest_OBJECTS)
cclassTest_DEPENDENCIES = ../src/libtoken.la $(LIBOBJS)
cclassTest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(cclassTest_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
am_crypt_OBJECTS = crypt-crypt.$(OBJEXT) crypt-base64.$(OBJEXT)
crypt_OBJECTS = $(am_crypt_OBJECTS)
crypt_DEPENDENCIES = ../src/libtoken.la $(LIBOBJS)
@ -94,10 +98,11 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(crypt_SOURCES) $(decrypt_SOURCES) $(dyntype_SOURCES) \
$(hash_SOURCES) $(packet_SOURCES)
DIST_SOURCES = $(crypt_SOURCES) $(decrypt_SOURCES) $(dyntype_SOURCES) \
$(hash_SOURCES) $(packet_SOURCES)
SOURCES = $(cclassTest_SOURCES) $(crypt_SOURCES) $(decrypt_SOURCES) \
$(dyntype_SOURCES) $(hash_SOURCES) $(packet_SOURCES)
DIST_SOURCES = $(cclassTest_SOURCES) $(crypt_SOURCES) \
$(decrypt_SOURCES) $(dyntype_SOURCES) $(hash_SOURCES) \
$(packet_SOURCES)
ETAGS = etags
CTAGS = ctags
am__tty_colors = \
@ -232,6 +237,9 @@ hash_CFLAGS = -I ../include -I ..
packet_SOURCES = packet.c
packet_LDADD = ../src/libtoken.la $(LIBOBJS)
packet_CFLAGS = -I ../include -I ..
cclassTest_SOURCES = runtest.c cclassTest.c mock/class.c
cclassTest_LDADD = ../src/libtoken.la $(LIBOBJS)
cclassTest_CFLAGS = -I ../include -I .. -I .
all: all-am
.SUFFIXES:
@ -275,6 +283,9 @@ clean-checkPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
cclassTest$(EXEEXT): $(cclassTest_OBJECTS) $(cclassTest_DEPENDENCIES)
@rm -f cclassTest$(EXEEXT)
$(cclassTest_LINK) $(cclassTest_OBJECTS) $(cclassTest_LDADD) $(LIBS)
crypt$(EXEEXT): $(crypt_OBJECTS) $(crypt_DEPENDENCIES)
@rm -f crypt$(EXEEXT)
$(crypt_LINK) $(crypt_OBJECTS) $(crypt_LDADD) $(LIBS)
@ -297,6 +308,9 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cclassTest-cclassTest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cclassTest-class.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cclassTest-runtest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crypt-base64.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crypt-crypt.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decrypt-base64.Po@am__quote@
@ -326,6 +340,48 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
cclassTest-runtest.o: runtest.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cclassTest_CFLAGS) $(CFLAGS) -MT cclassTest-runtest.o -MD -MP -MF $(DEPDIR)/cclassTest-runtest.Tpo -c -o cclassTest-runtest.o `test -f 'runtest.c' || echo '$(srcdir)/'`runtest.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cclassTest-runtest.Tpo $(DEPDIR)/cclassTest-runtest.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtest.c' object='cclassTest-runtest.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cclassTest_CFLAGS) $(CFLAGS) -c -o cclassTest-runtest.o `test -f 'runtest.c' || echo '$(srcdir)/'`runtest.c
cclassTest-runtest.obj: runtest.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cclassTest_CFLAGS) $(CFLAGS) -MT cclassTest-runtest.obj -MD -MP -MF $(DEPDIR)/cclassTest-runtest.Tpo -c -o cclassTest-runtest.obj `if test -f 'runtest.c'; then $(CYGPATH_W) 'runtest.c'; else $(CYGPATH_W) '$(srcdir)/runtest.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cclassTest-runtest.Tpo $(DEPDIR)/cclassTest-runtest.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtest.c' object='cclassTest-runtest.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cclassTest_CFLAGS) $(CFLAGS) -c -o cclassTest-runtest.obj `if test -f 'runtest.c'; then $(CYGPATH_W) 'runtest.c'; else $(CYGPATH_W) '$(srcdir)/runtest.c'; fi`
cclassTest-cclassTest.o: cclassTest.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cclassTest_CFLAGS) $(CFLAGS) -MT cclassTest-cclassTest.o -MD -MP -MF $(DEPDIR)/cclassTest-cclassTest.Tpo -c -o cclassTest-cclassTest.o `test -f 'cclassTest.c' || echo '$(srcdir)/'`cclassTest.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cclassTest-cclassTest.Tpo $(DEPDIR)/cclassTest-cclassTest.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cclassTest.c' object='cclassTest-cclassTest.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cclassTest_CFLAGS) $(CFLAGS) -c -o cclassTest-cclassTest.o `test -f 'cclassTest.c' || echo '$(srcdir)/'`cclassTest.c
cclassTest-cclassTest.obj: cclassTest.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cclassTest_CFLAGS) $(CFLAGS) -MT cclassTest-cclassTest.obj -MD -MP -MF $(DEPDIR)/cclassTest-cclassTest.Tpo -c -o cclassTest-cclassTest.obj `if test -f 'cclassTest.c'; then $(CYGPATH_W) 'cclassTest.c'; else $(CYGPATH_W) '$(srcdir)/cclassTest.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cclassTest-cclassTest.Tpo $(DEPDIR)/cclassTest-cclassTest.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cclassTest.c' object='cclassTest-cclassTest.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cclassTest_CFLAGS) $(CFLAGS) -c -o cclassTest-cclassTest.obj `if test -f 'cclassTest.c'; then $(CYGPATH_W) 'cclassTest.c'; else $(CYGPATH_W) '$(srcdir)/cclassTest.c'; fi`
cclassTest-class.o: mock/class.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cclassTest_CFLAGS) $(CFLAGS) -MT cclassTest-class.o -MD -MP -MF $(DEPDIR)/cclassTest-class.Tpo -c -o cclassTest-class.o `test -f 'mock/class.c' || echo '$(srcdir)/'`mock/class.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cclassTest-class.Tpo $(DEPDIR)/cclassTest-class.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mock/class.c' object='cclassTest-class.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cclassTest_CFLAGS) $(CFLAGS) -c -o cclassTest-class.o `test -f 'mock/class.c' || echo '$(srcdir)/'`mock/class.c
cclassTest-class.obj: mock/class.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cclassTest_CFLAGS) $(CFLAGS) -MT cclassTest-class.obj -MD -MP -MF $(DEPDIR)/cclassTest-class.Tpo -c -o cclassTest-class.obj `if test -f 'mock/class.c'; then $(CYGPATH_W) 'mock/class.c'; else $(CYGPATH_W) '$(srcdir)/mock/class.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cclassTest-class.Tpo $(DEPDIR)/cclassTest-class.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mock/class.c' object='cclassTest-class.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cclassTest_CFLAGS) $(CFLAGS) -c -o cclassTest-class.obj `if test -f 'mock/class.c'; then $(CYGPATH_W) 'mock/class.c'; else $(CYGPATH_W) '$(srcdir)/mock/class.c'; fi`
crypt-crypt.o: crypt.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(crypt_CFLAGS) $(CFLAGS) -MT crypt-crypt.o -MD -MP -MF $(DEPDIR)/crypt-crypt.Tpo -c -o crypt-crypt.o `test -f 'crypt.c' || echo '$(srcdir)/'`crypt.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/crypt-crypt.Tpo $(DEPDIR)/crypt-crypt.Po

18
tests/cclassTest.c

@ -5,25 +5,30 @@
#include "mock/class.h"
#include "token/cclass.h"
const char testname[] = "cclassTest";
char testname[] = "cclassTest";
struct MOCK_CLASS * mock = NULL;
static
void
setUp()
__setUp()
{
mock = NULL;
_reset();
}
void (* const setUp)() = __setUp;
static
void
tearDown()
__tearDown()
{
if (NULL != mock) {
delete(&mock);
}
}
void (* const tearDown)() = __tearDown;
static
int
testNew(void)
{
@ -36,6 +41,7 @@ testNew(void)
return TEST_OK;
}
static
int
testNewFromJson(void)
{
@ -51,6 +57,7 @@ testNewFromJson(void)
return TEST_OK;
}
static
int
testDelete(void)
{
@ -67,6 +74,7 @@ testDelete(void)
return TEST_OK;
}
static
int
testToJson(void)
{
@ -86,12 +94,12 @@ testToJson(void)
return TEST_OK;
}
testfunc tests[] = {
const testfunc tests[] = {
testNew,
testNewFromJson,
testDelete,
testToJson
};
size_t count = FUNCS_COUNT(tests);
const size_t count = FUNCS_COUNT(tests);
// vim: set et ts=4 sw=4:

6
tests/mock/class.h

@ -6,11 +6,7 @@
extern char _called;
extern void inline
_reset()
{
_called = 0;
}
extern void inline _reset();
struct MOCK_CLASS {
const struct CCLASS * const class;

90
tests/runtest.c

@ -1,7 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <dirent.h>
#include <string.h>
#include <sys/types.h>
@ -19,64 +17,18 @@ const char results[3] = {
};
void *
load_symbol(void * dlhandle, const char * const symbol)
{
void * sym = dlsym(dlhandle, symbol);
char * error;
if ((error = dlerror()) != NULL) {
fprintf(stderr, "%s\n", error);
}
return sym;
}
void
runtests(
const char * const filename,
size_t * _count,
size_t * failures,
size_t * errors)
int
main(int argc, char * argv[])
{
size_t * count;
testfunc * tests;
const char * const testname;
//char * const * funcnames;
char testfile[NAME_MAX+3] = "./";
strcat(testfile, filename);
void (*setUp)() = NULL;
void (*tearDown)() = NULL;
size_t errors = 0;
size_t failures = 0;
size_t assertions = 0;
size_t index;
void * dlhandle;
dlhandle = dlopen(testfile, RTLD_LAZY);
if (!dlhandle) {
fprintf(stderr, "%s\n", dlerror());
exit(EXIT_FAILURE);
}
* (void **) (&count) = load_symbol(dlhandle, "count");
* (void **) (&tests) = load_symbol(dlhandle, "tests");
* (void **) (&testname) = load_symbol(dlhandle, "testname");
// * (void **) (&funcnames) = load_symbol(dlhandle, "funcnames");
* (void **) (&setUp) = load_symbol(dlhandle, "setUp");
* (void **) (&tearDown) = load_symbol(dlhandle, "tearDown");
if (NULL == count || NULL == tests || NULL == testname) {
*errors = TEST_ERROR;
return;
}
*_count += *count;
printf("running tests for %s\n", testname);
for (index=0; index<*count; index++) {
for (index=0; index<count; index++) {
int result;
if (NULL != setUp) {
@ -90,8 +42,8 @@ runtests(
}
switch (result) {
case TEST_FAILED: (*failures)++; break;
case TEST_ERROR: (*errors)++; break;
case TEST_FAILED: failures++; break;
case TEST_ERROR: errors++; break;
}
putchar(results[result]);
@ -104,32 +56,6 @@ runtests(
}
puts("\n");
dlclose(dlhandle);
}
int
main(int argc, char * argv[])
{
size_t count = 0;
size_t errors = 0;
size_t failures = 0;
size_t assertions = 0;
DIR * dir;
struct dirent * dirent;
dir = opendir(".");
dirent = readdir(dir);
while (dirent) {
if (0 == strcmp("Test.la", dirent->d_name + strlen(dirent->d_name) - 7)) {
runtests(dirent->d_name, &count, &failures, &errors);
}
dirent = readdir(dir);
}
closedir(dir);
printf("running %lu tests: %lu - OK, %lu - FAILED, %lu - ERRORS\n",
count,
count - errors - failures,

9
tests/runtest.h

@ -16,10 +16,15 @@ enum RESULT_TYPES {
#define ASSERT_NOT_EQUAL(val1,val2) if ((val1) == (val2)) return TEST_FAILED
typedef int (* testfunc)(void);
typedef int (* const testfunc)(void);
#define FUNCS_COUNT(array) (sizeof((array)) / sizeof(testfunc))
extern char testname[];
extern const char testname[];
extern testfunc tests[];
extern const size_t count;
extern void (* const setUp)();
extern void (* const tearDown)();
#endif//__RUNTEST_h__
// vim: set et ts=4 sw=4:
Loading…
Cancel
Save