Commit 58a2aba86eae3d4a56eb0f5d3b2c22858c2fdb8b

Authored by Georg Hopp
1 parent c2bc1b06

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.
  1 +2011-11-16 19:32:44 +0100 Georg Hopp
  2 +
  3 + * 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)
  4 +
  5 +2011-11-16 18:14:51 +0100 Georg Hopp
  6 +
  7 + * 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.
  8 +
  9 +2011-11-16 09:09:32 +0100 Georg Hopp
  10 +
  11 + * work on test <<framework>> (origin/master, origin/HEAD)
  12 +
  13 +2011-11-15 21:26:08 +0100 Georg Hopp
  14 +
  15 + * add copyright note to all source files
  16 +
  17 +2011-11-15 14:50:57 +0100 Georg Hopp
  18 +
  19 + * Merge branch 'master' of 192.168.10.10:/var/lib/git/token
  20 +
  21 +2011-11-15 14:49:51 +0100 Georg Hopp
  22 +
  23 + * use autotools now with ebuild
  24 +
1 25 2011-11-15 14:49:51 +0100 Georg Hopp
2 26
3   - * use autotools now with ebuild (HEAD, origin/master, origin/HEAD, master)
  27 + * use autotools now with ebuild
4 28
5 29 2011-11-15 14:35:15 +0100 Georg Hopp
6 30
... ...
... ... @@ -42,10 +42,7 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
42 42 compile config.guess config.sub depcomp install-sh ltmain.sh \
43 43 missing
44 44 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
45   -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
46   - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
47   - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
48   - $(top_srcdir)/configure.ac
  45 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac
49 46 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
50 47 $(ACLOCAL_M4)
51 48 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
... ...
This diff could not be displayed because it is too large.
... ... @@ -7895,10 +7895,6 @@ _lt_linker_boilerplate=`cat conftest.err`
7895 7895 $RM -r conftest*
7896 7896
7897 7897
7898   -## CAVEAT EMPTOR:
7899   -## There is no encapsulation within the following macros, do not change
7900   -## the running order or otherwise move them around unless you know exactly
7901   -## what you are doing...
7902 7898 if test -n "$compiler"; then
7903 7899
7904 7900 lt_prog_compiler_no_builtin_flag=
... ...
... ... @@ -38,10 +38,7 @@ subdir = include
38 38 DIST_COMMON = $(nobase_include_HEADERS) $(srcdir)/Makefile.am \
39 39 $(srcdir)/Makefile.in
40 40 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
41   -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
42   - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
43   - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
44   - $(top_srcdir)/configure.ac
  41 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac
45 42 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
46 43 $(ACLOCAL_M4)
47 44 mkinstalldirs = $(install_sh) -d
... ...
1 1 ACLOCAL_AMFLAGS = -I m4
2 2
3   -lib_LTLIBRARIES = libtoken.la
  3 +lib_LTLIBRARIES = libtoken.la
4 4 libtoken_la_SOURCES = cclass.c crypt.c dyntype.c dyntype/hash.c packet.c
5 5 libtoken_la_CFLAGS = -I ../include
6 6 libtoken_la_LDFLAGS = -version-info 0:0:0
... ...
... ... @@ -37,10 +37,7 @@ host_triplet = @host@
37 37 subdir = src
38 38 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
39 39 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
40   -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
41   - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
42   - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
43   - $(top_srcdir)/configure.ac
  40 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac
44 41 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
45 42 $(ACLOCAL_M4)
46 43 mkinstalldirs = $(install_sh) -d
... ...
1 1 ACLOCAL_AMFLAGS = -I m4
2 2
3   -TESTS = crypt decrypt dyntype hash packet runtest
4   -check_PROGRAMS = crypt decrypt dyntype hash packet runtest
5   -noinst_LTLIBRARIES = cclassTest.la
  3 +TESTS = crypt decrypt dyntype hash packet cclassTest
  4 +check_PROGRAMS = crypt decrypt dyntype hash packet cclassTest
