diff --git a/src/allreduce.h b/src/allreduce.h index 9f150dcf4..ef3fe589b 100644 --- a/src/allreduce.h +++ b/src/allreduce.h @@ -47,7 +47,7 @@ void Finalize(void) { engine::Finalize(); } #ifdef TEST -void SetMock(test::Mock& mock) { +void SetMock(const test::Mock& mock) { engine::SetMock(mock); } #endif diff --git a/src/engine.h b/src/engine.h index 852e9187a..dc3a14049 100644 --- a/src/engine.h +++ b/src/engine.h @@ -82,7 +82,7 @@ void Finalize(void); IEngine *GetEngine(void); #ifdef TEST -void SetMock(test::Mock& mock); +void SetMock(const test::Mock& mock); #endif } // namespace engine diff --git a/src/engine_tcp.cpp b/src/engine_tcp.cpp index e00b70f1c..c34d7d86b 100644 --- a/src/engine_tcp.cpp +++ b/src/engine_tcp.cpp @@ -42,7 +42,7 @@ class SyncManager : public IEngine { } #ifdef TEST - inline void SetMock(test::Mock& mock) { + inline void SetMock(const test::Mock& mock) { this->mock = mock; } #endif @@ -501,7 +501,7 @@ void Init(int argc, char *argv[]) { #ifdef TEST /*! \brief sets a mock to the manager for testing purposes */ -void SetMock(test::Mock& mock) { +void SetMock(const test::Mock& mock) { manager.SetMock(mock); } #endif diff --git a/test/Makefile b/test/Makefile index 78c6095e4..ef752de74 100644 --- a/test/Makefile +++ b/test/Makefile @@ -34,4 +34,4 @@ $(MPIBIN) : $(MPICXX) $(CFLAGS) $(LDFLAGS) -o $@ $(filter %.cpp %.o %.c, $^) clean: - $(RM) $(BIN) $(MPIBIN) *~ ../src/*~ + $(RM) $(OBJ) $(BIN) $(MPIBIN) *~ ../src/*~ diff --git a/test/test_allreduce.cpp b/test/test_allreduce.cpp index 6da800f90..185d8ea6d 100644 --- a/test/test_allreduce.cpp +++ b/test/test_allreduce.cpp @@ -62,8 +62,8 @@ inline void TestBcast(size_t n, int root) { utils::Check(res == s, "[%d] TestBcast fail", rank); } -// ugly stuff, just to see if it works -inline void record(test::Mock& mock, int rank) { +// ugly stuff, just to see if it works. To be removed +inline void Record(test::Mock& mock, const int rank) { switch(rank) { case 0: mock.OnAllReduce(0, false); @@ -77,12 +77,6 @@ inline void record(test::Mock& mock, int rank) { } } -// to be removed, should be added in engine tcp -inline void replay(test::Mock& mock, int rank) { - printf("[%d] All reduce %d\n", rank, mock.AllReduce(rank)); - printf("[%d] All reduce %d\n", rank, mock.AllReduce(rank)); -} - int main(int argc, char *argv[]) { if (argc < 2) { printf("Usage: \n"); @@ -95,14 +89,11 @@ int main(int argc, char *argv[]) { #ifdef TEST test::Mock mock; - record(mock, rank); + Record(mock, rank); mock.Replay(); - //replay(mock, rank); sync::SetMock(mock); #endif - - printf("[%d] start at %s\n", rank, name.c_str()); TestMax(n); printf("[%d] TestMax pass\n", rank);