ckio: revise test to match new interface
authorPhil Miller <mille121@illinois.edu>
Tue, 23 Jul 2013 22:07:30 +0000 (17:07 -0500)
committerPhil Miller <mille121@illinois.edu>
Tue, 20 Aug 2013 23:28:57 +0000 (18:28 -0500)
tests/charm++/io/Makefile
tests/charm++/io/iotest.C
tests/charm++/io/iotest.ci

index e979c65fcc88d1c0dfb0cd9615d2c9fec3e78080..97167c142d79da2cab7b889d1de7a54c9415fa7a 100644 (file)
@@ -3,3 +3,6 @@ CHARMC=../../../bin/charmc
 pgm: iotest.ci iotest.C
        $(CHARMC) iotest.ci
        $(CHARMC) -g iotest.C -o $@ -module CkIO
+
+clean:
+       rm -f *.o *.decl.h *.def.h pgm
index 55cf1b217129855a61134e8cc9d73570bbf6d6e3..0aed707a2fd64640c79df45d74f897c690c9a29c 100644 (file)
@@ -5,29 +5,35 @@
 class Main : public CBase_Main {
   CProxy_test testers;
   int n;
+  Ck::IO::File f;
 public:
   Main(CkArgMsg *m) {
     n = atoi(m->argv[1]);
-    mgr = Ck::IO::CProxy_Manager::ckNew();
-    CkPrintf("Main created group\n");
-    Ck::IO::Manager *iomgr = (Ck::IO::Manager *)CkLocalBranch(mgr);
     Ck::IO::Options opts;
     opts.peStripe = 200;
     opts.writeStripe = 1;
-    iomgr->prepareOutput("test", 10*n,
-                        CkCallback(CkIndex_Main::ready(NULL), thisProxy),
-                        CkCallback(CkIndex_Main::test_written(), thisProxy),
-                        opts);
+
+    Ck::IO::open("test", CkCallback(CkIndex_Main::ready(NULL), thisProxy), opts);
+
     CkPrintf("Main ran\n");
   }
 
   void ready(Ck::IO::FileReadyMsg *m) {
-    testers = CProxy_test::ckNew(m->token, n);
+    f = m->file;
+    Ck::IO::startSession(f, 10*n, 0,
+                         CkCallback(CkIndex_Main::start_write(0), thisProxy),
+                        CkCallback(CkIndex_Main::test_written(), thisProxy));
+    delete m;
     CkPrintf("Main saw file ready\n");
   }
 
+  void start_write(Ck::IO::SessionReadyMsg *m) {
+    testers = CProxy_test::ckNew(m->session, n);
+    CkPrintf("Main saw session ready\n");
+  }
+
   void test_written() {
-    CkPrintf("Main see write done\n");
+    CkPrintf("Main saw write done\n");
     // Read file and validate contents
 
     CkExit();
@@ -35,10 +41,10 @@ public:
 };
 
 struct test : public CBase_test {
-  test(Ck::IO::Token token) {
+  test(Ck::IO::Session token) {
     char out[11];
     sprintf(out, "%9d\n", thisIndex);
-    ((Ck::IO::Manager *)CkLocalBranch(mgr))->write(token, out, 10, 10*thisIndex);
+    Ck::IO::write(token, out, 10, 10*thisIndex);
   }
   test(CkMigrateMessage *m) {}
 };
index 90f63ea305fca67712ed2880ebca4c4400cfa646..25189a20fa8ad303946f6c0dad95bf785c7321c8 100644 (file)
@@ -5,10 +5,11 @@ mainmodule iotest {
   mainchare Main {
     entry Main(CkArgMsg *m);
     entry void ready(Ck::IO::FileReadyMsg *m);
+    entry void start_write(Ck::IO::SessionReadyMsg *m);
     entry void test_written();
   };
 
   array [1D] test {
-    entry test(Ck::IO::Token token);
+    entry test(Ck::IO::Session token);
   }
 }