6 5
7 6 crypt_SOURCES = crypt.c ../base64.c
8 7 crypt_LDADD = ../src/libtoken.la $(LIBOBJS)
... ... @@ -24,10 +23,6 @@ packet_SOURCES = packet.c
24 23 packet_LDADD = ../src/libtoken.la $(LIBOBJS)
25 24 packet_CFLAGS = -I ../include -I ..
26 25
27   -cclassTest_la_SOURCES = cclassTest.c
28   -cclassTest_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
29   -cclassTest_la_CFLAGS = -nostartfiles -fPIC -I. -I../include
30   -
31   -runtest_SOURCES = runtest.c
32   -runtest_LDADD = ../src/libtoken.la $(LIBOBJS) -ldl
33   -runtest_CFLAGS = -rdynamic
  26 +cclassTest_SOURCES = runtest.c cclassTest.c mock/class.c
  27 +cclassTest_LDADD = ../src/libtoken.la $(LIBOBJS)
  28 +cclassTest_CFLAGS = -I ../include -I .. -I .
... ...
... ... @@ -34,22 +34,26 @@ POST_UNINSTALL = :
34 34 build_triplet = @build@
35 35 host_triplet = @host@
36 36 TESTS = crypt$(EXEEXT) decrypt$(EXEEXT) dyntype$(EXEEXT) hash$(EXEEXT) \
37   - packet$(EXEEXT)
  37 + packet$(EXEEXT) cclassTest$(EXEEXT)
38 38 check_PROGRAMS = crypt$(EXEEXT) decrypt$(EXEEXT) dyntype$(EXEEXT) \
39   - hash$(EXEEXT) packet$(EXEEXT)
  39 + hash$(EXEEXT) packet$(EXEEXT) cclassTest$(EXEEXT)
40 40 subdir = tests
41 41 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
42 42 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
43   -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
44   - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
45   - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
46   - $(top_srcdir)/configure.ac
  43 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac
47 44 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
48 45 $(ACLOCAL_M4)
49 46 mkinstalldirs = $(install_sh) -d
50 47 CONFIG_HEADER = $(top_builddir)/config.h
51 48 CONFIG_CLEAN_FILES =
52 49 CONFIG_CLEAN_VPATH_FILES =
  50 +am_cclassTest_OBJECTS = cclassTest-runtest.$(OBJEXT) \
  51 + cclassTest-cclassTest.$(OBJEXT) cclassTest-class.$(OBJEXT)
  52 +cclassTest_OBJECTS = $(am_cclassTest_OBJECTS)
  53 +cclassTest_DEPENDENCIES = ../src/libtoken.la $(LIBOBJS)
  54 +cclassTest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
  55 + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(cclassTest_CFLAGS) \
  56 + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
53 57 am_crypt_OBJECTS = crypt-crypt.$(OBJEXT) crypt-base64.$(OBJEXT)
54 58 crypt_OBJECTS = $(am_crypt_OBJECTS)
55 59 crypt_DEPENDENCIES = ../src/libtoken.la $(LIBOBJS)
... ... @@ -94,10 +98,11 @@ CCLD = $(CC)
94 98 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
95 99 --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
96 100 $(LDFLAGS) -o $@
97   -SOURCES = $(crypt_SOURCES) $(decrypt_SOURCES) $(dyntype_SOURCES) \
98   - $(hash_SOURCES) $(packet_SOURCES)
99   -DIST_SOURCES = $(crypt_SOURCES) $(decrypt_SOURCES) $(dyntype_SOURCES) \
100   - $(hash_SOURCES) $(packet_SOURCES)
  101 +SOURCES = $(cclassTest_SOURCES) $(crypt_SOURCES) $(decrypt_SOURCES) \
  102 + $(dyntype_SOURCES) $(hash_SOURCES) $(packet_SOURCES)
  103 +DIST_SOURCES = $(cclassTest_SOURCES) $(crypt_SOURCES) \
  104 + $(decrypt_SOURCES) $(dyntype_SOURCES) $(hash_SOURCES) \
  105 + $(packet_SOURCES)
