Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
xbt/synchro.h test case, unfortunately showing some issues in the simulation for now
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 11 Jul 2007 17:51:37 +0000 (17:51 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 11 Jul 2007 17:51:37 +0000 (17:51 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3742 48e7efb5-ca39-0410-a469-dd3cf9ba447f

12 files changed:
configure
configure.ac
examples/gras/Makefile.am
examples/gras/Makefile.in
examples/gras/synchro/.cvsignore [new file with mode: 0644]
examples/gras/synchro/Makefile.am [new file with mode: 0644]
examples/gras/synchro/Makefile.in [new file with mode: 0644]
examples/gras/synchro/philosopher.c [new file with mode: 0644]
examples/gras/synchro/synchro.xml [new file with mode: 0644]
examples/gras/synchro/test_rl [new file with mode: 0755]
examples/gras/synchro/test_sg_32 [new file with mode: 0755]
examples/gras/synchro/test_sg_64 [new file with mode: 0755]

index 41abeac..3afc4f3 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 1.163 .
+# From configure.ac Revision: 1.166 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for simgrid 3.3-cvs.
 #
@@ -25300,8 +25300,10 @@ if test xpthread=xyes ; then
     # if we use them to implement the xbt_context
     SIMGRID_DEP="-lpthread"
   fi
-  # we need them in any case for the gras lib (which is multithreaded)
-  GRAS_DEP="-lpthread"
+  # we need them in any case for the gras lib (which is multithreaded), but on windows (of course)
+  if test "x$with_context" != "xwindows" ; then
+    GRAS_DEP="-lpthread"
+  fi
 fi
 
 { echo "$as_me:$LINENO: checking for csdp" >&5
@@ -25993,7 +25995,7 @@ echo $ECHO_N "checking whether to compile java bindings... $ECHO_C" >&6; }
 if test -n "$JAVAC"   \
    && test -n "$JAVA" \
    && test -n "$JAR"  \
-   && test "x$ac_cv_header_jni_h"="xyes" ; then
+   && test "x$ac_cv_header_jni_h" = "xyes" ; then
 
    use_java="yes"
 else
@@ -26001,7 +26003,7 @@ else
 fi
 { echo "$as_me:$LINENO: result: $use_java" >&5
 echo "${ECHO_T}$use_java" >&6; }
- if test "x$use_java"="xyes"; then
+ if test "x$use_java" = "xyes"; then
   HAVE_JAVA_TRUE=
   HAVE_JAVA_FALSE='#'
 else
@@ -26552,7 +26554,7 @@ ac_config_files="$ac_config_files doc/Makefile doc/Doxyfile"
 #      examples/gras/p2p/can/Makefile
 
 
-ac_config_files="$ac_config_files examples/Makefile examples/msg/Makefile examples/msg/basic.tesh examples/msg/small_plat.tesh examples/msg/suspend.tesh examples/msg/flexml_bypass.tesh examples/simdag/Makefile examples/simdag/test_simdag examples/gras/Makefile examples/gras/ping/Makefile examples/gras/rpc/Makefile examples/gras/timer/Makefile examples/gras/chrono/Makefile examples/gras/mutual_exclusion/simple_token/Makefile examples/gras/mmrpc/Makefile examples/gras/pmm/Makefile examples/gras/all2all/Makefile examples/amok/Makefile examples/amok/bandwidth/Makefile examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl examples/amok/saturate/Makefile examples/amok/saturate/test_sg examples/amok/saturate/test_rl examples/java/Makefile examples/java/basic/Makefile examples/java/comm_time/Makefile examples/java/suspend/Makefile examples/java/ping_pong/Makefile"
+ac_config_files="$ac_config_files examples/Makefile examples/msg/Makefile examples/msg/basic.tesh examples/msg/small_plat.tesh examples/msg/suspend.tesh examples/msg/flexml_bypass.tesh examples/simdag/Makefile examples/simdag/test_simdag examples/gras/Makefile examples/gras/ping/Makefile examples/gras/rpc/Makefile examples/gras/spawn/Makefile examples/gras/synchro/Makefile examples/gras/timer/Makefile examples/gras/chrono/Makefile examples/gras/mutual_exclusion/simple_token/Makefile examples/gras/mmrpc/Makefile examples/gras/pmm/Makefile examples/gras/all2all/Makefile examples/amok/Makefile examples/amok/bandwidth/Makefile examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl examples/amok/saturate/Makefile examples/amok/saturate/test_sg examples/amok/saturate/test_rl examples/java/Makefile examples/java/basic/Makefile examples/java/comm_time/Makefile examples/java/suspend/Makefile examples/java/ping_pong/Makefile"
 
 
 
@@ -27232,6 +27234,8 @@ do
     "examples/gras/Makefile") CONFIG_FILES="$CONFIG_FILES examples/gras/Makefile" ;;
     "examples/gras/ping/Makefile") CONFIG_FILES="$CONFIG_FILES examples/gras/ping/Makefile" ;;
     "examples/gras/rpc/Makefile") CONFIG_FILES="$CONFIG_FILES examples/gras/rpc/Makefile" ;;
