From e4a4b01c32b54cfb3e7080d32efec1c5a27c1359 Mon Sep 17 00:00:00 2001 From: mquinson Date: Thu, 13 Sep 2007 12:32:28 +0000 Subject: [PATCH] New test to ensure the semantic of gras_msg_handle(i) when i<0, i==0 and i>0 git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@4616 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- teshsuite/Makefile.am | 32 ++++- teshsuite/Makefile.in | 118 ++++++++++++++++- teshsuite/gras/msg_handle/msg_handle.c | 153 +++++++++++++++++++++++ teshsuite/gras/msg_handle/msg_handle.xml | 12 ++ teshsuite/gras/msg_handle/test_rl | 17 +++ teshsuite/gras/msg_handle/test_sg_32 | 14 +++ teshsuite/gras/msg_handle/test_sg_64 | 14 +++ 7 files changed, 354 insertions(+), 6 deletions(-) create mode 100644 teshsuite/gras/msg_handle/msg_handle.c create mode 100644 teshsuite/gras/msg_handle/msg_handle.xml create mode 100755 teshsuite/gras/msg_handle/test_rl create mode 100755 teshsuite/gras/msg_handle/test_sg_32 create mode 100755 teshsuite/gras/msg_handle/test_sg_64 diff --git a/teshsuite/Makefile.am b/teshsuite/Makefile.am index 5550ad02f8..af369d12d9 100644 --- a/teshsuite/Makefile.am +++ b/teshsuite/Makefile.am @@ -20,7 +20,7 @@ LDADD_RL=$(abs_top_builddir)/src/libgras.la ## Try parallel logs ## ####################### - + TESTS += xbt/parallel_log_crashtest.tesh noinst_PROGRAMS += xbt/parallel_log_crashtest xbt_parallel_log_crashtest_LDADD = $(LDADD_RL) @@ -31,7 +31,7 @@ xbt_parallel_log_crashtest_LDADD = $(LDADD_RL) ## Try structured communication facilities ## ############################################# - + CLEANFILES += gras/datadesc/datadesc_usage.out EXTRA_DIST += \ gras/datadesc/datadesc.little32_4 \ @@ -53,7 +53,7 @@ XFAIL_TESTS+= \ gras/datadesc/datadesc_r_big32_8.tesh \ gras/datadesc/datadesc_r_big32_8_4.tesh \ gras/datadesc/datadesc_r_big32_2.tesh - + noinst_PROGRAMS += gras/datadesc/datadesc_usage gras_datadesc_datadesc_usage_SOURCES= gras/datadesc/datadesc_usage.c gras/datadesc/datadesc_structs.c gras_datadesc_datadesc_usage_LDADD= $(LDADD_RL) @@ -61,4 +61,30 @@ gras_datadesc_datadesc_usage_LDADD= $(LDADD_RL) gras/datadesc/datadesc_structs.c: gras/datadesc/mk_datadesc_structs.pl cd gras/datadesc ; perl ../$(top_srcdir)/teshsuite/gras/datadesc/mk_datadesc_structs.pl > datadesc_structs.c + ## Ensures the gras_msg_handle semantic ## + ########################################## +EXTRA_DIST += gras/msg_handle/msg_handle.xml +noinst_PROGRAMS+=\ + gras/msg_handle/msg_handle_client \ + gras/msg_handle/msg_handle_server \ + gras/msg_handle/msg_handle_simulator + +gras_msg_handle_msg_handle_simulator_SOURCES= gras/msg_handle/msg_handle.c gras/msg_handle/_msg_handle_simulator.c +gras_msg_handle_msg_handle_client_SOURCES= gras/msg_handle/msg_handle.c gras/msg_handle/_msg_handle_client.c +gras_msg_handle_msg_handle_server_SOURCES= gras/msg_handle/msg_handle.c gras/msg_handle/_msg_handle_server.c + +gras_msg_handle_msg_handle_simulator_LDADD= $(LDADD_SG) +gras_msg_handle_msg_handle_client_LDADD= $(LDADD_RL) +gras_msg_handle_msg_handle_server_LDADD= $(LDADD_RL) + +gras/msg_handle/_msg_handle_simulator.c gras/msg_handle/_msg_handle_client.c gras/msg_handle/_msg_handle_server.c : gras/msg_handle/msg_handle.c gras/msg_handle/msg_handle.xml $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ + cd gras/msg_handle; ../../$(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ msg_handle $(srcdir)/msg_handle.xml + +if GRAS_ARCH_32_BITS + TESTS += gras/msg_handle/test_rl gras/msg_handle/test_sg_32 +else + TESTS += gras/msg_handle/test_rl gras/msg_handle/test_sg_64 +endif + + include $(top_srcdir)/acmacro/dist-files.mk diff --git a/teshsuite/Makefile.in b/teshsuite/Makefile.in index 95d1f6d2d0..b9a7d5aa11 100644 --- a/teshsuite/Makefile.in +++ b/teshsuite/Makefile.in @@ -39,7 +39,12 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ noinst_PROGRAMS = xbt/parallel_log_crashtest$(EXEEXT) \ - gras/datadesc/datadesc_usage$(EXEEXT) + gras/datadesc/datadesc_usage$(EXEEXT) \ + gras/msg_handle/msg_handle_client$(EXEEXT) \ + gras/msg_handle/msg_handle_server$(EXEEXT) \ + gras/msg_handle/msg_handle_simulator$(EXEEXT) +@GRAS_ARCH_32_BITS_TRUE@am__append_1 = gras/msg_handle/test_rl gras/msg_handle/test_sg_32 +@GRAS_ARCH_32_BITS_FALSE@am__append_2 = gras/msg_handle/test_rl gras/msg_handle/test_sg_64 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/acmacro/dist-files.mk subdir = teshsuite @@ -64,6 +69,21 @@ gras_datadesc_datadesc_usage_OBJECTS = \ $(am_gras_datadesc_datadesc_usage_OBJECTS) gras_datadesc_datadesc_usage_DEPENDENCIES = $(LDADD_RL) am__dirstamp = $(am__leading_dot)dirstamp +am_gras_msg_handle_msg_handle_client_OBJECTS = msg_handle.$(OBJEXT) \ + _msg_handle_client.$(OBJEXT) +gras_msg_handle_msg_handle_client_OBJECTS = \ + $(am_gras_msg_handle_msg_handle_client_OBJECTS) +gras_msg_handle_msg_handle_client_DEPENDENCIES = $(LDADD_RL) +am_gras_msg_handle_msg_handle_server_OBJECTS = msg_handle.$(OBJEXT) \ + _msg_handle_server.$(OBJEXT) +gras_msg_handle_msg_handle_server_OBJECTS = \ + $(am_gras_msg_handle_msg_handle_server_OBJECTS) +gras_msg_handle_msg_handle_server_DEPENDENCIES = $(LDADD_RL) +am_gras_msg_handle_msg_handle_simulator_OBJECTS = \ + msg_handle.$(OBJEXT) _msg_handle_simulator.$(OBJEXT) +gras_msg_handle_msg_handle_simulator_OBJECTS = \ + $(am_gras_msg_handle_msg_handle_simulator_OBJECTS) +gras_msg_handle_msg_handle_simulator_DEPENDENCIES = $(LDADD_SG) xbt_parallel_log_crashtest_SOURCES = xbt/parallel_log_crashtest.c xbt_parallel_log_crashtest_OBJECTS = parallel_log_crashtest.$(OBJEXT) xbt_parallel_log_crashtest_DEPENDENCIES = $(LDADD_RL) @@ -80,8 +100,14 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(gras_datadesc_datadesc_usage_SOURCES) \ + $(gras_msg_handle_msg_handle_client_SOURCES) \ + $(gras_msg_handle_msg_handle_server_SOURCES) \ + $(gras_msg_handle_msg_handle_simulator_SOURCES) \ xbt/parallel_log_crashtest.c DIST_SOURCES = $(gras_datadesc_datadesc_usage_SOURCES) \ + $(gras_msg_handle_msg_handle_client_SOURCES) \ + $(gras_msg_handle_msg_handle_server_SOURCES) \ + $(gras_msg_handle_msg_handle_simulator_SOURCES) \ xbt/parallel_log_crashtest.c ETAGS = etags CTAGS = ctags @@ -231,7 +257,8 @@ EXTRA_DIST = gras/datadesc/datadesc.little32_4 \ gras/datadesc/datadesc.little64 gras/datadesc/datadesc.big32_8 \ gras/datadesc/datadesc.big32_8_4 \ gras/datadesc/datadesc.big32_2 \ - gras/datadesc/mk_datadesc_structs.pl + gras/datadesc/mk_datadesc_structs.pl \ + gras/msg_handle/msg_handle.xml TESTS_ENVIRONMENT = $(top_builddir)/tools/tesh/tesh TESTS = xbt/parallel_log_crashtest.tesh \ gras/datadesc/datadesc_mem.tesh gras/datadesc/datadesc_rw.tesh \ @@ -239,7 +266,8 @@ TESTS = xbt/parallel_log_crashtest.tesh \ gras/datadesc/datadesc_r_little64.tesh \ gras/datadesc/datadesc_r_big32_8.tesh \ gras/datadesc/datadesc_r_big32_8_4.tesh \ - gras/datadesc/datadesc_r_big32_2.tesh + gras/datadesc/datadesc_r_big32_2.tesh $(am__append_1) \ + $(am__append_2) # Data sets still to regenerate: XFAIL_TESTS = gras/datadesc/datadesc_r_little32.tesh \ gras/datadesc/datadesc_r_big32_8.tesh \ @@ -250,6 +278,12 @@ LDADD_RL = $(abs_top_builddir)/src/libgras.la xbt_parallel_log_crashtest_LDADD = $(LDADD_RL) gras_datadesc_datadesc_usage_SOURCES = gras/datadesc/datadesc_usage.c gras/datadesc/datadesc_structs.c gras_datadesc_datadesc_usage_LDADD = $(LDADD_RL) +gras_msg_handle_msg_handle_simulator_SOURCES = gras/msg_handle/msg_handle.c gras/msg_handle/_msg_handle_simulator.c +gras_msg_handle_msg_handle_client_SOURCES = gras/msg_handle/msg_handle.c gras/msg_handle/_msg_handle_client.c +gras_msg_handle_msg_handle_server_SOURCES = gras/msg_handle/msg_handle.c gras/msg_handle/_msg_handle_server.c +gras_msg_handle_msg_handle_simulator_LDADD = $(LDADD_SG) +gras_msg_handle_msg_handle_client_LDADD = $(LDADD_RL) +gras_msg_handle_msg_handle_server_LDADD = $(LDADD_RL) all: all-am .SUFFIXES: @@ -296,6 +330,18 @@ gras/datadesc/$(am__dirstamp): gras/datadesc/datadesc_usage$(EXEEXT): $(gras_datadesc_datadesc_usage_OBJECTS) $(gras_datadesc_datadesc_usage_DEPENDENCIES) gras/datadesc/$(am__dirstamp) @rm -f gras/datadesc/datadesc_usage$(EXEEXT) $(LINK) $(gras_datadesc_datadesc_usage_OBJECTS) $(gras_datadesc_datadesc_usage_LDADD) $(LIBS) +gras/msg_handle/$(am__dirstamp): + @$(MKDIR_P) gras/msg_handle + @: > gras/msg_handle/$(am__dirstamp) +gras/msg_handle/msg_handle_client$(EXEEXT): $(gras_msg_handle_msg_handle_client_OBJECTS) $(gras_msg_handle_msg_handle_client_DEPENDENCIES) gras/msg_handle/$(am__dirstamp) + @rm -f gras/msg_handle/msg_handle_client$(EXEEXT) + $(LINK) $(gras_msg_handle_msg_handle_client_OBJECTS) $(gras_msg_handle_msg_handle_client_LDADD) $(LIBS) +gras/msg_handle/msg_handle_server$(EXEEXT): $(gras_msg_handle_msg_handle_server_OBJECTS) $(gras_msg_handle_msg_handle_server_DEPENDENCIES) gras/msg_handle/$(am__dirstamp) + @rm -f gras/msg_handle/msg_handle_server$(EXEEXT) + $(LINK) $(gras_msg_handle_msg_handle_server_OBJECTS) $(gras_msg_handle_msg_handle_server_LDADD) $(LIBS) +gras/msg_handle/msg_handle_simulator$(EXEEXT): $(gras_msg_handle_msg_handle_simulator_OBJECTS) $(gras_msg_handle_msg_handle_simulator_DEPENDENCIES) gras/msg_handle/$(am__dirstamp) + @rm -f gras/msg_handle/msg_handle_simulator$(EXEEXT) + $(LINK) $(gras_msg_handle_msg_handle_simulator_OBJECTS) $(gras_msg_handle_msg_handle_simulator_LDADD) $(LIBS) xbt/$(am__dirstamp): @$(MKDIR_P) xbt @: > xbt/$(am__dirstamp) @@ -309,8 +355,12 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_msg_handle_client.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_msg_handle_server.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_msg_handle_simulator.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datadesc_structs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/datadesc_usage.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msg_handle.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parallel_log_crashtest.Po@am__quote@ .c.o: @@ -362,6 +412,62 @@ datadesc_structs.obj: gras/datadesc/datadesc_structs.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o datadesc_structs.obj `if test -f 'gras/datadesc/datadesc_structs.c'; then $(CYGPATH_W) 'gras/datadesc/datadesc_structs.c'; else $(CYGPATH_W) '$(srcdir)/gras/datadesc/datadesc_structs.c'; fi` +msg_handle.o: gras/msg_handle/msg_handle.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT msg_handle.o -MD -MP -MF $(DEPDIR)/msg_handle.Tpo -c -o msg_handle.o `test -f 'gras/msg_handle/msg_handle.c' || echo '$(srcdir)/'`gras/msg_handle/msg_handle.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/msg_handle.Tpo $(DEPDIR)/msg_handle.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gras/msg_handle/msg_handle.c' object='msg_handle.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) $(AM_CFLAGS) $(CFLAGS) -c -o msg_handle.o `test -f 'gras/msg_handle/msg_handle.c' || echo '$(srcdir)/'`gras/msg_handle/msg_handle.c + +msg_handle.obj: gras/msg_handle/msg_handle.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT msg_handle.obj -MD -MP -MF $(DEPDIR)/msg_handle.Tpo -c -o msg_handle.obj `if test -f 'gras/msg_handle/msg_handle.c'; then $(CYGPATH_W) 'gras/msg_handle/msg_handle.c'; else $(CYGPATH_W) '$(srcdir)/gras/msg_handle/msg_handle.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/msg_handle.Tpo $(DEPDIR)/msg_handle.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gras/msg_handle/msg_handle.c' object='msg_handle.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) $(AM_CFLAGS) $(CFLAGS) -c -o msg_handle.obj `if test -f 'gras/msg_handle/msg_handle.c'; then $(CYGPATH_W) 'gras/msg_handle/msg_handle.c'; else $(CYGPATH_W) '$(srcdir)/gras/msg_handle/msg_handle.c'; fi` + +_msg_handle_client.o: gras/msg_handle/_msg_handle_client.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT _msg_handle_client.o -MD -MP -MF $(DEPDIR)/_msg_handle_client.Tpo -c -o _msg_handle_client.o `test -f 'gras/msg_handle/_msg_handle_client.c' || echo '$(srcdir)/'`gras/msg_handle/_msg_handle_client.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/_msg_handle_client.Tpo $(DEPDIR)/_msg_handle_client.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gras/msg_handle/_msg_handle_client.c' object='_msg_handle_client.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) $(AM_CFLAGS) $(CFLAGS) -c -o _msg_handle_client.o `test -f 'gras/msg_handle/_msg_handle_client.c' || echo '$(srcdir)/'`gras/msg_handle/_msg_handle_client.c + +_msg_handle_client.obj: gras/msg_handle/_msg_handle_client.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT _msg_handle_client.obj -MD -MP -MF $(DEPDIR)/_msg_handle_client.Tpo -c -o _msg_handle_client.obj `if test -f 'gras/msg_handle/_msg_handle_client.c'; then $(CYGPATH_W) 'gras/msg_handle/_msg_handle_client.c'; else $(CYGPATH_W) '$(srcdir)/gras/msg_handle/_msg_handle_client.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/_msg_handle_client.Tpo $(DEPDIR)/_msg_handle_client.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gras/msg_handle/_msg_handle_client.c' object='_msg_handle_client.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) $(AM_CFLAGS) $(CFLAGS) -c -o _msg_handle_client.obj `if test -f 'gras/msg_handle/_msg_handle_client.c'; then $(CYGPATH_W) 'gras/msg_handle/_msg_handle_client.c'; else $(CYGPATH_W) '$(srcdir)/gras/msg_handle/_msg_handle_client.c'; fi` + +_msg_handle_server.o: gras/msg_handle/_msg_handle_server.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT _msg_handle_server.o -MD -MP -MF $(DEPDIR)/_msg_handle_server.Tpo -c -o _msg_handle_server.o `test -f 'gras/msg_handle/_msg_handle_server.c' || echo '$(srcdir)/'`gras/msg_handle/_msg_handle_server.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/_msg_handle_server.Tpo $(DEPDIR)/_msg_handle_server.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gras/msg_handle/_msg_handle_server.c' object='_msg_handle_server.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) $(AM_CFLAGS) $(CFLAGS) -c -o _msg_handle_server.o `test -f 'gras/msg_handle/_msg_handle_server.c' || echo '$(srcdir)/'`gras/msg_handle/_msg_handle_server.c + +_msg_handle_server.obj: gras/msg_handle/_msg_handle_server.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT _msg_handle_server.obj -MD -MP -MF $(DEPDIR)/_msg_handle_server.Tpo -c -o _msg_handle_server.obj `if test -f 'gras/msg_handle/_msg_handle_server.c'; then $(CYGPATH_W) 'gras/msg_handle/_msg_handle_server.c'; else $(CYGPATH_W) '$(srcdir)/gras/msg_handle/_msg_handle_server.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/_msg_handle_server.Tpo $(DEPDIR)/_msg_handle_server.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gras/msg_handle/_msg_handle_server.c' object='_msg_handle_server.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) $(AM_CFLAGS) $(CFLAGS) -c -o _msg_handle_server.obj `if test -f 'gras/msg_handle/_msg_handle_server.c'; then $(CYGPATH_W) 'gras/msg_handle/_msg_handle_server.c'; else $(CYGPATH_W) '$(srcdir)/gras/msg_handle/_msg_handle_server.c'; fi` + +_msg_handle_simulator.o: gras/msg_handle/_msg_handle_simulator.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT _msg_handle_simulator.o -MD -MP -MF $(DEPDIR)/_msg_handle_simulator.Tpo -c -o _msg_handle_simulator.o `test -f 'gras/msg_handle/_msg_handle_simulator.c' || echo '$(srcdir)/'`gras/msg_handle/_msg_handle_simulator.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/_msg_handle_simulator.Tpo $(DEPDIR)/_msg_handle_simulator.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gras/msg_handle/_msg_handle_simulator.c' object='_msg_handle_simulator.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) $(AM_CFLAGS) $(CFLAGS) -c -o _msg_handle_simulator.o `test -f 'gras/msg_handle/_msg_handle_simulator.c' || echo '$(srcdir)/'`gras/msg_handle/_msg_handle_simulator.c + +_msg_handle_simulator.obj: gras/msg_handle/_msg_handle_simulator.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT _msg_handle_simulator.obj -MD -MP -MF $(DEPDIR)/_msg_handle_simulator.Tpo -c -o _msg_handle_simulator.obj `if test -f 'gras/msg_handle/_msg_handle_simulator.c'; then $(CYGPATH_W) 'gras/msg_handle/_msg_handle_simulator.c'; else $(CYGPATH_W) '$(srcdir)/gras/msg_handle/_msg_handle_simulator.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/_msg_handle_simulator.Tpo $(DEPDIR)/_msg_handle_simulator.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gras/msg_handle/_msg_handle_simulator.c' object='_msg_handle_simulator.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) $(AM_CFLAGS) $(CFLAGS) -c -o _msg_handle_simulator.obj `if test -f 'gras/msg_handle/_msg_handle_simulator.c'; then $(CYGPATH_W) 'gras/msg_handle/_msg_handle_simulator.c'; else $(CYGPATH_W) '$(srcdir)/gras/msg_handle/_msg_handle_simulator.c'; fi` + parallel_log_crashtest.o: xbt/parallel_log_crashtest.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT parallel_log_crashtest.o -MD -MP -MF $(DEPDIR)/parallel_log_crashtest.Tpo -c -o parallel_log_crashtest.o `test -f 'xbt/parallel_log_crashtest.c' || echo '$(srcdir)/'`xbt/parallel_log_crashtest.c @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/parallel_log_crashtest.Tpo $(DEPDIR)/parallel_log_crashtest.Po @@ -585,6 +691,7 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -rm -f gras/datadesc/$(am__dirstamp) + -rm -f gras/msg_handle/$(am__dirstamp) -rm -f xbt/$(am__dirstamp) maintainer-clean-generic: @@ -681,6 +788,11 @@ uninstall-am: gras/datadesc/datadesc_structs.c: gras/datadesc/mk_datadesc_structs.pl cd gras/datadesc ; perl ../$(top_srcdir)/teshsuite/gras/datadesc/mk_datadesc_structs.pl > datadesc_structs.c + ########################################## + +gras/msg_handle/_msg_handle_simulator.c gras/msg_handle/_msg_handle_client.c gras/msg_handle/_msg_handle_server.c : gras/msg_handle/msg_handle.c gras/msg_handle/msg_handle.xml $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ + cd gras/msg_handle; ../../$(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ msg_handle $(srcdir)/msg_handle.xml + dist-files: @for n in $(DISTFILES) ; do echo $(SRCFILE)$$n; done @echo diff --git a/teshsuite/gras/msg_handle/msg_handle.c b/teshsuite/gras/msg_handle/msg_handle.c new file mode 100644 index 0000000000..bac7f9b3e7 --- /dev/null +++ b/teshsuite/gras/msg_handle/msg_handle.c @@ -0,0 +1,153 @@ +/* $Id: mmrpc.c 3399 2007-04-11 19:34:43Z cherierm $ */ + +/* msg_handle - ensures the semantic of gras_msg_handle(i) for i<0,=0 or >0 */ + +/* Copyright (c) 2007 Martin Quinson. All rights reserved. */ +/* Thanks to Flavien Vernier for reporting an issue around this */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include "gras.h" + +XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Messages specific to this test"); + +int server (int argc,char *argv[]); +int client (int argc,char *argv[]); + +static int server_cb_hello_handler(gras_msg_cb_ctx_t ctx, + void *payload_data) { + INFO0("Got the message"); + return 0; +} + +int server (int argc,char *argv[]) { + gras_socket_t me=NULL,pal=NULL; + int myport; + char *palstr; + + xbt_ex_t e; + int got_expected; + double now; + + + gras_init(&argc,argv); + + xbt_assert0(argc == 3,"Usage: server "); + myport=atoi(argv[1]); + palstr = argv[2]; + + gras_msgtype_declare("hello", NULL); + gras_cb_register("hello",&server_cb_hello_handler); + + INFO1("Launch server (port=%d)", myport); + TRY { + me = gras_socket_server(myport); + } CATCH(e) { + RETHROW0("Unable to establish a server socket: %s"); + } + gras_os_sleep(1); /* Wait for pal to startup */ + TRY { + pal = gras_socket_client_from_string(palstr); + } CATCH(e) { + RETHROW1("Unable to establish a socket to %s: %s",palstr); + } + INFO0("Initialization done."); + now = gras_os_time(); + + /* Launch handle(0) when there is no message. Timeout expected */ + got_expected = 0; + TRY { + gras_msg_handle(0); + } CATCH(e) { + if (e.category == timeout_error) { + got_expected = 1; + xbt_ex_free(e); + } else { + RETHROW0("Didn't got the expected timeout: %s"); + } + } + xbt_assert0(got_expected,"gras_msg_handle(0) do not lead to any timeout exception"); + xbt_assert1(gras_os_time() - now < 0.01, + "gras_msg_handle(0) do not anwser immediately (%.4fsec)", + gras_os_time() - now); + INFO0("gras_msg_handle(0) works as expected (imediate timeout)"); + /* Launch handle(0) when there is no message. Timeout expected */ + got_expected = 0; + TRY { + gras_msg_handle(1); + } CATCH(e) { + if (e.category == timeout_error) { + got_expected = 1; + xbt_ex_free(e); + } else { + RETHROW0("Didn't got the expected timeout: %s"); + } + } + xbt_assert0(got_expected,"gras_msg_handle(1) do not lead to any timeout exception"); + xbt_assert1(gras_os_time() - now < 1.5, + "gras_msg_handle(1) needs more than 1.5 sec to answer (%.4fsec)", + gras_os_time() - now); + xbt_assert1(gras_os_time() - now >= 1.0, + "gras_msg_handle(1) answers in less than one second (%.4fsec)", + gras_os_time() - now); + INFO0("gras_msg_handle(1) works as expected (delayed timeout)"); + gras_os_sleep(3); + + /* Send an hello to the client to unlock it */ + INFO0("Unlock pal"); + gras_msg_send(pal, "hello", NULL); + + /* Frees the allocated resources, and shut GRAS down */ + gras_socket_close(me); + gras_socket_close(pal); + gras_exit(); + return 0; +} + +int client(int argc,char *argv[]) { + gras_socket_t me=NULL,pal=NULL; + int myport; + char *palstr; + + xbt_ex_t e; + int got_expected; + + + gras_init(&argc,argv); + xbt_assert0(argc == 3,"Usage: client "); + myport=atoi(argv[1]); + palstr = argv[2]; + + gras_msgtype_declare("hello", NULL); + gras_cb_register("hello",&server_cb_hello_handler); + + INFO1("Launch client (port=%d)", myport); + TRY { + me = gras_socket_server(myport); + } CATCH(e) { + RETHROW0("Unable to establish a server socket: %s"); + } + gras_os_sleep(1); /* Wait for pal to startup */ + TRY { + pal = gras_socket_client_from_string(palstr); + } CATCH(e) { + RETHROW1("Unable to establish a socket to %s: %s",palstr); + } + INFO0("Initialization done."); + + /* Launch handle(-1). Lock until message from server expected */ + got_expected = 0; + TRY { + gras_msg_handle(-1); + } CATCH(e) { + RETHROW0("No exception expected during handle(-1), but got %s"); + } + INFO0("gras_msg_handle(-1) works as expected (locked)"); + + /* Frees the allocated resources, and shut GRAS down */ + gras_socket_close(me); + gras_socket_close(pal); + gras_exit(); + return 0; +} diff --git a/teshsuite/gras/msg_handle/msg_handle.xml b/teshsuite/gras/msg_handle/msg_handle.xml new file mode 100644 index 0000000000..0900aa3e14 --- /dev/null +++ b/teshsuite/gras/msg_handle/msg_handle.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/teshsuite/gras/msg_handle/test_rl b/teshsuite/gras/msg_handle/test_rl new file mode 100755 index 0000000000..124a7cc9a2 --- /dev/null +++ b/teshsuite/gras/msg_handle/test_rl @@ -0,0 +1,17 @@ + +! timeout 20 +& $SG_TEST_ENV gras/msg_handle/msg_handle_server$EXEEXT 4002 127.0.0.1:4003 --log=root.fmt=%P:%t%e%m%n $ARGS +> server:main Launch server (port=4002) +> server:main Initialization done. +> server:main gras_msg_handle(0) works as expected (imediate timeout) +> server:main gras_msg_handle(1) works as expected (delayed timeout) +> server:main Unlock pal +> server:main Exiting GRAS + +! timeout 20 +& $SG_TEST_ENV gras/msg_handle/msg_handle_client$EXEEXT 4003 127.0.0.1:4002 --log=root.fmt=%P:%t%e%m%n $ARGS +> client:main Launch client (port=4003) +> client:main Initialization done. +> client:main Got the message +> client:main gras_msg_handle(-1) works as expected (locked) +> client:main Exiting GRAS diff --git a/teshsuite/gras/msg_handle/test_sg_32 b/teshsuite/gras/msg_handle/test_sg_32 new file mode 100755 index 0000000000..1d2c20ed02 --- /dev/null +++ b/teshsuite/gras/msg_handle/test_sg_32 @@ -0,0 +1,14 @@ +p Runs the 'msg_handle' test within the simulator (simulation times valid for 32bits architectures) + +$ $SG_TEST_EXENV gras/msg_handle/msg_handle_simulator$EXEEXT ${srcdir:=.}/../examples/msg/small_platform.xml ${srcdir:=.}/gras/msg_handle/msg_handle.xml +> [Tremblay:server:(1) 0.000000] [test/INFO] Launch server (port=4000) +> [Fafard:client:(2) 0.000000] [test/INFO] Launch client (port=4000) +> [Tremblay:server:(1) 1.000000] [test/INFO] Initialization done. +> [Tremblay:server:(1) 1.000000] [test/INFO] gras_msg_handle(0) works as expected (imediate timeout) +> [Fafard:client:(2) 1.000000] [test/INFO] Initialization done. +> [Tremblay:server:(1) 2.000000] [test/INFO] gras_msg_handle(1) works as expected (delayed timeout) +> [Tremblay:server:(1) 5.000000] [test/INFO] Unlock pal +> [Tremblay:server:(1) 5.001976] [gras/INFO] Exiting GRAS +> [Fafard:client:(2) 5.001976] [test/INFO] Got the message +> [Fafard:client:(2) 5.001976] [test/INFO] gras_msg_handle(-1) works as expected (locked) +> [Fafard:client:(2) 5.001976] [gras/INFO] Exiting GRAS diff --git a/teshsuite/gras/msg_handle/test_sg_64 b/teshsuite/gras/msg_handle/test_sg_64 new file mode 100755 index 0000000000..a2bcae7fc4 --- /dev/null +++ b/teshsuite/gras/msg_handle/test_sg_64 @@ -0,0 +1,14 @@ +p Runs the 'msg_handle' test within the simulator (simulation times valid for 64bits architectures) + +$ $SG_TEST_EXENV gras/msg_handle/msg_handle_simulator$EXEEXT ${srcdir:=.}/../examples/msg/small_platform.xml ${srcdir:=.}/gras/msg_handle/msg_handle.xml +> [Tremblay:server:(1) 0.000000] [test/INFO] Launch server (port=4000) +> [Fafard:client:(2) 0.000000] [test/INFO] Launch client (port=4000) +> [Tremblay:server:(1) 1.000000] [test/INFO] Initialization done. +> [Tremblay:server:(1) 1.000000] [test/INFO] gras_msg_handle(0) works as expected (imediate timeout) +> [Fafard:client:(2) 1.000000] [test/INFO] Initialization done. +> [Tremblay:server:(1) 2.000000] [test/INFO] gras_msg_handle(1) works as expected (delayed timeout) +> [Tremblay:server:(1) 5.000000] [test/INFO] Unlock pal +> [Tremblay:server:(1) 5.001976] [gras/INFO] Exiting GRAS +> [Fafard:client:(2) 5.001976] [test/INFO] Got the message +> [Fafard:client:(2) 5.001976] [test/INFO] gras_msg_handle(-1) works as expected (locked) +> [Fafard:client:(2) 5.001976] [gras/INFO] Exiting GRAS -- 2.20.1