Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Convert config module to unit testing
[simgrid.git] / src / Makefile.am
index b33deed..a840e16 100644 (file)
@@ -39,7 +39,7 @@ EXTRA_DIST= \
        include/surf/maxmin.h \
        include/surf/trace_mgr.h \
        include/surf/surf.h \
-       include/surf/surf_parse.h \
+       include/surf/surf_parse_private.h \
        \
        include/xbt/xbt_portability.h \
        include/xbt/context.h \
@@ -52,7 +52,7 @@ EXTRA_DIST= \
        gras/DataDesc/ddt_parse.yy.l          gras/DataDesc/ddt_parse.yy.c \
        \
        amok/Bandwidth/bandwidth_private.h
-               
+
 #        gras_private.h
 
 #LIBRARY_VERSION= 0:0:0
@@ -94,13 +94,18 @@ VERSION_INFO= -release 20050627 -version-info 0:0:0
 #   using this trick is ready for a "stable" release (say, in Debian).
 
 lib_LTLIBRARIES= libsimgrid.la libgras.la
+noinst_PROGRAMS=testall
 
 COMMON_SRC=\
+  \
+  xbt/snprintf.c                                                             \
+  xbt/ex.c                                                                   \
   \
   xbt_modinter.h    gras_modinter.h                                          \
   \
   xbt/sysdep.c                                                               \
-  xbt/log.c         xbt/log_default_appender.c   xbt/error.c                 \
+  xbt/asserts.c                                                              \
+  xbt/log.c         xbt/log_default_appender.c                               \
   xbt/dynar.c                                                                \
   xbt/dict.c        xbt/dict_elm.c               xbt/dict_cursor.c           \
   xbt/dict_multi.c                                                           \
@@ -110,10 +115,11 @@ COMMON_SRC=\
   xbt/set.c                                                                  \
   xbt/module.c                                                               \
   xbt/config.c                                                               \
+  xbt/cunit.c                                                                \
   \
   gras/gras.c \
   \
-  gras/Transport/transport.c          gras/Transport/transport_private.h   gras/Transport/transport_plugin_buf.c  \
+  gras/Transport/transport.c          gras/Transport/transport_private.h  \
   \
   gras/DataDesc/ddt_create.c          \
   gras/DataDesc/ddt_convert.c         gras/DataDesc/ddt_exchange.c     \
@@ -127,11 +133,14 @@ COMMON_SRC=\
   gras/Virtu/process.c
 
 RL_SRC= \
-  gras/Transport/rl_transport.c  gras/Transport/transport_plugin_tcp.c  gras/Transport/transport_plugin_file.c  \
+  gras/Transport/rl_transport.c          \
+  gras/Transport/transport_plugin_file.c   gras/Transport/transport_plugin_tcp.c  \
   \
   gras/Virtu/rl_emul.c \
   gras/Virtu/rl_process.c        gras/Virtu/rl_time.c \
-  gras/Virtu/rl_dns.c
+  gras/Virtu/rl_dns.c\
+  \
+  gras/Msg/rl_msg.c
 
 SG_SRC=  \
   xbt/context.c                                                                \
@@ -144,7 +153,6 @@ SG_SRC=  \
   surf/surf_timer.c                                                               \
   surf/network_dassf.c                                                       \
   surf/workstation_KCCFLN05.c  \
-  include/surf/surfxml.h \
   \
   msg/msg_config.c \
   msg/task.c msg/host.c msg/m_process.c msg/gos.c \
@@ -154,16 +162,48 @@ SG_SRC=  \
   \
   gras/Virtu/sg_emul.c \
   gras/Virtu/sg_process.c        gras/Virtu/sg_time.c     \
-  gras/Virtu/sg_dns.c
+  gras/Virtu/sg_dns.c\
+  \
+  gras/Msg/sg_msg.c
 
 AMOK_SRC= \
   amok/base.c \
   amok/Bandwidth/bandwidth.c amok/Bandwidth/saturate.c
-        
-                        
 