101 106 ETAGS = etags
102 107 CTAGS = ctags
103 108 am__tty_colors = \
... ... @@ -232,6 +237,9 @@ hash_CFLAGS = -I ../include -I ..
232 237 packet_SOURCES = packet.c
233 238 packet_LDADD = ../src/libtoken.la $(LIBOBJS)
234 239 packet_CFLAGS = -I ../include -I ..
  240 +cclassTest_SOURCES = runtest.c cclassTest.c mock/class.c
  241 +cclassTest_LDADD = ../src/libtoken.la $(LIBOBJS)
  242 +cclassTest_CFLAGS = -I ../include -I .. -I .
235 243 all: all-am
236 244
237 245 .SUFFIXES:
... ... @@ -275,6 +283,9 @@ clean-checkPROGRAMS:
275 283 list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
276 284 echo " rm -f" $$list; \
277 285 rm -f $$list
  286 +cclassTest$(EXEEXT): $(cclassTest_OBJECTS) $(cclassTest_DEPENDENCIES)
  287 + @rm -f cclassTest$(EXEEXT)
  288 + $(cclassTest_LINK) $(cclassTest_OBJECTS) $(cclassTest_LDADD) $(LIBS)
278 289 crypt$(EXEEXT): $(crypt_OBJECTS) $(crypt_DEPENDENCIES)
279 290 @rm -f crypt$(EXEEXT)
280 291 $(crypt_LINK) $(crypt_OBJECTS) $(crypt_LDADD) $(LIBS)
... ... @@ -297,6 +308,9 @@ mostlyclean-compile:
297 308 distclean-compile:
298 309 -rm -f *.tab.c
299 310
  311 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cclassTest-cclassTest.Po@am__quote@
  312 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cclassTest-class.Po@am__quote@
  313 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cclassTest-runtest.Po@am__quote@
300 314 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crypt-base64.Po@am__quote@
301 315 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crypt-crypt.Po@am__quote@
302 316 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decrypt-base64.Po@am__quote@
... ... @@ -326,6 +340,48 @@ distclean-compile:
326 340 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
327 341 @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
328 342
  343 +cclassTest-runtest.o: runtest.c
  344 +@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
  345 +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cclassTest-runtest.Tpo $(DEPDIR)/cclassTest-runtest.Po
  346 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtest.c' object='cclassTest-runtest.o' libtool=no @AMDEPBACKSLASH@
  347 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
  348 +@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
  349 +
  350 +cclassTest-runtest.obj: runtest.c
  351 +@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`
  352 +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cclassTest-runtest.Tpo $(DEPDIR)/cclassTest-runtest.Po
  353 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtest.c' object='cclassTest-runtest.obj' libtool=no @AMDEPBACKSLASH@
  354 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
  355 +@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`
  356 +
  357 +cclassTest-cclassTest.o: cclassTest.c
  358 +@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
  359 +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cclassTest-cclassTest.Tpo $(DEPDIR)/cclassTest-cclassTest.Po
  360 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cclassTest.c' object='cclassTest-cclassTest.o' libtool=no @AMDEPBACKSLASH@
  361 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
  362 +@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
  363 +
  364 +cclassTest-cclassTest.obj: cclassTest.c
  365 +@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`
  366 +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cclassTest-cclassTest.Tpo $(DEPDIR)/cclassTest-cclassTest.Po
  367 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cclassTest.c' object='cclassTest-cclassTest.obj' libtool=no @AMDEPBACKSLASH@
  368 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
  369 +@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`
  370 +
  371 +cclassTest-class.o: mock/class.c
  372 +@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
  373 +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cclassTest-class.Tpo $(DEPDIR)/cclassTest-class.Po
  374 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mock/class.c' object='cclassTest-class.o' libtool=no @AMDEPBACKSLASH@
  375 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
  376 +@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
  377 +
  378 +cclassTest-class.obj: mock/class.c
  379 +@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`
  380 +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/cclassTest-class.Tpo $(DEPDIR)/cclassTest-class.Po
  381 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mock/class.c' object='cclassTest-class.obj' libtool=no @AMDEPBACKSLASH@
  382 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
  383 +@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`
  384 +