+    "examples/gras/spawn/Makefile") CONFIG_FILES="$CONFIG_FILES examples/gras/spawn/Makefile" ;;
+    "examples/gras/synchro/Makefile") CONFIG_FILES="$CONFIG_FILES examples/gras/synchro/Makefile" ;;
     "examples/gras/timer/Makefile") CONFIG_FILES="$CONFIG_FILES examples/gras/timer/Makefile" ;;
     "examples/gras/chrono/Makefile") CONFIG_FILES="$CONFIG_FILES examples/gras/chrono/Makefile" ;;
     "examples/gras/mutual_exclusion/simple_token/Makefile") CONFIG_FILES="$CONFIG_FILES examples/gras/mutual_exclusion/simple_token/Makefile" ;;
@@ -28235,6 +28239,28 @@ done
       test -e $file && chmod +x $file;                          \
     done
  ;;
+    "examples/gras/spawn/Makefile":F)
+    for file in                                                 \
+     \
+     examples/msg/run_msg_test                                  \
+     examples/simdag/test_simdag                               \
+     examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \
+     examples/amok/saturate/test_sg  examples/amok/saturate/test_rl \
+    ; do                                                        \
+      test -e $file && chmod +x $file;                          \
+    done
+ ;;
+    "examples/gras/synchro/Makefile":F)
+    for file in                                                 \
+     \
+     examples/msg/run_msg_test                                  \
+     examples/simdag/test_simdag                               \
+     examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \
+     examples/amok/saturate/test_sg  examples/amok/saturate/test_rl \
+    ; do                                                        \
+      test -e $file && chmod +x $file;                          \
+    done
+ ;;
     "examples/gras/timer/Makefile":F)
     for file in                                                 \
      \
