From fb16e0570dc67c637041ae0e5c339e29bc35078b Mon Sep 17 00:00:00 2001 From: mquinson Date: Wed, 11 Jul 2007 11:15:55 +0000 Subject: [PATCH] Test case for the gras_agent_spawn function git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3730 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- configure.ac | 1 + examples/gras/Makefile.am | 2 +- examples/gras/Makefile.in | 2 +- examples/gras/spawn/.cvsignore | 3 + examples/gras/spawn/Makefile.am | 24 ++ examples/gras/spawn/Makefile.in | 633 +++++++++++++++++++++++++++++ examples/gras/spawn/spawn.h | 22 + examples/gras/spawn/spawn.xml | 8 + examples/gras/spawn/spawn_child.c | 68 ++++ examples/gras/spawn/spawn_common.c | 18 + examples/gras/spawn/spawn_father.c | 103 +++++ examples/gras/spawn/test_rl | 4 + examples/gras/spawn/test_sg_32 | 32 ++ examples/gras/spawn/test_sg_64 | 3 + 14 files changed, 921 insertions(+), 2 deletions(-) create mode 100644 examples/gras/spawn/.cvsignore create mode 100644 examples/gras/spawn/Makefile.am create mode 100644 examples/gras/spawn/Makefile.in create mode 100644 examples/gras/spawn/spawn.h create mode 100644 examples/gras/spawn/spawn.xml create mode 100644 examples/gras/spawn/spawn_child.c create mode 100644 examples/gras/spawn/spawn_common.c create mode 100644 examples/gras/spawn/spawn_father.c create mode 100755 examples/gras/spawn/test_rl create mode 100755 examples/gras/spawn/test_sg_32 create mode 100755 examples/gras/spawn/test_sg_64 diff --git a/configure.ac b/configure.ac index e39b82400a..fb2d5f42c9 100644 --- a/configure.ac +++ b/configure.ac @@ -433,6 +433,7 @@ AC_CONFIG_FILES([ examples/gras/Makefile examples/gras/ping/Makefile examples/gras/rpc/Makefile + examples/gras/spawn/Makefile examples/gras/timer/Makefile examples/gras/chrono/Makefile examples/gras/mutual_exclusion/simple_token/Makefile diff --git a/examples/gras/Makefile.am b/examples/gras/Makefile.am index 8f6267904f..45919b8617 100644 --- a/examples/gras/Makefile.am +++ b/examples/gras/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS= ping rpc timer chrono mutual_exclusion/simple_token mmrpc all2all pmm +SUBDIRS= ping rpc spawn timer chrono mutual_exclusion/simple_token mmrpc all2all pmm # p2p include $(top_srcdir)/acmacro/dist-files.mk diff --git a/examples/gras/Makefile.in b/examples/gras/Makefile.in index 87187673c1..d47b2d276e 100644 --- a/examples/gras/Makefile.in +++ b/examples/gras/Makefile.in @@ -205,7 +205,7 @@ target_os = @target_os@ target_vendor = @target_vendor@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = ping rpc timer chrono mutual_exclusion/simple_token mmrpc all2all pmm +SUBDIRS = ping rpc spawn timer chrono mutual_exclusion/simple_token mmrpc all2all pmm all: all-recursive .SUFFIXES: diff --git a/examples/gras/spawn/.cvsignore b/examples/gras/spawn/.cvsignore new file mode 100644 index 0000000000..afd19aa870 --- /dev/null +++ b/examples/gras/spawn/.cvsignore @@ -0,0 +1,3 @@ +.deps .libs Makefile _*.c spawn_father spawn_child spawn_simulator +spawn.mk +spawn.trace diff --git a/examples/gras/spawn/Makefile.am b/examples/gras/spawn/Makefile.am new file mode 100644 index 0000000000..7b188a8a18 --- /dev/null +++ b/examples/gras/spawn/Makefile.am @@ -0,0 +1,24 @@ +INCLUDES= -I$(top_srcdir)/include + +EXTRA_DIST=spawn.xml spawn.h +include $(top_srcdir)/examples/gras/tests.mk + +# AUTOMAKE variable definition +noinst_PROGRAMS=spawn_child spawn_father spawn_simulator + +spawn_simulator_SOURCES= _spawn_simulator.c spawn_father.c spawn_child.c spawn_common.c +spawn_simulator_LDADD= $(top_builddir)/src/libsimgrid.la + +spawn_child_SOURCES= _spawn_child.c spawn_child.c spawn_common.c +spawn_child_LDADD= $(top_builddir)/src/libgras.la + +spawn_father_SOURCES= _spawn_father.c spawn_father.c spawn_child.c spawn_common.c +spawn_father_LDADD= $(top_builddir)/src/libgras.la + +# Take care of generatated sources +NAME=spawn +PROCESSES= child father +include $(top_srcdir)/examples/temps-gras-stub.mk + +# Cruft +include $(top_srcdir)/acmacro/dist-files.mk diff --git a/examples/gras/spawn/Makefile.in b/examples/gras/spawn/Makefile.in new file mode 100644 index 0000000000..49541b90a0 --- /dev/null +++ b/examples/gras/spawn/Makefile.in @@ -0,0 +1,633 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# This file factorize all the testing infrastructure for the GRAS examples +# +# it's made complicated by the facts that: +# - we use tesh, we need to find it back +# - we don't want to generate the test_* files with configure, so we +# have to declare some variables in front of the shell command +# running the test +# - we want to fully test the surf on the way. So, we have to ask for +# full precision timestamps in the tests. On the other hand, +# message size differ when we are on 32bits and when we are on +# 64bits (obviously), so we have to maintain 2 tests per directory +# and pick the right one here. + +# Makefile chunk which allows to display the files which should be included +# into the distribution. + +# It is intended to be included in all Makefile.am + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/acmacro/dist-files.mk \ + $(top_srcdir)/examples/gras/tests.mk \ + $(top_srcdir)/examples/temps-gras-stub.mk +noinst_PROGRAMS = spawn_child$(EXEEXT) spawn_father$(EXEEXT) \ + spawn_simulator$(EXEEXT) +subdir = examples/gras/spawn +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acmacro/ac_func_snprintf.m4 \ + $(top_srcdir)/acmacro/compiler-flags.m4 \ + $(top_srcdir)/acmacro/context.m4 \ + $(top_srcdir)/acmacro/fancy_configury.m4 \ + $(top_srcdir)/acmacro/flex.m4 \ + $(top_srcdir)/acmacro/gras_arch.m4 \ + $(top_srcdir)/acmacro/print_null.m4 \ + $(top_srcdir)/acmacro/va_copy.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/src/gras_config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_spawn_child_OBJECTS = _spawn_child.$(OBJEXT) spawn_child.$(OBJEXT) \ + spawn_common.$(OBJEXT) +spawn_child_OBJECTS = $(am_spawn_child_OBJECTS) +spawn_child_DEPENDENCIES = $(top_builddir)/src/libgras.la +am_spawn_father_OBJECTS = _spawn_father.$(OBJEXT) \ + spawn_father.$(OBJEXT) spawn_child.$(OBJEXT) \ + spawn_common.$(OBJEXT) +spawn_father_OBJECTS = $(am_spawn_father_OBJECTS) +spawn_father_DEPENDENCIES = $(top_builddir)/src/libgras.la +am_spawn_simulator_OBJECTS = _spawn_simulator.$(OBJEXT) \ + spawn_father.$(OBJEXT) spawn_child.$(OBJEXT) \ + spawn_common.$(OBJEXT) +spawn_simulator_OBJECTS = $(am_spawn_simulator_OBJECTS) +spawn_simulator_DEPENDENCIES = $(top_builddir)/src/libsimgrid.la +DEFAULT_INCLUDES = -I. -I$(top_builddir)/src@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(spawn_child_SOURCES) $(spawn_father_SOURCES) \ + $(spawn_simulator_SOURCES) +DIST_SOURCES = $(spawn_child_SOURCES) $(spawn_father_SOURCES) \ + $(spawn_simulator_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADDR2LINE = @ADDR2LINE@ +AMTAR = @AMTAR@ +AM_CFLAGS = @AM_CFLAGS@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASH = @BASH@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOXYGEN = @DOXYGEN@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FLEXML = @FLEXML@ +GCJ = @GCJ@ +GCJDEPMODE = @GCJDEPMODE@ +GCJFLAGS = @GCJFLAGS@ +GRAS_DEP = @GRAS_DEP@ +GREP = @GREP@ +GTNETS_CFLAGS = @GTNETS_CFLAGS@ +GTNETS_LDFLAGS = @GTNETS_LDFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +JAR = @JAR@ +JAVA = @JAVA@ +JAVAC = @JAVAC@ +LDFLAGS = @LDFLAGS@ +LD_DYNAMIC_FLAGS = @LD_DYNAMIC_FLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MD5SUM = @MD5SUM@ +MKDIR_P = @MKDIR_P@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PTH_STACK_GROWTH = @PTH_STACK_GROWTH@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIMGRID_DEP = @SIMGRID_DEP@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WARNING = @WARNING@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_configure_args = @ac_configure_args@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_id = @build_id@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pth_skaddr_makecontext = @pth_skaddr_makecontext@ +pth_sksize_makecontext = @pth_sksize_makecontext@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = -I$(top_srcdir)/include +EXTRA_DIST = spawn.xml spawn.h test_rl test_sg_32 test_sg_64 +@GRAS_ARCH_32_BITS_FALSE@TESTS = test_sg_64 test_rl +@GRAS_ARCH_32_BITS_TRUE@TESTS = test_sg_32 test_rl +TESTS_ENVIRONMENT = srcdir=$(srcdir) EXEEXT=$(EXEEXT) @top_builddir@/tools/tesh/tesh +spawn_simulator_SOURCES = _spawn_simulator.c spawn_father.c spawn_child.c spawn_common.c +spawn_simulator_LDADD = $(top_builddir)/src/libsimgrid.la +spawn_child_SOURCES = _spawn_child.c spawn_child.c spawn_common.c +spawn_child_LDADD = $(top_builddir)/src/libgras.la +spawn_father_SOURCES = _spawn_father.c spawn_father.c spawn_child.c spawn_common.c +spawn_father_LDADD = $(top_builddir)/src/libgras.la + +# Take care of generatated sources +NAME = spawn +PROCESSES = child father +CLEANFILES = _$(NAME)_simulator.c $(NAME).mk $(NAME).Makefile.local $(NAME).Makefile.remote $(NAME).deploy.sh \ + $(foreach proc, $(PROCESSES), _$(NAME)_$(proc).c) + +MOSTLYCLEANFILES = $(NAME).trace +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/examples/gras/tests.mk $(top_srcdir)/examples/temps-gras-stub.mk $(top_srcdir)/acmacro/dist-files.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/gras/spawn/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu examples/gras/spawn/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +spawn_child$(EXEEXT): $(spawn_child_OBJECTS) $(spawn_child_DEPENDENCIES) + @rm -f spawn_child$(EXEEXT) + $(LINK) $(spawn_child_OBJECTS) $(spawn_child_LDADD) $(LIBS) +spawn_father$(EXEEXT): $(spawn_father_OBJECTS) $(spawn_father_DEPENDENCIES) + @rm -f spawn_father$(EXEEXT) + $(LINK) $(spawn_father_OBJECTS) $(spawn_father_LDADD) $(LIBS) +spawn_simulator$(EXEEXT): $(spawn_simulator_OBJECTS) $(spawn_simulator_DEPENDENCIES) + @rm -f spawn_simulator$(EXEEXT) + $(LINK) $(spawn_simulator_OBJECTS) $(spawn_simulator_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_spawn_child.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_spawn_father.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_spawn_simulator.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spawn_child.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spawn_common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spawn_father.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *$$ws$$tst$$ws*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + echo "SKIP: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -z "$$skipped" || echo "$$skipped"; \ + test -z "$$report" || echo "$$report"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-generic clean-libtool clean-noinstPROGRAMS ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + +@GRAS_ARCH_32_BITS_TRUE@test-sg: +@GRAS_ARCH_32_BITS_TRUE@ $(TESTS_ENVIRONMENT) test_sg_32 +@GRAS_ARCH_32_BITS_FALSE@test-sg: +@GRAS_ARCH_32_BITS_FALSE@ $(TESTS_ENVIRONMENT) test_sg_64 + +test-rl: force + $(TESTS_ENVIRONMENT) test_rl + +force: + +.PHONY: test_sg_32 test_SG_64 test_rl + +$(foreach proc, $(PROCESSES), _$(NAME)_$(proc).c) _$(NAME)_simulator.c: $(srcdir)/$(NAME).xml $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ + [ x@EXEEXT@ = x ] || exenv=wine; $$exenv $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ $(NAME) $(srcdir)/$(NAME).xml + +$(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@: + make -C $(top_builddir)/tools/gras/ gras_stub_generator@EXEEXT@ + +dist-files: + @for n in $(DISTFILES) ; do echo $(SRCFILE)$$n; done + @echo + @for n in $(DIST_SUBDIRS) ; do if [ x$$n != x. ] ; then $(MAKE) -C $$n dist-files SRCFILE=$(SRCFILE)$$n/ ; fi; done + +# Cruft +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/examples/gras/spawn/spawn.h b/examples/gras/spawn/spawn.h new file mode 100644 index 0000000000..358569e5d3 --- /dev/null +++ b/examples/gras/spawn/spawn.h @@ -0,0 +1,22 @@ +/* $Id$ */ + +/* spawn - demo of the gras_actor_spawn function */ + +/* Copyright (c) 2007 Martin Quinson. All rights reserved. */ + +/* 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. */ + +#ifndef SPAWN_COMMON_H +#define SPAWN_COMMON_H + +#include "gras.h" + +/* register messages which may be sent (common to client and server) */ +void spawn_register_messages(void); + +/* Function prototypes */ +int father (int argc,char *argv[]); +int child (int argc,char *argv[]); + +#endif diff --git a/examples/gras/spawn/spawn.xml b/examples/gras/spawn/spawn.xml new file mode 100644 index 0000000000..28500f29c2 --- /dev/null +++ b/examples/gras/spawn/spawn.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/examples/gras/spawn/spawn_child.c b/examples/gras/spawn/spawn_child.c new file mode 100644 index 0000000000..dd9b7f5ab5 --- /dev/null +++ b/examples/gras/spawn/spawn_child.c @@ -0,0 +1,68 @@ +/* $Id$ */ + +/* spawn - demo of the gras_agent_spawn function */ + +/* Copyright (c) 2007 Martin Quinson. All rights reserved. */ + +/* 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 "spawn.h" +XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(Spawn); + +int child(int argc,char *argv[]) { + xbt_ex_t e; + gras_socket_t dady=NULL; /* peer */ + + gras_socket_t from; + int ping, pong; + + const char *host = gras_os_myname(); + int port = 4000; + + /* 1. Init the GRAS's infrastructure */ + gras_init(&argc, argv); + + /* 2. Get the server's address. The command line override defaults when specified */ + if (argc == 2) { + port=atoi(argv[1]); + } + + gras_socket_server_range(4000,5000,0,0); + + /* 3. Connect back to my father */ + TRY { + dady=gras_socket_client(host,port); + } CATCH(e) { + RETHROW0("Unable to connect to my dady: %s"); + } + INFO4("I (%s:%d) have found my dady on %s:%d.", + gras_os_myname(),gras_os_myport(),host,port); + + + /* 4. Register the messages. */ + spawn_register_messages(); + + /* 5. Ping my dady */ + ping = 1234; + TRY { + gras_msg_send(dady, "ping", &ping); + } CATCH(e) { + gras_socket_close(dady); + RETHROW0("Failed to ping my dady: %s"); + } + + /* 6. Wait for the answer from the server, and deal with issues */ + TRY { + gras_msg_wait(6000,"pong", &from,&pong); + } CATCH(e) { + gras_socket_close(dady); + RETHROW0("Dad don't want to speak with me! : %s"); + } + INFO2("Pinged dad with %d, he answered with %d; leaving now.", ping, pong); + + /* 7. Free the allocated resources, and shut GRAS down */ + gras_socket_close(dady); + gras_exit(); + return 0; +} /* end_of_child */ diff --git a/examples/gras/spawn/spawn_common.c b/examples/gras/spawn/spawn_common.c new file mode 100644 index 0000000000..26d2cba0ed --- /dev/null +++ b/examples/gras/spawn/spawn_common.c @@ -0,0 +1,18 @@ +/* $Id$ */ + +/* spawn - demo of the gras_agent_spawn function */ + +/* Copyright (c) 2007 Martin Quinson. All rights reserved. */ + +/* 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 "spawn.h" +XBT_LOG_NEW_DEFAULT_CATEGORY(Spawn,"Messages specific to this example"); + +/* register messages which may be sent (common to client and server) */ +void spawn_register_messages(void) { + gras_msgtype_declare("ping", gras_datadesc_by_name("int")); + gras_msgtype_declare("pong", gras_datadesc_by_name("int")); +} + diff --git a/examples/gras/spawn/spawn_father.c b/examples/gras/spawn/spawn_father.c new file mode 100644 index 0000000000..0f012637f8 --- /dev/null +++ b/examples/gras/spawn/spawn_father.c @@ -0,0 +1,103 @@ +/* $Id$ */ + +/* spawn - demo of the gras_agent_spawn function */ + +/* Copyright (c) 2007 Martin Quinson. All rights reserved. */ + +/* 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 "spawn.h" + +XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(Spawn); + +/* Global private data */ +typedef struct { + gras_socket_t sock; + int msg_got; +} father_data_t; + + +static int father_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload) { + + xbt_ex_t e; + /* 1. Get the payload into the msg variable, and retrieve my caller */ + int msg=*(int*)payload; + gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx); + + /* 2. Retrieve the father's state (globals) */ + father_data_t *globals=(father_data_t*)gras_userdata_get(); + globals->msg_got++; + + /* 3. Log which client connected */ + INFO3("Kid %s:%d pinged me with %d", + gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor),msg); + + /* 4. Change the value of the msg variable */ + msg = 4321; + /* 5. Send it back as payload of a pong message to the expeditor */ + TRY { + gras_msg_send(expeditor, "pong", &msg); + + /* 6. Deal with errors: add some details to the exception */ + } CATCH(e) { + gras_socket_close(globals->sock); + RETHROW0("Unable to answer to my poor child: %s"); + } + INFO2("Answered to %s:%d's request", + gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor)); + + /* 7. Tell GRAS that we consummed this message */ + return 0; +} /* end_of_father_cb_ping_handler */ + +int father (int argc,char *argv[]) { + father_data_t *globals; + + int port = 4000; + int child_amount = 5; + char **child_args; + int i; + + /* 1. Init the GRAS infrastructure and declare my globals */ + gras_init(&argc,argv); + globals=gras_userdata_new(father_data_t); + + /* 2. Get args from the command line, if specified */ + if (argc == 2) { + port=atoi(argv[1]); + child_amount=atoi(argv[2]); + } + + /* 3. Initialize my globals (mainly create my master socket) */ + globals->sock = gras_socket_server(port); + globals->msg_got = 0; + + /* 4. Register the known messages. */ + spawn_register_messages(); + + /* 5. Register my callback */ + gras_cb_register("ping",&father_cb_ping_handler); + + /* 6. Spawn the kids */ + INFO0("Spawn the kids"); + for (i=0; imsg_got < child_amount) + gras_msg_handle(60.0); + INFO0("All kids gone. Leave now."); + + /* 8. Free the allocated resources, and shut GRAS down */ + gras_socket_close(globals->sock); + free(globals); + gras_exit(); + + return 0; +} /* end_of_father */ diff --git a/examples/gras/spawn/test_rl b/examples/gras/spawn/test_rl new file mode 100755 index 0000000000..3ca339509b --- /dev/null +++ b/examples/gras/spawn/test_rl @@ -0,0 +1,4 @@ + +! expect signal SIGABRT +! output ignore +$ $SG_TEST_ENV ./spawn_father$EXEEXT 4002 5 --log=root.fmt=%m%n diff --git a/examples/gras/spawn/test_sg_32 b/examples/gras/spawn/test_sg_32 new file mode 100755 index 0000000000..dcca4480af --- /dev/null +++ b/examples/gras/spawn/test_sg_32 @@ -0,0 +1,32 @@ +p Runs the 'spawn' test within the simulator (simulation times valid for 32bits architectures) + +$ $SG_TEST_EXENV ./spawn_simulator${EXEEXT:=} ${srcdir:=.}/../../msg/small_platform.xml ${srcdir:=.}/spawn.xml +> [Tremblay:father:(1) 0.000000] [Spawn/INFO] Spawn the kids +> [Tremblay:child:(2) 0.000000] [Spawn/INFO] I (Tremblay:4001) have found my dady on Tremblay:4000. +> [Tremblay:child:(3) 0.000000] [Spawn/INFO] I (Tremblay:4002) have found my dady on Tremblay:4000. +> [Tremblay:child:(4) 0.000000] [Spawn/INFO] I (Tremblay:4003) have found my dady on Tremblay:4000. +> [Tremblay:child:(5) 0.000000] [Spawn/INFO] I (Tremblay:4004) have found my dady on Tremblay:4000. +> [Tremblay:child:(6) 0.000000] [Spawn/INFO] I (Tremblay:4005) have found my dady on Tremblay:4000. +> [Tremblay:father:(1) 0.000015] [Spawn/INFO] Kid Tremblay:4001 pinged me with 1234 +> [Tremblay:child:(2) 0.000030] [Spawn/INFO] Pinged dad with 1234, he answered with 4321; leaving now. +> [Tremblay:child:(2) 0.000030] [gras/INFO] Exiting GRAS +> [Tremblay:father:(1) 0.000030] [Spawn/INFO] Answered to Tremblay:4001's request +> [Tremblay:father:(1) 0.000045] [Spawn/INFO] Kid Tremblay:4002 pinged me with 1234 +> [Tremblay:child:(3) 0.000060] [Spawn/INFO] Pinged dad with 1234, he answered with 4321; leaving now. +> [Tremblay:child:(3) 0.000060] [gras/INFO] Exiting GRAS +> [Tremblay:father:(1) 0.000060] [Spawn/INFO] Answered to Tremblay:4002's request +> [Tremblay:father:(1) 0.000075] [Spawn/INFO] Kid Tremblay:4003 pinged me with 1234 +> [Tremblay:child:(4) 0.000090] [Spawn/INFO] Pinged dad with 1234, he answered with 4321; leaving now. +> [Tremblay:child:(4) 0.000090] [gras/INFO] Exiting GRAS +> [Tremblay:father:(1) 0.000090] [Spawn/INFO] Answered to Tremblay:4003's request +> [Tremblay:father:(1) 0.000105] [Spawn/INFO] Kid Tremblay:4004 pinged me with 1234 +> [Tremblay:child:(5) 0.000120] [Spawn/INFO] Pinged dad with 1234, he answered with 4321; leaving now. +> [Tremblay:child:(5) 0.000120] [gras/INFO] Exiting GRAS +> [Tremblay:father:(1) 0.000120] [Spawn/INFO] Answered to Tremblay:4004's request +> [Tremblay:father:(1) 0.000135] [Spawn/INFO] Kid Tremblay:4005 pinged me with 1234 +> [Tremblay:child:(6) 0.000150] [Spawn/INFO] Pinged dad with 1234, he answered with 4321; leaving now. +> [Tremblay:child:(6) 0.000150] [gras/INFO] Exiting GRAS +> [Tremblay:father:(1) 0.000150] [Spawn/INFO] Answered to Tremblay:4005's request +> [Tremblay:father:(1) 0.000150] [Spawn/INFO] All kids gone. Leave now. +> [Tremblay:father:(1) 0.000150] [gras/INFO] Exiting GRAS + diff --git a/examples/gras/spawn/test_sg_64 b/examples/gras/spawn/test_sg_64 new file mode 100755 index 0000000000..7e395b34c4 --- /dev/null +++ b/examples/gras/spawn/test_sg_64 @@ -0,0 +1,3 @@ +p Runs the 'spawn' test within the simulator (simulation times valid for 64bits architectures) + +$ $SG_TEST_EXENV ./spawn_simulator${EXEEXT:=} ${srcdir:=.}/../../msg/small_platform.xml ${srcdir:=.}/spawn.xml -- 2.20.1