329 385 crypt-crypt.o: crypt.c
330 386 @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
331 387 @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/crypt-crypt.Tpo $(DEPDIR)/crypt-crypt.Po
... ...
... ... @@ -5,25 +5,30 @@
5 5 #include "mock/class.h"
6 6 #include "token/cclass.h"
7 7
  8 +const char testname[] = "cclassTest";
8 9
9   -char testname[] = "cclassTest";
10 10 struct MOCK_CLASS * mock = NULL;
11 11
  12 +static
12 13 void
13   -setUp()
  14 +__setUp()
14 15 {
15 16 mock = NULL;
16 17 _reset();
17 18 }
  19 +void (* const setUp)() = __setUp;
18 20
  21 +static
19 22 void
20   -tearDown()
  23 +__tearDown()
21 24 {
22 25 if (NULL != mock) {
23 26 delete(&mock);
24 27 }
25 28 }
  29 +void (* const tearDown)() = __tearDown;
26 30
  31 +static
27 32 int
28 33 testNew(void)
29 34 {
... ... @@ -36,6 +41,7 @@ testNew(void)
36 41 return TEST_OK;
37 42 }
38 43
  44 +static
39 45 int
40 46 testNewFromJson(void)
41 47 {
... ... @@ -51,6 +57,7 @@ testNewFromJson(void)
51 57 return TEST_OK;
52 58 }
53 59
  60 +static
54 61 int
55 62 testDelete(void)
56 63 {
... ... @@ -67,6 +74,7 @@ testDelete(void)
67 74 return TEST_OK;
68 75 }
69 76
  77 +static
