Add a basic test of inline entry method invocation
authorPhil Miller <mille121@illinois.edu>
Wed, 3 Feb 2010 20:04:12 +0000 (14:04 -0600)
committerPhil Miller <mille121@illinois.edu>
Wed, 3 Feb 2010 20:12:38 +0000 (14:12 -0600)
tests/charm++/megatest/Make.depends
tests/charm++/megatest/Makefile
tests/charm++/megatest/inlineem.C [new file with mode: 0644]
tests/charm++/megatest/inlineem.ci [new file with mode: 0644]

index 237ab03619eba75a4534a7437c409217d2035a5f..dfd20ef724ef0509df21958809b1aeac12ee18d4 100644 (file)
@@ -185,3 +185,9 @@ callback.o: \
        megatest.h \
        callback.def.h
        $(CHARMC) -o callback.o callback.C
+inlineem.o: \
+       inlineem.C \
+       inlineem.decl.h \
+       megatest.h \
+       inlineem.def.h
+       $(CHARMC) -o inlineem.o inlineem.C
index 2e9000f5e6c280063650907d5db96c0c53cf82bd..8f999965d4183e51a5ac4cfba8563e7302c8645f 100644 (file)
@@ -29,6 +29,7 @@ OBJS=megatest.o \
      bitvector.o \
      immediatering.o \
      callback.o \
+     inlineem.o \
 
 
 #     priolongtest.o \
@@ -60,7 +61,8 @@ OBJS_REV=megatest.o \
      varraystest.o \
      varsizetest.o \
      nodering.o \
-     groupring.o
+     groupring.o \
+     inlineem.o
 
 #     priolongtest.o \
 
@@ -71,7 +73,7 @@ CIFILES =  \
       fib.def.h        megatest.def.h       priotest.def.h   tempotest.def.h  \
       groupcast.def.h  migration.def.h      queens.def.h     varraystest.def.h\
       groupring.def.h  nodecast.def.h       reduction.def.h  varsizetest.def.h\
-      groupsectiontest.def.h multisectiontest.def.h #priolongtest.def.h 
+      groupsectiontest.def.h multisectiontest.def.h inlineem.def.h #priolongtest.def.h
 
 .SUFFIXES:
 .SUFFIXES: .o .C .def.h .decl.h .ci .h
diff --git a/tests/charm++/megatest/inlineem.C b/tests/charm++/megatest/inlineem.C
new file mode 100644 (file)
index 0000000..3f6a883
--- /dev/null
@@ -0,0 +1,48 @@
+#include "inlineem.decl.h"
+#include "megatest.h"
+
+readonly<CProxy_inline_tester> t;
+
+void inlineem_moduleinit(void)
+{
+  CProxy_inline_group g = CProxy_inline_group::ckNew();
+  t = CProxy_inline_tester::ckNew(g);
+}
+
+void inlineem_init(void)
+{
+  ((CProxy_inline_tester)t).start_test();
+}
+
+struct inline_group : public CBase_inline_group
+{
+  bool called;
+  inline_group() : called(false) {}
+  void try_inline() {
+    called = true;
+  }
+};
+
+struct inline_tester : public CBase_inline_tester
+{
+  CProxy_inline_group g;
+  inline_tester(CProxy_inline_group g_) : g(g_) {}
+  void start_test()
+  {
+    inline_group *gl = g.ckLocalBranch();
+    if (gl->called)
+      CkAbort("Inline test was called already?\n");
+
+    g[CkMyPe()].try_inline();
+
+    if (!gl->called)
+      CkAbort("Inline test should have been called by now!\n");
+
+    gl->called = false;
+    megatest_finish();
+  }
+};
+
+MEGATEST_REGISTER_TEST(inlineem, "phil", 0)
+
+#include "inlineem.def.h"
diff --git a/tests/charm++/megatest/inlineem.ci b/tests/charm++/megatest/inlineem.ci
new file mode 100644 (file)
index 0000000..df00c1a
--- /dev/null
@@ -0,0 +1,13 @@
+module inlineem
+{
+  group inline_group
+  {
+    entry inline_group();
+    entry [inline] void try_inline();
+  }
+  chare inline_tester
+  {
+    entry inline_tester(CProxy_inline_group &);
+    entry void start_test();
+  }
+}