-BUILT_SOURCES=include/surf/surfxml.h surf/surfxml.c \
-              gras/DataDesc/ddt_parse.yy.c
+###
+### Testing infrastructure
+###
+
+TEST_CFILES=xbt/cunit.c  xbt/ex.c  xbt/config.c
+TEST_UNITS= cunit_unit.c ex_unit.c config_unit.c
+
+BUILT_SOURCES=../include/surf/surfxml.h surf/surfxml.c \
+              gras/DataDesc/ddt_parse.yy.c \
+              $(TEST_UNITS) simgrid_units_main.c
+
+testall_SOURCES= $(TEST_UNITS) simgrid_units_main.c
+testall_LDADD=libgras.la
+
+if MAINTAINER_MODE
+%_unit.c: $(TEST_CFILES) @top_srcdir@/tools/sg_unit_extractor.pl
+       @echo TEST_UNITS=$(TEST_UNITS)
+       @echo testall_SOURCES=$(testall_SOURCES)
+       @lookfor=`echo $@ | sed 's/_unit.c$$/.c/'`;      \
+        for s in $(TEST_CFILES) ; do                    \
+           if echo $$s | grep $$lookfor >/dev/null; then \
+             src="$$src $$s";                            \
+           fi;                                           \
+          done;                                          \
+         echo "Generate Testing Suite $@ from$$src";    \
+         @top_srcdir@/tools/sg_unit_extractor.pl $$src
+
+simgrid_units_main.c: $(TEST_UNITS)
+endif
+
+###
+### Regenerate what needs to with flex & flexml
+###
+
 
 gras/DataDesc/ddt_parse.yy.c: gras/DataDesc/ddt_parse.yy.l
        @LEX@ -o$@ -Pgras_ddt_parse_ $^
@@ -174,14 +214,12 @@ surf/surfxml.c: surf/surfxml.l
 
 if HAVE_FLEXML
 surf/surfxml.l: surf/surfxml.dtd
-       set -e; cd surf; flexml -b 1000000 -S -L surfxml.dtd ; \
-       mv surfxml.l surfxml.l.bak ; \
-       sed 's/surfxml\.h/surf\/surfxml\.h/g' surfxml.l.bak > surfxml.l
-include/surf/surfxml.h: surf/surfxml.dtd
-       cd include/surf; flexml -H -L ../../surf/surfxml.dtd
+       set -e; cd surf; flexml -b 1000000 -S -L surfxml.dtd
+../include/surf/surfxml.h: surf/surfxml.dtd
+       cd ../include/surf; flexml -H -L ../../src/surf/surfxml.dtd
 else
 
-include/surf/surfxml.h surf/surfxml.l: surf/surfxml.dtd
+../include/surf/surfxml.h surf/surfxml.l: surf/surfxml.dtd
        @echo "ERROR: src/surf/surfxml.dtd was modified, but the flexml program was not detected"
        @echo "ERROR: Please install it, or if you didn't modify this file, try this:"
        @echo "ERROR:   touch src/include/surf/surfxml.h src/surf/surfxml.l"
@@ -189,11 +227,16 @@ include/surf/surfxml.h surf/surfxml.l: surf/surfxml.dtd
 endif
 endif
 
+###
+### Declare the library content
+###
+
 libgras_la_SOURCES= $(COMMON_SRC) $(RL_SRC) $(AMOK_SRC)
-libgras_la_LDFLAGS = $(VERSION_INFO) @GRAS_DEP@ -lm
+libgras_la_LDFLAGS = $(VERSION_INFO) @GRAS_DEP@ @LD_DYNAMIC_FLAGS@ -lm 
 
 libsimgrid_la_SOURCES= $(COMMON_SRC) $(SG_SRC) $(AMOK_SRC)
-libsimgrid_la_LDFLAGS = $(VERSION_INFO) @SIMGRID_DEP@ -lm
+libsimgrid_la_LDFLAGS = $(VERSION_INFO) @SIMGRID_DEP@ @LD_DYNAMIC_FLAGS@ -lm
+
 
 
 include $(top_srcdir)/acmacro/dist-files.mk