70 78 int
71 79 testToJson(void)
72 80 {
... ... @@ -86,12 +94,12 @@ testToJson(void)
86 94 return TEST_OK;
87 95 }
88 96
89   -testfunc tests[] = {
  97 +const testfunc tests[] = {
90 98 testNew,
91 99 testNewFromJson,
92 100 testDelete,
93 101 testToJson
94 102 };
95   -size_t count = FUNCS_COUNT(tests);
  103 +const size_t count = FUNCS_COUNT(tests);
96 104
97 105 // vim: set et ts=4 sw=4:
... ...
... ... @@ -6,11 +6,7 @@
6 6
7 7 extern char _called;
8 8
9   -extern void inline
10   -_reset()
11   -{
12   - _called = 0;
13   -}
  9 +extern void inline _reset();
14 10
15 11 struct MOCK_CLASS {
16 12 const struct CCLASS * const class;
... ...
1 1 #include <stdio.h>
2 2 #include <stdlib.h>
3   -#include <dlfcn.h>
4   -#include <dirent.h>
5 3 #include <string.h>
6 4 #include <sys/types.h>
7 5
... ... @@ -19,64 +17,18 @@ const char results[3] = {
19 17 };
20 18
21 19
22   -void *
23   -load_symbol(void * dlhandle, const char * const symbol)
24   -{
25   - void * sym = dlsym(dlhandle, symbol);
26   - char * error;
27   -
28   - if ((error = dlerror()) != NULL) {
29   - fprintf(stderr, "%s\n", error);
30   - }
31   -
32   - return sym;
33   -}
34   -
35   -void
36   -runtests(
37   - const char * const filename,
38   - size_t * _count,
39   - size_t * failures,
40   - size_t * errors)
  20 +int
  21 +main(int argc, char * argv[])
41 22 {
42   - size_t * count;
43   - testfunc * tests;
44   - const char * const testname;
45   - //char * const * funcnames;
46   - char testfile[NAME_MAX+3] = "./";
47   -
48   - strcat(testfile, filename);
49   -
50   - void (*setUp)() = NULL;
51   - void (*tearDown)() = NULL;
  23 + size_t errors = 0;
  24 + size_t failures = 0;
  25 + size_t assertions = 0;
52 26
53 27 size_t index;
54   - void * dlhandle;
55   -
56   - dlhandle = dlopen(testfile, RTLD_LAZY);
57   - if (!dlhandle) {
58   - fprintf(stderr, "%s\n", dlerror());
59   - exit(EXIT_FAILURE);
60   - }
61   -
62   - * (void **) (&count) = load_symbol(dlhandle, "count");
63   - * (void **) (&tests) = load_symbol(dlhandle, "tests");
64   - * (void **) (&testname) = load_symbol(dlhandle, "testname");
65   - // * (void **) (&funcnames) = load_symbol(dlhandle, "funcnames");
66   -
67   - * (void **) (&setUp) = load_symbol(dlhandle, "setUp");
68   - * (void **) (&tearDown) = load_symbol(dlhandle, "tearDown");
69   -
70   - if (NULL == count || NULL == tests || NULL == testname) {
71   - *errors = TEST_ERROR;
72   - return;
73   - }
74   -
75   - *_count += *count;
76 28
77 29 printf("running tests for %s\n", testname);
78 30
79   - for (index=0; index<*count; index++) {
  31 + for (index=0; index<count; index++) {
80 32 int result;
81 33
82 34 if (NULL != setUp) {
... ... @@ -90,8 +42,8 @@ runtests(
90 42 }
91 43
92 44 switch (result) {
93   - case TEST_FAILED: (*failures)++; break;
94   - case TEST_ERROR: (*errors)++; break;
  45 + case TEST_FAILED: failures++; break;
  46 + case TEST_ERROR: errors++; break;
95 47 }
96 48
97 49 putchar(results[result]);
... ... @@ -104,32 +56,6 @@ runtests(
104 56 }
105 57 puts("\n");
106 58
107   - dlclose(dlhandle);
108   -}
109   -
110   -int
111   -main(int argc, char * argv[])
112   -{
113   - size_t count = 0;
114   - size_t errors = 0;
115   - size_t failures = 0;
116   - size_t assertions = 0;
117   -
118   - DIR * dir;
119   - struct dirent * dirent;
120   -
121   - dir = opendir(".");
122   -
123   - dirent = readdir(dir);
124   - while (dirent) {
125   - if (0 == strcmp("Test.la", dirent->d_name + strlen(dirent->d_name) - 7)) {
126   - runtests(dirent->d_name, &count, &failures, &errors);
127   - }
128   -
129   - dirent = readdir(dir);
130   - }
131   - closedir(dir);
132   -
133 59 printf("running %lu tests: %lu - OK, %lu - FAILED, %lu - ERRORS\n",
134 60 count,
135 61 count - errors - failures,
... ...
... ... @@ -16,10 +16,15 @@ enum RESULT_TYPES {
16 16 #define ASSERT_NOT_EQUAL(val1,val2) if ((val1) == (val2)) return TEST_FAILED
17 17
18 18
19   -typedef int (* testfunc)(void);
  19 +typedef int (* const testfunc)(void);
20 20 #define FUNCS_COUNT(array) (sizeof((array)) / sizeof(testfunc))
21 21
22   -extern char testname[];
  22 +extern const char testname[];
  23 +extern testfunc tests[];
  24 +extern const size_t count;
  25 +
  26 +extern void (* const setUp)();
  27 +extern void (* const tearDown)();
23 28
24 29 #endif//__RUNTEST_h__
25 30 // vim: set et ts=4 sw=4:
... ...
Please register or login to post a comment