index fb2d5f4..f846d66 100644 (file)
@@ -434,6 +434,7 @@ AC_CONFIG_FILES([
       examples/gras/ping/Makefile   
       examples/gras/rpc/Makefile
       examples/gras/spawn/Makefile
+      examples/gras/synchro/Makefile
       examples/gras/timer/Makefile
       examples/gras/chrono/Makefile
       examples/gras/mutual_exclusion/simple_token/Makefile
index 45919b8..dcc3241 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS= ping rpc spawn timer chrono mutual_exclusion/simple_token mmrpc all2all pmm
+SUBDIRS= ping rpc spawn timer chrono mutual_exclusion/simple_token mmrpc all2all pmm synchro
 # p2p
 
 include $(top_srcdir)/acmacro/dist-files.mk
index d47b2d2..393ffab 100644 (file)
@@ -205,7 +205,7 @@ target_os = @target_os@
 target_vendor = @target_vendor@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-SUBDIRS = ping rpc spawn timer chrono mutual_exclusion/simple_token mmrpc all2all pmm
+SUBDIRS = ping rpc spawn timer chrono mutual_exclusion/simple_token mmrpc all2all pmm synchro
 all: all-recursive
 
 .SUFFIXES:
diff --git a/examples/gras/synchro/.cvsignore b/examples/gras/synchro/.cvsignore
new file mode 100644 (file)
index 0000000..60448de
--- /dev/null
@@ -0,0 +1,3 @@
+.deps .libs Makefile  _*.c synchro_philosopher synchro_simulator
+synchro.mk
+synchro.trace
diff --git a/examples/gras/synchro/Makefile.am b/examples/gras/synchro/Makefile.am
new file mode 100644 (file)
index 0000000..b602919
--- /dev/null
@@ -0,0 +1,28 @@
+INCLUDES= -I$(top_srcdir)/include -I$(top_srcdir)/src/include
+
+EXTRA_DIST=synchro.xml
+include $(top_srcdir)/examples/gras/tests.mk
+
+# AUTOMAKE variable definition
+noinst_PROGRAMS=synchro_philosopher synchro_simulator
+
+synchro_simulator_SOURCES=     _synchro_simulator.c philosopher.c
+synchro_simulator_LDADD=       $(top_builddir)/src/libsimgrid.la
+
+synchro_philosopher_SOURCES=   _synchro_philosopher.c  philosopher.c
+synchro_philosopher_LDADD=     $(top_builddir)/src/libgras.la
+
+# Take care of generatated sources
+# (manually since the child is not in the deployment file, so we need an extra argument to the stub generator)
+
+_synchro_simulator.c _synchro_philosopher.c: $(srcdir)/synchro.xml $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@
+       [ x@EXEEXT@ = x ] || exenv=wine; $$exenv $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ synchro $(srcdir)/synchro.xml
+
+$(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@:
+       make -C $(top_builddir)/tools/gras/ gras_stub_generator@EXEEXT@
+
+CLEANFILES = _synchro_simulator.c synchro.mk _synchro_philosopher.c
+MOSTLYCLEANFILES = synchro.trace
+
+# Cruft
+include $(top_srcdir)/acmacro/dist-files.mk
diff --git a/examples/gras/synchro/Makefile.in b/examples/gras/synchro/Makefile.in
new file mode 100644 (file)
index 0000000..9328736
--- /dev/null
@@ -0,0 +1,614 @@
+# 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
+noinst_PROGRAMS = synchro_philosopher$(EXEEXT) \
+       synchro_simulator$(EXEEXT)
+subdir = examples/gras/synchro
+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_synchro_philosopher_OBJECTS = _synchro_philosopher.$(OBJEXT) \
+       philosopher.$(OBJEXT)
+synchro_philosopher_OBJECTS = $(am_synchro_philosopher_OBJECTS)
+synchro_philosopher_DEPENDENCIES = $(top_builddir)/src/libgras.la
+am_synchro_simulator_OBJECTS = _synchro_simulator.$(OBJEXT) \
+       philosopher.$(OBJEXT)
+synchro_simulator_OBJECTS = $(am_synchro_simulator_OBJECTS)
+synchro_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 = $(synchro_philosopher_SOURCES) $(synchro_simulator_SOURCES)
+DIST_SOURCES = $(synchro_philosopher_SOURCES) \
+       $(synchro_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 -I$(top_srcdir)/src/include
+EXTRA_DIST = synchro.xml 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
+synchro_simulator_SOURCES = _synchro_simulator.c philosopher.c
+synchro_simulator_LDADD = $(top_builddir)/src/libsimgrid.la
+synchro_philosopher_SOURCES = _synchro_philosopher.c  philosopher.c
+synchro_philosopher_LDADD = $(top_builddir)/src/libgras.la
+CLEANFILES = _synchro_simulator.c synchro.mk _synchro_philosopher.c
+MOSTLYCLEANFILES = synchro.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)/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/synchro/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  examples/gras/synchro/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
+synchro_philosopher$(EXEEXT): $(synchro_philosopher_OBJECTS) $(synchro_philosopher_DEPENDENCIES) 
+       @rm -f synchro_philosopher$(EXEEXT)
+       $(LINK) $(synchro_philosopher_OBJECTS) $(synchro_philosopher_LDADD) $(LIBS)
+synchro_simulator$(EXEEXT): $(synchro_simulator_OBJECTS) $(synchro_simulator_DEPENDENCIES) 
+       @rm -f synchro_simulator$(EXEEXT)
+       $(LINK) $(synchro_simulator_OBJECTS) $(synchro_simulator_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_synchro_philosopher.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/_synchro_simulator.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/philosopher.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 
+
+# Take care of generatated sources
+# (manually since the child is not in the deployment file, so we need an extra argument to the stub generator)
+
+_synchro_simulator.c _synchro_philosopher.c: $(srcdir)/synchro.xml $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@
+       [ x@EXEEXT@ = x ] || exenv=wine; $$exenv $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ synchro $(srcdir)/synchro.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/synchro/philosopher.c b/examples/gras/synchro/philosopher.c
new file mode 100644 (file)
index 0000000..b85aac1
--- /dev/null
@@ -0,0 +1,140 @@
+/* $Id$ */
+
+/* philosopher - classical dinning philosopher as a demo xbt syncro stuff   */
+
+/* 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 "gras.h"
+#include "xbt/synchro.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(philo,"Logs of this example");
+
+
+/** Philosopher logic **/
+int lunch_amount = 10;
+int philosopher_amount;
+
+xbt_mutex_t mutex;
+xbt_cond_t *forks;
+
+#define THINKING 0
+#define EATING 1
+int *state;
+
+int *id; /* to pass a pointer to the threads without race condition */
+
+static void pickup(int id, int lunch)  {
+   INFO2("Thread %d gets hungry (lunch #%d)",id,lunch);
+   xbt_mutex_lock(mutex);
+   while (state[(id + (philosopher_amount-1))%philosopher_amount] == EATING ||
+         state[(id + 1)%philosopher_amount] == EATING) 
+     {
+       xbt_cond_wait(forks[id], mutex);
+     }
+   
+   state[id] = EATING;
+   xbt_assert1(state[(id + (philosopher_amount-1))%philosopher_amount] == THINKING &&
+              state[(id + 1)%philosopher_amount] == THINKING ,
+              "Philosopher %d eats at the same time that one of its neighbors!!!",id);
+       
+   xbt_mutex_unlock(mutex);
+   INFO1("Thread %d eats",id);
+}
+static void putdown(int id)  {
+   INFO1("Thread %d is full",id);
+   xbt_mutex_lock(mutex);
+   state[id] = THINKING;
+   xbt_cond_signal(forks[(id+(philosopher_amount-1))%philosopher_amount]);
+   xbt_cond_signal(forks[(id+1)%philosopher_amount]);
+   
+   xbt_mutex_unlock(mutex);
+   INFO1("Thread %d thinks",id);
+}
+
+/*
+ * Some additionnal code to let the father wait the childs
+ */
+xbt_mutex_t mut_end;
+xbt_cond_t cond_end;
+int running_threads;
+
+xbt_mutex_t dead_end;
+
+/* Code ran by each thread */
+static void philo_thread(void *arg) {
+   int id = *(int*)arg;
+   int i;
+   
+   for (i=0; i<lunch_amount; i++) {
+      pickup(id,i);
+      gras_os_sleep(id / 10); /* each philosopher sleeps and eat a time related to its ID */
+      putdown(id);
+      gras_os_sleep(id / 10);
+   }
+   
+   xbt_mutex_lock(mut_end);
+   running_threads--;
+   xbt_cond_signal(cond_end);
+   xbt_mutex_unlock(mut_end);
+
+   /* Enter an endless loop to test the killing facilities */
+   INFO1("Thread %d tries to enter the dead-end; hopefully, the master will cancel it",id);
+   xbt_mutex_lock(dead_end);
+   INFO1("Oops, thread %d reached the dead-end. Cancelation failed",id);
+}
+
+int philosopher (int argc,char *argv[]);
+int philosopher (int argc,char *argv[]) {
+  int i;
+  xbt_thread_t *philosophers;
+   
+  gras_init(&argc,argv);
+  xbt_assert0(argc>=2,"This program expects one argument (the amount of philosophers)");
+
+  INFO0("Wait 1 sec to check that gras_os_sleep do works");
+  gras_os_sleep(1);
+   
+  /* initializations of the philosopher mecanisms */
+  philosopher_amount = atoi(argv[1]);
+  state = xbt_new0(int,philosopher_amount); 
+  id = xbt_new0(int,philosopher_amount); 
+  forks = xbt_new(xbt_cond_t,philosopher_amount);
+  philosophers = xbt_new(xbt_thread_t,philosopher_amount);
+     
+  mutex = xbt_mutex_init();
+  for (i=0; i<philosopher_amount; i++) {
+     state[i] = THINKING;
+     id[i] = i;
+     forks[i] = xbt_cond_init();
+  }
+   
+  /* setup the ending mecanism */
+  running_threads = philosopher_amount; 
+  cond_end = xbt_cond_init();
+  mut_end = xbt_mutex_init();
+  dead_end = xbt_mutex_init();
+  xbt_mutex_lock(dead_end);
+  
+  INFO0("Enough waiting, spawn the threads");
+  /* spawn threads */
+  for (i=0; i<philosopher_amount; i++)
+     philosophers[i] = xbt_thread_create(philo_thread,&id[i]);
+  
+  /* wait for them */
+  xbt_mutex_lock(mut_end);
+  while (running_threads) 
+     xbt_cond_wait(cond_end,mut_end);
+  xbt_mutex_unlock(mut_end);
+       
+  INFO0("Cancel all childs");
+  /* nuke them threads */
+  for (i=0; i<philosopher_amount; i++)
+     xbt_thread_cancel(philosophers[i]);
+
+  xbt_mutex_unlock(dead_end);
+  gras_exit();
+  return 0;
+}
diff --git a/examples/gras/synchro/synchro.xml b/examples/gras/synchro/synchro.xml
new file mode 100644 (file)
index 0000000..1d3d57a
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform_description SYSTEM "surfxml.dtd">
+<platform_description version="1">
+  <process host="Tremblay" function="philosopher">
+     <argument value="5"/>          <!-- amount of pals to create -->
+  </process>
+</platform_description>
diff --git a/examples/gras/synchro/test_rl b/examples/gras/synchro/test_rl
new file mode 100755 (executable)
index 0000000..e4c33f0
--- /dev/null
@@ -0,0 +1,4 @@
+
+! expect signal SIGABRT
+! output ignore
+$ $SG_TEST_ENV ./philosopher$EXEEXT 4002 4 --log=root.fmt=%m%n
diff --git a/examples/gras/synchro/test_sg_32 b/examples/gras/synchro/test_sg_32
new file mode 100755 (executable)
index 0000000..3782dc4
--- /dev/null
@@ -0,0 +1,4 @@
+p Runs the 'philosopher' test within the simulator (simulation times valid for 32bits architectures)
+
+$ $SG_TEST_EXENV ./philosopher_simulator${EXEEXT:=} ${srcdir:=.}/../../msg/small_platform.xml ${srcdir:=.}/philosopher.xml
+
diff --git a/examples/gras/synchro/test_sg_64 b/examples/gras/synchro/test_sg_64
new file mode 100755 (executable)
index 0000000..b889fe5
--- /dev/null
@@ -0,0 +1,3 @@
+p Runs the 'philosopher' test within the simulator (simulation times valid for 64bits architectures)
+
+$ $SG_TEST_EXENV ./philosopher_simulator${EXEEXT:=} ${srcdir:=.}/../../msg/small_platform.xml ${srcdir:=.}/spawn.xml