Thread: [C-MPI-commits] SF.net SVN: c-mpi:[46] (Page 2)
Status: Pre-Alpha
Brought to you by:
jmwozniak
|
From: <jmw...@us...> - 2010-04-28 21:09:23
|
Revision: 46
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=46&view=rev
Author: jmwozniak
Date: 2010-04-28 21:09:17 +0000 (Wed, 28 Apr 2010)
Log Message:
-----------
Fix test/cmpi/test03
Modified Paths:
--------------
src/cmpi/cmpi.c
src/dense-1/cmpi_dense.c
src/dense-1/dense.c
test/cmpi/module.mk.in
test/cmpi/test03.c
Modified: src/cmpi/cmpi.c
===================================================================
--- src/cmpi/cmpi.c 2010-04-28 20:51:51 UTC (rev 45)
+++ src/cmpi/cmpi.c 2010-04-28 21:09:17 UTC (rev 46)
@@ -120,7 +120,7 @@
if (found)
{
- printdata("found: ", found->data, found->length);
+ DEBUG(printdata("found: ", found->data, found->length));
*data = found->data;
SHOW_P(*data);
result = found->length;
Modified: src/dense-1/cmpi_dense.c
===================================================================
--- src/dense-1/cmpi_dense.c 2010-04-28 20:51:51 UTC (rev 45)
+++ src/dense-1/cmpi_dense.c 2010-04-28 21:09:17 UTC (rev 46)
@@ -124,6 +124,9 @@
struct inlist* ranks = inlist_parse(lookup->result);
+ NOTE("got ranks: ");
+ DEBUG(inlist_printf(ranks));
+
for (item = ranks->head;
item; item = item->next)
{
Modified: src/dense-1/dense.c
===================================================================
--- src/dense-1/dense.c 2010-04-28 20:51:51 UTC (rev 45)
+++ src/dense-1/dense.c 2010-04-28 21:09:17 UTC (rev 46)
@@ -302,16 +302,13 @@
int length = cmpi_cached_retrieve(args, &data);
printdata("result1: ", data, length);
- // printdata("result2: ", result, length);
-
char* result = malloc(CMPI_VALUE_LENGTH);
SHOW_P(data);
memcpy(result, data, length);
-
if (data)
{
MPIRPC_Return(caller, unique, result, length);
Modified: test/cmpi/module.mk.in
===================================================================
--- test/cmpi/module.mk.in 2010-04-28 20:51:51 UTC (rev 45)
+++ test/cmpi/module.mk.in 2010-04-28 21:09:17 UTC (rev 46)
@@ -14,7 +14,7 @@
ifeq (@USE_COMM_WORLD@,1)
-test/cmpi/test%.out: test/cmpi/test%.x
+test/cmpi/test%.out: test/cmpi/test%.x test/cmpi/test%.zsh
$(E)$(CHECK_MPD)
$(Q) " TEST $(@) "
$(E)$(patsubst %.x, %.zsh, $(<)) $(<) $(LAUNCH)
Modified: test/cmpi/test03.c
===================================================================
--- test/cmpi/test03.c 2010-04-28 20:51:51 UTC (rev 45)
+++ test/cmpi/test03.c 2010-04-28 21:09:17 UTC (rev 46)
@@ -31,7 +31,7 @@
int length;
char* result;
cmpi_get(key1, &result, &length);
- printf("result(%i): %s\n", result, length);
+ printf("result(%i): %s\n", length, result);
sleep(3);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-04-29 20:55:47
|
Revision: 59
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=59&view=rev
Author: jmwozniak
Date: 2010-04-29 20:55:41 +0000 (Thu, 29 Apr 2010)
Log Message:
-----------
Better output methods.
Modified Paths:
--------------
include/dpkm_list.h
src/adts/dpkm_list.c
src/adts/lru_table.c
Modified: include/dpkm_list.h
===================================================================
--- include/dpkm_list.h 2010-04-29 20:02:28 UTC (rev 58)
+++ include/dpkm_list.h 2010-04-29 20:55:41 UTC (rev 59)
@@ -96,8 +96,6 @@
void dpkm_list_output(char* (*f)(void*), struct dpkm_list* target);
-// void dpkm_list_dump(char* format, struct dpkm_list* target);
-
void dpkm_list_free(struct dpkm_list* target);
void dpkm_list_destroy(struct dpkm_list* target);
@@ -106,6 +104,8 @@
void dpkm_list_fprintf(FILE* file, char* format, struct dpkm_list* target);
+void dpkm_list_printdata(struct dpkm_list* target);
+
int dpkm_list_tostring(char* str, size_t size,
char* format, struct dpkm_list* target);
Modified: src/adts/dpkm_list.c
===================================================================
--- src/adts/dpkm_list.c 2010-04-29 20:02:28 UTC (rev 58)
+++ src/adts/dpkm_list.c 2010-04-29 20:55:41 UTC (rev 59)
@@ -858,6 +858,25 @@
}
/**
+ Print list using printdata() for values.
+ */
+void
+dpkm_list_printdata(struct dpkm_list* target)
+{
+ struct dpkm_list_item* item;
+
+ printf("[");
+ for (item = target->head; item; item = item->next)
+ {
+ printf("(%s,", item->key);
+ printdata("", item->data, item->length);
+ if (item->next)
+ printf(",");
+ }
+ printf("]\n");
+}
+
+/**
Free this dpkm_list but not its data.
*/
void
Modified: src/adts/lru_table.c
===================================================================
--- src/adts/lru_table.c 2010-04-29 20:02:28 UTC (rev 58)
+++ src/adts/lru_table.c 2010-04-29 20:55:41 UTC (rev 59)
@@ -1,12 +1,18 @@
#include "lru_table.h"
-int
+static int
max(int i1, int i2)
{
return (i1>i2) ? i1 : i2;
}
+static int
+min(int i1, int i2)
+{
+ return (i1<i2) ? i1 : i2;
+}
+
struct lru_table*
lru_table_create(int capacity, int limit)
{
@@ -166,7 +172,7 @@
return false;
gossip_do(MASK_ADTS, lru_table_printf("%s", table));
- printdata("old data: ", item->data, item->length);
+ DEBUG(printdata("old data: ", item->data, item->length));
char* data = item->data;
@@ -182,12 +188,8 @@
item->data = update;
item->length = new_length;
- printdata("new data: ", item->data, item->length);
+ DEBUG(printdata("new data: ", item->data, item->length));
- gossip_do(MASK_ADTS, lru_table_printf("%s", table));
-
- free(data);
-
return true;
}
@@ -316,6 +318,25 @@
}
*/
+/**
+ @param format specifies the output format for the data items
+ */
+void
+lru_table_printdata(char* format, struct lru_table* target)
+{
+ int i;
+ printf("LRU_TABLE(%i) \n{\n", target->size);
+ printf("LRU: ");
+ dpkm_list_printdata(target->lru);
+ for (i = 0; i < target->capacity; i++)
+ if (target->array[i]->size > 0)
+ {
+ printf(" %i: ", i);
+ dpkm_list_printdata(target->array[i]);
+ }
+ printf("}\n");
+}
+
/** Dump dpkm_list to string a la snprintf()
size must be greater than 2.
format specifies the output format for the data items
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-12 00:01:00
|
Revision: 95
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=95&view=rev
Author: jmwozniak
Date: 2010-05-12 00:00:53 +0000 (Wed, 12 May 2010)
Log Message:
-----------
Better driver tests
Modified Paths:
--------------
include/accessor.h
include/io_tools.h
include/mpi_tools.h
src/cmpi/accessor.c
src/mpi_tools/io_tools.c
test/driver/test-cmd-put.c
Added Paths:
-----------
test/driver/test-cmd-get.c
test/driver/test-get.zsh
test/driver/test-put.zsh
Modified: include/accessor.h
===================================================================
--- include/accessor.h 2010-05-11 23:08:57 UTC (rev 94)
+++ include/accessor.h 2010-05-12 00:00:53 UTC (rev 95)
@@ -7,3 +7,5 @@
FILE* from_cmpi;
bool driver_access_fifo(void);
+
+void driver_access_fifo_close(void);
Modified: include/io_tools.h
===================================================================
--- include/io_tools.h 2010-05-11 23:08:57 UTC (rev 94)
+++ include/io_tools.h 2010-05-12 00:00:53 UTC (rev 95)
@@ -1,6 +1,6 @@
#include <stdio.h>
-void stream_to_buffer(char* buffer, int length, FILE* stream);
+int stream_to_buffer(char* buffer, int length, FILE* stream);
void buffer_to_stream(char* buffer, int length, FILE* stream);
void eat_whitespace(FILE* stream);
Modified: include/mpi_tools.h
===================================================================
--- include/mpi_tools.h 2010-05-11 23:08:57 UTC (rev 94)
+++ include/mpi_tools.h 2010-05-12 00:00:53 UTC (rev 95)
@@ -201,6 +201,7 @@
#define SHOW_S(s) DEBUG(show_s(s))
#define SHOW_X(x) DEBUG(show_x(#x, x))
#define SHOW_P(p) DEBUG(show_p(#p, p))
+#define SHOW SHOW_S
//// Functions...
#define show_fi(i) \
Modified: src/cmpi/accessor.c
===================================================================
--- src/cmpi/accessor.c 2010-05-11 23:08:57 UTC (rev 94)
+++ src/cmpi/accessor.c 2010-05-12 00:00:53 UTC (rev 95)
@@ -24,3 +24,10 @@
}
return true;
}
+
+void
+driver_access_fifo_close()
+{
+ fclose(to_cmpi);
+ fclose(from_cmpi);
+}
Modified: src/mpi_tools/io_tools.c
===================================================================
--- src/mpi_tools/io_tools.c 2010-05-11 23:08:57 UTC (rev 94)
+++ src/mpi_tools/io_tools.c 2010-05-12 00:00:53 UTC (rev 95)
@@ -3,7 +3,10 @@
#include <unistd.h>
-void
+/**
+ @return The total number of bytes stored in buffer.
+*/
+int
stream_to_buffer(char* buffer, int length, FILE* stream)
{
int total = 0;
@@ -14,6 +17,8 @@
int actual = fread(buffer+total, 1, chunk, stream);
total += actual;
}
+
+ return total;
}
void
Added: test/driver/test-cmd-get.c
===================================================================
--- test/driver/test-cmd-get.c (rev 0)
+++ test/driver/test-cmd-get.c 2010-05-12 00:00:53 UTC (rev 95)
@@ -0,0 +1,54 @@
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <accessor.h>
+#include <mpi_tools.h>
+#include <io_tools.h>
+
+void
+crash(char* message)
+{
+ printf("%s\n", message);
+ driver_access_fifo_close();
+ exit(1);
+}
+
+int
+main(int argc, char* argv[])
+{
+ int code;
+
+ if (argc < 2)
+ {
+ printf("test-cmd-get: needs key argument!\n");
+ exit(1);
+ }
+
+ code = driver_access_fifo();
+ assert(code);
+
+ char* key = argv[1];
+
+ fprintf(to_cmpi, "get %s\n", key);
+ fflush(to_cmpi);
+
+ int length;
+ code = fscanf(from_cmpi, "%i\n", &length);
+ if (code != 1)
+ crash("No response from driver!");
+
+ if (length == -1)
+ crash("key not found");
+
+ char* result = malloc(length*sizeof(char));
+ memset(result, 0, length);
+ int total = stream_to_buffer(result, length, from_cmpi);
+
+ if (strcmp(result, "hello"))
+ crash("wrong result!");
+
+ return 0;
+}
Modified: test/driver/test-cmd-put.c
===================================================================
--- test/driver/test-cmd-put.c 2010-05-11 23:08:57 UTC (rev 94)
+++ test/driver/test-cmd-put.c 2010-05-12 00:00:53 UTC (rev 95)
@@ -19,10 +19,10 @@
char* key = argv[1];
- char* data = "hello does this work";
+ char* data = "hello";
- fprintf(to_cmpi, "put %s %i\n", key, (int) strlen(data));
- fprintf(to_cmpi, "%s", data);
+ fprintf(to_cmpi, "put %s %i\n", key, (int) strlen(data)+1);
+ fprintf(to_cmpi, "%s%c", data, '\0');
fflush(to_cmpi);
char output[32];
Added: test/driver/test-get.zsh
===================================================================
--- test/driver/test-get.zsh (rev 0)
+++ test/driver/test-get.zsh 2010-05-12 00:00:53 UTC (rev 95)
@@ -0,0 +1,39 @@
+#!/bin/zsh
+
+# Put/get case
+
+OUTPUT=$1
+
+source tools/test-helpers.zsh
+
+bail()
+{
+ kill ${BOMB_PID}
+ crash $1
+}
+
+mpiexec -n 5 test/driver/test_driver.x -n 4 > ${OUTPUT} &
+DRIVER_PID=${!}
+
+tools/timebomb.zsh ${$} 10 ${OUTPUT} $0 &
+BOMB_PID=${!}
+
+sleep 5
+
+test/driver/test-cmd-put.x sample-key
+test/driver/test-cmd-sleep.x 1
+test/driver/test-cmd-get.x sample-key
+[[ $? == 0 ]] || bail "could not get: sample-key"
+test/driver/test-cmd-quit.x
+
+wait ${DRIVER_PID}
+kill ${BOMB_PID}
+
+N=$( grep -c "Normal exit" ${OUTPUT} )
+if (( N != 5 ))
+then
+ mv -v ${OUTPUT} ${OUTPUT}.failed
+ exit 1
+fi
+
+return 0
Property changes on: test/driver/test-get.zsh
___________________________________________________________________
Added: svn:executable
+ *
Added: test/driver/test-put.zsh
===================================================================
--- test/driver/test-put.zsh (rev 0)
+++ test/driver/test-put.zsh 2010-05-12 00:00:53 UTC (rev 95)
@@ -0,0 +1,29 @@
+#!/bin/zsh
+
+# Just do a put
+
+OUTPUT=$1
+
+mpiexec -n 5 test/driver/test_driver.x -n 4 > ${OUTPUT} &
+DRIVER_PID=${!}
+
+tools/timebomb.zsh ${$} 10 ${OUTPUT} $0 &
+BOMB_PID=${!}
+
+sleep 5
+
+test/driver/test-cmd-put.x sample-key
+test/driver/test-cmd-sleep.x 1
+test/driver/test-cmd-quit.x
+
+wait ${DRIVER_PID}
+kill ${BOMB_PID}
+
+N=$( grep -c "Normal exit" ${OUTPUT} )
+if (( N != 5 ))
+then
+ mv -v ${OUTPUT} ${OUTPUT}.failed
+ exit 1
+fi
+
+return 0
Property changes on: test/driver/test-put.zsh
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-12 00:16:38
|
Revision: 96
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=96&view=rev
Author: jmwozniak
Date: 2010-05-12 00:16:31 +0000 (Wed, 12 May 2010)
Log Message:
-----------
Minor improvements to cmpi-db/cmpi-cp tests
Modified Paths:
--------------
Makefile.in
src/cmpi-cp/module.mk.in
src/cmpi-db/module.mk.in
test/cmpi-db/module.mk.in
test/cmpi-db/test-cp1.zsh
Modified: Makefile.in
===================================================================
--- Makefile.in 2010-05-12 00:00:53 UTC (rev 95)
+++ Makefile.in 2010-05-12 00:16:31 UTC (rev 96)
@@ -309,7 +309,7 @@
DIR :=
# include $(MODULES)
-# TABLE_OBJS :=
+TABLE_OBJS :=
include src/mpi_tools/module.mk
include src/gossip/module.mk
include src/adts/module.mk
@@ -318,7 +318,7 @@
include src/dense-1/module.mk
include src/cmpi/module.mk
include src/cmpi-db/module.mk
-#include src/cmpi-cp/module.mk
+include src/cmpi-cp/module.mk
################################################################
# Derived file lists
@@ -351,9 +351,9 @@
include test/adts/module.mk
include test/mpirpc/module.mk
include test/cmpi/module.mk
-include test/driver/module.mk.in
-#include test/cmpi-db/module.mk.in
-#include test/cmpi-io/module.mk.in
+include test/driver/module.mk
+include test/cmpi-db/module.mk
+#include test/cmpi-io/module.mk
#TEST_HELPER_OBJS += $(patsubst %.c, %.o, $(TEST_HELPER_SRC))
TEST_DEPS += $(patsubst %.c, %.d, $(TEST_SRC))
Modified: src/cmpi-cp/module.mk.in
===================================================================
--- src/cmpi-cp/module.mk.in 2010-05-12 00:00:53 UTC (rev 95)
+++ src/cmpi-cp/module.mk.in 2010-05-12 00:16:31 UTC (rev 96)
@@ -12,6 +12,7 @@
CMPI_CP_LIBS += -L $(DMALLOC_LIB) -l dmalloc
endif
-bin/cmpi-cp: $(CMPI_CP_OBJS) bin
+bin/cmpi-cp: $(CMPICP_OBJS)
$(Q) " CC $(@) "
- $(E)$(CC) $(CMPI_CP_OBJS) -o $(@)
+ $(E) install -d bin
+ $(E) $(CC) $(CMPICP_OBJS) -o $(@)
Modified: src/cmpi-db/module.mk.in
===================================================================
--- src/cmpi-db/module.mk.in 2010-05-12 00:00:53 UTC (rev 95)
+++ src/cmpi-db/module.mk.in 2010-05-12 00:16:31 UTC (rev 96)
@@ -2,16 +2,17 @@
DIR := src/cmpi-db
PROGS += bin/cmpi-db
-PROGS += bin/cmpi-db-fifo-quit
-CMPIDB_SRC += src/cmpi-cp/cmpi-cp.c src/cmpi-db/cmpi-db-fifo-quit.c
+PROGS += bin/cmpi-db-quit
+CMPIDB_SRC += src/cmpi-db/cmpi-db-fifo-quit.c
CMPIDB = bin/cmpi-db
-$(CMPI_DB): src/cmpi-db/cmpi-db-fifo.o $(CMPI) bin
+$(CMPIDB): src/cmpi-db/cmpi-db-fifo.o $(CMPI)
$(Q) " MPICC $(@)"
- $(E)$(MPICC) $(MPE) src/cmpi/node.o src/cmpi/driver.o \
+ $(E) install -d bin
+ $(E) $(MPICC) $(MPE) src/cmpi/node.o src/cmpi/driver.o \
$(<) $(CMPI) $(LIBS) -o $(@)
-bin/cmpi-db-fifo-quit: src/cmpi-db/cmpi-db-fifo-quit.o $(CMPI) bin
+bin/cmpi-db-quit: src/cmpi-db/cmpi-db-fifo-quit.o $(CMPI) bin
$(Q) " MPICC $(@)"
- $(E)$(MPICC) $(<) $(CMPI) -o $(@)
+ $(E) $(MPICC) $(<) $(CMPI) -o $(@)
Modified: test/cmpi-db/module.mk.in
===================================================================
--- test/cmpi-db/module.mk.in 2010-05-12 00:00:53 UTC (rev 95)
+++ test/cmpi-db/module.mk.in 2010-05-12 00:16:31 UTC (rev 96)
@@ -1,18 +1,18 @@
-TEST_CMPI_DB_SRC += # $(shell find test/cmpi-db -name "*.c" ! -name test_helpers.c)
-TEST_SRC += $(TEST_CMPI_DB_SRC)
-TEST_HELPER_SRC += test/driver/test_helpers.c
+TEST_CMPIDB_ZSH = $(shell find test/cmpi-db -name "*.zsh")
+TEST_CMPIDB_OUTPUT = $(patsubst %.zsh, %.out, $(TEST_CMPIDB_ZSH))
-CMPI_DB = bin/cmpi-db
-CMPI_CP = bin/cmpi-cp
-CMPI_DB_QUIT = bin/cmpi-db-fifo-quit
-CMPI_DB_TOOLS = $(CMPI_DB) $(CMPI_CP) $(CMPI_DB_QUIT)
+TEST_OUTPUT += $(TEST_CMPIDB_OUTPUT)
-test/cmpi-db/test-%.out: test/cmpi-db/test-%.zsh $(CMPI_DB_TOOLS)
+CMPIDB = bin/cmpi-db
+CMPICP = bin/cmpi-cp
+CMPIDBQUIT = bin/cmpi-db-quit
+CMPIDB_TOOLS = $(CMPIDB) $(CMPICP) $(CMPIDBQUIT)
+
+test/cmpi-db/test-%.out: test/cmpi-db/test-%.zsh $(CMPIDB_TOOLS)
$(Q) " TEST $(@) "
$(E) $(MPDCHECK)
$(E) $(<) $(@) 4 3
-# test/cmpi-db/test-quit.zsh
#test/cmpi-db/test%.out: test/cmpi-db/test%.x $(DRIVER)
# $(Q) " TEST $(@) "
Modified: test/cmpi-db/test-cp1.zsh
===================================================================
--- test/cmpi-db/test-cp1.zsh 2010-05-12 00:00:53 UTC (rev 95)
+++ test/cmpi-db/test-cp1.zsh 2010-05-12 00:16:31 UTC (rev 96)
@@ -38,7 +38,7 @@
echo retrieved
-bin/cmpi-db-fifo-quit >& /dev/null &
+bin/cmpi-db-quit >& /dev/null &
QUIT_PROCESS=$!
sleep ${PROCS}
@@ -47,6 +47,6 @@
N=$( grep -c "Normal exit." ${OUTPUT} )
(( N == PROCS )) || crash "N != ${PROCS}"
-# rm cmpi-cp.out test-cp1.*.data
+rm -f cmpi-cp.out test-cp1.*.data
exit 0
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-05-22 20:54:24
|
Revision: 142
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=142&view=rev
Author: jmwozniak
Date: 2010-05-22 20:54:17 +0000 (Sat, 22 May 2010)
Log Message:
-----------
More DMALLOC usage
Modified Paths:
--------------
include/mpi_tools.h
include/mpirpc.h
src/cmpi-cp/cmpi-cp.c
src/dense-1/dense.c
src/mpi_tools/mpi_tools.c
src/mpirpc/mpirpc.c
test/mpirpc/test-args.c
test/mpirpc/test-ping.c
test/mpirpc/test-returns.c
Modified: include/mpi_tools.h
===================================================================
--- include/mpi_tools.h 2010-05-21 15:30:12 UTC (rev 141)
+++ include/mpi_tools.h 2010-05-22 20:54:17 UTC (rev 142)
@@ -108,6 +108,7 @@
void note_ii(char* msg, int i, int j);
void note_s(char* msg, char* s);
void note_ss(char* msg, char* s1, char* s2);
+void note_p(char* msg, void* p);
void note_u(char* msg, unsigned int u);
void note_x(char* msg, int i);
void note_xi(char* msg, int i, int j);
@@ -134,6 +135,7 @@
#define NOTE_I(m,i) DEBUG(note_i(m,i))
#define NOTE_II(m,i,j) DEBUG(note_ii(m,i,j))
#define NOTE_U(m,u) DEBUG(note_u(m,u))
+#define NOTE_P(m,p) DEBUG(note_p(m,p))
#define NOTE_S(m,s) DEBUG(note_s(m,s))
#define NOTE_SX(m,s,i) DEBUG(note_sx(m,s,i))
#define NOTE_SXI(m,s,x,i) DEBUG(note_sxi(m,s,x,i))
Modified: include/mpirpc.h
===================================================================
--- include/mpirpc.h 2010-05-21 15:30:12 UTC (rev 141)
+++ include/mpirpc.h 2010-05-22 20:54:17 UTC (rev 142)
@@ -71,14 +71,13 @@
/**
Internal MPIRPC return value. Used for garbage collection.
*/
-typedef struct mpirpc_value MPIRPC_Value;
-struct mpirpc_value
+typedef struct
{
int unique;
int length;
char* result;
MPI_Request request[4];
-};
+} MPIRPC_Value;
//// API...
@@ -137,6 +136,8 @@
void MPIRPC_Free(MPIRPC* rpc);
+void MPIRPC_Destroy(MPIRPC* rpc);
+
void MPIRPC_Snooze(void);
void MPIRPC_Snooze_reset(void);
Modified: src/cmpi-cp/cmpi-cp.c
===================================================================
--- src/cmpi-cp/cmpi-cp.c 2010-05-21 15:30:12 UTC (rev 141)
+++ src/cmpi-cp/cmpi-cp.c 2010-05-22 20:54:17 UTC (rev 142)
@@ -1,8 +1,9 @@
+#include <assert.h>
+#include <string.h>
+
#include <cmpi-cp.h>
-#include <string.h>
-
#include <cmpi-types.h>
#ifdef DMALLOC
@@ -53,6 +54,8 @@
cmpi_cp_extract_type(char* target, char* value)
{
CMPI_CP_TYPE result;
+ assert(target);
+ assert(value);
if (strstr(target, "dht://"))
{
strcpy(value, target+6);
Modified: src/dense-1/dense.c
===================================================================
--- src/dense-1/dense.c 2010-05-21 15:30:12 UTC (rev 141)
+++ src/dense-1/dense.c 2010-05-22 20:54:17 UTC (rev 142)
@@ -158,35 +158,34 @@
/**
Instruct a node to store a value.
Asynchronous. Copies key into MPIRPC.
+ Frees value on completion
*/
MPIRPC*
DENSE_Store(MPIRPC_Node node, char* key, char* value, int length)
{
SHOW_FSI(key, length);
- int klength = strlen(key);
- // int vlength = strlen(value);
- // char* args = malloc((klength+vlength+5)*sizeof(char));
- // assert(args);
- // strcpy(args, key);
MPIRPC* rpc = MPIRPC_Call_blob(node, "store", key,
value, length,
- NULL, MPIRPC_PROCEED_NULL);
+ NULL, MPIRPC_Destroy);
return rpc;
}
+/**
+ Frees value on completion
+*/
MPIRPC*
DENSE_Update(MPIRPC_Node node, char* key, char* value,
int length, int offset)
{
SHOW_FSI(key, length);
- char args[32];
+ char args[MPIRPC_MAX_ARGS];
sprintf(args, "%s %i", key, offset);
MPIRPC* rpc = MPIRPC_Call_blob(node, "update", args,
value, length,
- NULL, MPIRPC_PROCEED_NULL);
+ NULL, MPIRPC_Destroy);
return rpc;
}
@@ -258,7 +257,6 @@
int i;
int object_id;
sscanf(args, "%X", &object_id);
-
struct inlist* ranks = inlist_create();
for (i = 0; i < k; i++)
{
@@ -275,7 +273,8 @@
{
SHOW_FSI(args, blob_length);
- cmpi_cached_store(args, blob, blob_length);
+ char* key = heap(args);
+ cmpi_cached_store(key, blob, blob_length);
DEBUG(lru_table_printf("%s", cmpi_cache));
MPIRPC_Null(caller, unique);
Modified: src/mpi_tools/mpi_tools.c
===================================================================
--- src/mpi_tools/mpi_tools.c 2010-05-21 15:30:12 UTC (rev 141)
+++ src/mpi_tools/mpi_tools.c 2010-05-22 20:54:17 UTC (rev 142)
@@ -169,6 +169,13 @@
}
void
+note_p(char* msg, void* p)
+{
+ fprintf(debug_file, "[%i] %s%p\n", debug_rank, msg, p);
+ fflush(debug_file);
+}
+
+void
note_i(char* msg, int i)
{
fprintf(debug_file, "[%i] %s%i\n", debug_rank, msg, i);
Modified: src/mpirpc/mpirpc.c
===================================================================
--- src/mpirpc/mpirpc.c 2010-05-21 15:30:12 UTC (rev 141)
+++ src/mpirpc/mpirpc.c 2010-05-22 20:54:17 UTC (rev 142)
@@ -342,6 +342,7 @@
char name[MPIRPC_MAX_NAME];
int unique;
int name_length;
+ char args_space[MPIRPC_MAX_ARGS];
int args_length;
char* args;
int blob_length;
@@ -362,13 +363,16 @@
if (args_length > 0)
{
- args = malloc((args_length+1)*sizeof(char));
+ args = args_space;
MPI_Recv(args, args_length+1, MPI_CHAR, caller.rank,
MPIRPC_TAG_ARGS, caller.comm, &status);
}
else if (args_length == 0)
- args = heap("");
+ {
+ args = args_space;
+ args[0] = '\0';
+ }
else
args = NULL;
@@ -421,10 +425,12 @@
MPIRPC_Value* value = MPIRPC_Value_create(unique, result, length);
// SHOW_P(&value->request[0]);
+ // NOTE_P("request 0: ", &value->request[0]);
MPI_Isend(&mpirpc_msg_return, 1, MPI_INT, caller.rank,
MPIRPC_TAG_CONTROL, caller.comm, &value->request[0]);
MPI_Isend(&value->unique, 1, MPI_INT, caller.rank,
MPIRPC_TAG_UNIQUE, caller.comm, &value->request[1]);
+ // NOTE_P("request 2: ", &value->request[2]);
MPI_Isend(&value->length, 1, MPI_INT, caller.rank,
MPIRPC_TAG_LENGTH, caller.comm, &value->request[2]);
if (value->length > 0)
@@ -668,14 +674,14 @@
MPIRPC_Value* value;
MPI_Status status;
int sent;
- int i;
value = list_peek(garbage_values);
if (!value)
return false;
- for (i = 0; i < 3; i++)
+ for (int i = 0; i < 3; i++)
{
+ // NOTE_P("test: ", &value->request[i]);
MPI_Test(&value->request[i], &sent, &status);
if (!sent)
return false;
@@ -695,11 +701,22 @@
MPIRPC_Value_free(MPIRPC_Value* value)
{
// SHOW_FP(value);
- // NOTE_F;
- if (value->result != NULL)
+ for (int i = 0; i < 3; i++)
{
- // NOTE("Free result:");
+ // SHOW_FI(i);
+ //NOTE_P("request : ", &value->request[i]);
+ //MPI_Request_free(&value->request[i]);
+ }
+
+ NOTE("freeing last request:");
+ if (value->length > 0)
+ ;//MPI_Request_free(&value->request[3]);
+
+ if (value->result)
+ {
+ NOTE_S("Free result: ", value->result);
+ SHOW_P(value->result);
free(value->result);
}
@@ -740,7 +757,7 @@
}
/**
- Frees: the RPC and args.
+ Frees: the RPC (including the args).
Does not free: the result, extras, and the blob.
Must be called by the user (usually in the proceed function).
*/
@@ -751,7 +768,26 @@
free(rpc);
}
+/**
+ Frees: the RPC (including the args),
+ the result, extras, and the blob.
+ Must be called by the user (usually in the proceed function).
+*/
void
+MPIRPC_Destroy(MPIRPC* rpc)
+{
+ gossip_do(MASK_MPIRPC, SHOW_FSI(rpc->name, rpc->unique));
+
+ if (rpc->result)
+ free(rpc->result);
+ if (rpc->extras)
+ free(rpc->extras);
+ if (rpc->result)
+ free(rpc->blob);
+ free(rpc);
+}
+
+void
MPIRPC_Snooze()
{
if (snooze_amount > snooze_max)
Modified: test/mpirpc/test-args.c
===================================================================
--- test/mpirpc/test-args.c 2010-05-21 15:30:12 UTC (rev 141)
+++ test/mpirpc/test-args.c 2010-05-22 20:54:17 UTC (rev 142)
@@ -26,7 +26,7 @@
MPIRPC_Init();
whoami();
- DMALLOC_SETUP(dmalloc_setup());
+ dmalloc_setup();
MPIRPC_Comm_add(MPI_COMM_WORLD);
@@ -51,10 +51,7 @@
MPIRPC_Finalize();
MPI_Finalize();
- DMALLOC_SETUP(if (mpi_rank == 0)
- {
- SHOW_S(dmalloc_logpath);
- dmalloc_shutdown();
- });
+ DMALLOC_COMPLETE;
+
return 0;
}
Modified: test/mpirpc/test-ping.c
===================================================================
--- test/mpirpc/test-ping.c 2010-05-21 15:30:12 UTC (rev 141)
+++ test/mpirpc/test-ping.c 2010-05-22 20:54:17 UTC (rev 142)
@@ -52,7 +52,7 @@
SHOW_I(debug_rank);
- DMALLOC_SETUP(dmalloc_setup());
+ dmalloc_setup();
MPIRPC_Comm_add(MPI_COMM_WORLD);
MPIRPC_Register("ping", handle_ping);
@@ -80,7 +80,7 @@
MPIRPC_Finalize();
MPI_Finalize();
- TEST_DMALLOC;
+ DMALLOC_COMPLETE;
return 0;
}
Modified: test/mpirpc/test-returns.c
===================================================================
--- test/mpirpc/test-returns.c 2010-05-21 15:30:12 UTC (rev 141)
+++ test/mpirpc/test-returns.c 2010-05-22 20:54:17 UTC (rev 142)
@@ -17,6 +17,7 @@
sscanf(args, "%i", &a);
show_fsi(args, a);
char* result = malloc(4);
+ SHOW_P(result);
if (a == 0)
{
@@ -31,9 +32,6 @@
strcpy(result, "ok\n");
MPIRPC_Return(caller, unique, result, 4);
}
-
- if (args)
- free(args);
}
int
@@ -45,7 +43,7 @@
MPIRPC_Init();
whoami();
- DMALLOC_SETUP(dmalloc_setup());
+ dmalloc_setup();
MPIRPC_Comm_add(MPI_COMM_WORLD);
@@ -80,7 +78,7 @@
MPIRPC_Finalize();
MPI_Finalize();
- TEST_DMALLOC;
+ DMALLOC_COMPLETE;
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2010-06-07 19:30:51
|
Revision: 154
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=154&view=rev
Author: jmwozniak
Date: 2010-06-07 19:30:44 +0000 (Mon, 07 Jun 2010)
Log Message:
-----------
Improving accessor interface
Modified Paths:
--------------
Makefile.in
include/accessor.h
include/cmpi-cp.h
include/cmpi-types.h
src/cmpi/accessor.c
src/cmpi/driver.c
src/cmpi/module.mk.in
src/cmpi-cp/cmpi-cp.c
src/cmpi-db/cmpi-db-fifo-quit.c
src/dense-1/dense.c
test/driver/test-cmd-get.c
test/driver/test-cmd-put.c
test/driver/test-cmd-quit.c
test/driver/test-cmd-sleep.c
test/driver/test-cmd.c
Modified: Makefile.in
===================================================================
--- Makefile.in 2010-06-07 19:18:15 UTC (rev 153)
+++ Makefile.in 2010-06-07 19:30:44 UTC (rev 154)
@@ -337,6 +337,7 @@
#LIBOBJS := $(patsubst %.c,%.o, $(filter %.c,$(LIBSRC)))
#DISKSIM_OBJS := $(patsubst %.c,%.o, $(filter %.c,$(DISKSIM_SRC)))
+
CMPI_OBJS := $(TABLE_OBJS) $(MPIRPC_OBJS) $(CMPI_OBJS)
# $(DISKSIM_OBJS)
@@ -492,7 +493,7 @@
$(E)rm -fv $(CMPI_DEPS) $(TEST_DEPS) \
$(MPIRPC) $(CMPI) \
$(ADTS_OBJS) $(MPIRPC_OBJS) $(CMPI_OBJS) \
- $(KDA_OBJS) $(CMPI_IO) $(CMPI_OBJS) $(TABLE_OBJS) \
+ $(KDA_OBJS) $(CMPI_IO) \
hex unhex hexord unpublish node driver \
$(TEST_OUTPUT) $(TEST_PROGS) $(TEST_OBJS) \
$(PROGS) $(CMPICP_OBJS) $(CMPIDB_OBJS) splint.out
@@ -506,10 +507,6 @@
# $(E)find . -name "*.avg" -exec rm -fv \{\} \;
# $(E)find . -name "*.per" -exec rm -fv \{\} \;
-#ifndef DIST_RELEASE
-# $(E)rm -fv $(STATECOMPGEN)
-#endif
-
# Allow quick (cached) reconfiguration: regeneration of Makefile
# some stuff that is cleaned in both distclean and dist targets
cleaner: clean
Modified: include/accessor.h
===================================================================
--- include/accessor.h 2010-06-07 19:18:15 UTC (rev 153)
+++ include/accessor.h 2010-06-07 19:30:44 UTC (rev 154)
@@ -1,12 +1,21 @@
+#ifndef ACCESSOR_H
+#define ACCESSOR_H
+
#include <stdbool.h>
#include <stdio.h>
-FILE* to_cmpi;
-FILE* from_cmpi;
+#include <cmpi-types.h>
-void driver_access_fifo_setup(char* dir);
+extern FILE* to_cmpi;
+extern FILE* from_cmpi;
-bool driver_access_fifo(void);
+void accessor_fifo_setup(char* dir);
-void driver_access_fifo_close(void);
+bool accessor_fifo_init(void);
+
+void accessor_fifo_close(void);
+
+CMPI_RETURN accessor_put(char* key, void* data, int length);
+
+#endif
Modified: include/cmpi-cp.h
===================================================================
--- include/cmpi-cp.h 2010-06-07 19:18:15 UTC (rev 153)
+++ include/cmpi-cp.h 2010-06-07 19:30:44 UTC (rev 154)
@@ -6,18 +6,7 @@
* We do not compile with MPICC or any of our libs.
* */
-#include <accessor.h>
-#include <getopt.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <io_tools.h>
-
-// #define CMPI_CP_CHUNK CMPI_VALUE_LENGTH
-
-#define CMPI_CP_CHUNK 1024
-
typedef enum
{
CMPI_CP_KEY,
Modified: include/cmpi-types.h
===================================================================
--- include/cmpi-types.h 2010-06-07 19:18:15 UTC (rev 153)
+++ include/cmpi-types.h 2010-06-07 19:30:44 UTC (rev 154)
@@ -1,4 +1,7 @@
+#ifndef CMPI_TYPES_H
+#define CMPI_TYPES_H
+
#define CMPI_KEY_LENGTH 64
#define CMPI_VALUE_LENGTH (64*1024)
@@ -37,3 +40,5 @@
*/
CMPI_ERROR_NEIGHBORS = 5
} CMPI_RETURN;
+
+#endif
Modified: src/cmpi/accessor.c
===================================================================
--- src/cmpi/accessor.c 2010-06-07 19:18:15 UTC (rev 153)
+++ src/cmpi/accessor.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -5,12 +5,20 @@
#include <string.h>
#include <accessor.h>
+#include <io_tools.h>
char* fifo_in = NULL;
char* fifo_out = NULL;
+FILE* to_cmpi;
+FILE* from_cmpi;
+
+#define CHECK_ERROR \
+ if (error != CMPI_SUCCESS) \
+ return error;
+
void
-driver_access_fifo_setup(char* dir)
+accessor_fifo_setup(char* dir)
{
if (!dir)
dir = "/tmp";
@@ -35,7 +43,7 @@
@return True iff successfully access to fifos is made.
*/
bool
-driver_access_fifo()
+accessor_fifo_init()
{
assert(fifo_in);
@@ -77,8 +85,49 @@
*/
void
-driver_access_fifo_close()
+accessor_fifo_close()
{
fclose(to_cmpi);
fclose(from_cmpi);
}
+
+/**
+ @param buffer with length 32 or greater.
+*/
+CMPI_RETURN
+read_ok(char* buffer, FILE* file)
+{
+ buffer[0] = '\0';
+ fgets(buffer, 32, file);
+
+ if (strncmp(buffer, "ok", 2) != 0)
+ {
+ printf("did not get ok\n");
+ fflush(stdout);
+ printf("got: %s\n", buffer);
+ return CMPI_ERROR_UNKNOWN;
+ }
+
+ return CMPI_SUCCESS;
+}
+
+CMPI_RETURN
+accessor_put(char* key, void* data, int length)
+{
+ char buffer[32];
+ CMPI_RETURN error;
+
+ fprintf(to_cmpi, "put %s %i\n", key, length);
+ fflush(to_cmpi);
+
+ error = read_ok(buffer, from_cmpi);
+ CHECK_ERROR;
+
+ buffer_to_stream(data, length, to_cmpi);
+ fflush(to_cmpi);
+
+ read_ok(buffer, from_cmpi);
+ CHECK_ERROR;
+
+ return CMPI_SUCCESS;
+}
Modified: src/cmpi/driver.c
===================================================================
--- src/cmpi/driver.c 2010-06-07 19:18:15 UTC (rev 153)
+++ src/cmpi/driver.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -82,10 +82,6 @@
if (!fifo_in)
driver_setup_fifo_names();
- // This was a bad idea:
- // unlink(fifo_in);
- // unlink(fifo_out);
-
int error = mkfifo(fifo_in, S_IRUSR|S_IWUSR);
if (error != 0 &&
errno != EEXIST)
@@ -140,8 +136,11 @@
NOTE("got buffer");
cmpi_put(key, value, length);
- int error = fprintf(driver->sink, "ok got: put-data\n");
- assert(error >= 0);
+ NOTE("put complete\n");
+
+ int error = fprintf(driver->sink, "ok\n");
+ if (error == -1)
+ printf("driver_put result error!\n");
fflush(driver->sink);
}
@@ -281,6 +280,7 @@
char* s = strchr(driver->command, '\n');
*s = '\0';
driver_execute(driver);
+ NOTE("cmd complete");
}
NOTE("Closing driver...");
fclose(driver->source);
Modified: src/cmpi/module.mk.in
===================================================================
--- src/cmpi/module.mk.in 2010-06-07 19:18:15 UTC (rev 153)
+++ src/cmpi/module.mk.in 2010-06-07 19:30:44 UTC (rev 154)
@@ -42,7 +42,7 @@
CMPI_SRC += $(DIR)/cmpi_disk_void.c
endif
-CMPI_OBJS = $(patsubst %.c, %.o, $(CMPI_SRC))
+CMPI_OBJS += $(patsubst %.c, %.o, $(CMPI_SRC))
CMPI_OBJS += $(MPIRPC_OBJS)
CMPI = lib/libcmpi.a
Modified: src/cmpi-cp/cmpi-cp.c
===================================================================
--- src/cmpi-cp/cmpi-cp.c 2010-06-07 19:18:15 UTC (rev 153)
+++ src/cmpi-cp/cmpi-cp.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -1,12 +1,19 @@
#include <assert.h>
+#include <getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
-#include <cmpi-cp.h>
+#include <io_tools.h>
+#include <accessor.h>
+#define CMPI_CP_CHUNK 1024
+
#include <cmpi-types.h>
+#include <cmpi-cp.h>
+
#ifdef DMALLOC
#include <dmalloc.h>
void setup_dmalloc()
@@ -99,14 +106,8 @@
{
char key[CMPI_KEY_LENGTH+16];
char data[value_size];
- char msg[128];
int count = 0;
- int total = 0;
- char* result;
- int i;
-
- dbg("cmpi_cmp_put()...");
-
+ int total;
while (! feof(file))
{
total = 0;
@@ -121,72 +122,14 @@
if (total == 0)
break;
- dbg("read file");
-
- sprintf(key, "%s[%i]", object, count++);
- fprintf(to_cmpi, "put %s %i\n", key, total);
- fflush(to_cmpi);
- fflush(stdout);
- result = NULL;
- i = 0;
- while ((result = fgets(msg, 64, from_cmpi)) == NULL)
- {
- printf("cmpi-cp: put(): received: NULL\n");
- if (i++ == 3)
- return CMPI_ERROR_UNKNOWN;
- sleep(1);
- }
- if (strcmp(msg, "ok got: put-command\n"))
- {
- printf("cmpi-cp: put(): received: %s %i\n", msg, strlen(msg));
- return CMPI_ERROR_UNKNOWN;
- }
- buffer_to_stream(data, total, to_cmpi);
- fflush(to_cmpi);
-
- result = fgets(msg, 64, from_cmpi);
- if (!result)
- {
- printf("cmpi-cp: put(): received after data post: NULL\n");
- return CMPI_ERROR_UNKNOWN;
- }
- if (strcmp(msg, "ok got: put-data\n"))
- {
- printf("cmpi-cp: put(): received after data post: %s %i\n");
- return CMPI_ERROR_UNKNOWN;
- }
+ sprintf(key, "%s[%i]", object, count);
+ accessor_put(key, data, total);
+ count++;
}
- dbg("sent chunks");
+ total = sprintf(data, "DHT: %i", count)+1;
+ accessor_put(object, data, total);
- sprintf(data, "DHT: %i", count);
- total = (int) strlen(data)+1;
- fprintf(to_cmpi, "put %s %i\n", object, total);
- fflush(to_cmpi);
- result = NULL;
- i = 0;
- while ((result = fgets(msg, 64, from_cmpi)) == NULL)
- {
- printf("cmpi-cp: put(): received after metadata post: NULL\n");
- if (i++ == 3)
- return CMPI_ERROR_UNKNOWN;
- sleep(1);
- }
- if (strcmp(msg, "ok got: put-command\n"))
- {
- printf("got bad response after metadata put: %s\n", msg);
- return CMPI_ERROR_UNKNOWN;
- }
- buffer_to_stream(data, total, to_cmpi);
- fflush(to_cmpi);
-
- fgets(msg, 64, from_cmpi);
- if (strcmp(result, "ok got: put-data\n"))
- {
- printf("got bad response after metadata post: %s\n");
- return CMPI_ERROR_UNKNOWN;
- }
-
// printf("put() complete\n");
return CMPI_SUCCESS;
}
@@ -213,7 +156,6 @@
printf("cmpi-cp: get(): bad metadata length: NULL\n");
if (i++ == 3)
return CMPI_ERROR_UNKNOWN;
- sleep(1);
}
n = sscanf(msg, "%i", &length);
@@ -352,9 +294,8 @@
target2_type == CMPI_CP_FILE)
finish("cmpi-cp: given two files!", 1);
- driver_access_fifo_setup(NULL);
- dbg("setup");
- driver_access_fifo();
+ accessor_fifo_setup(NULL);
+ accessor_fifo_init();
fifos_open = true;
dbg("access");
@@ -370,7 +311,7 @@
else if (result != CMPI_SUCCESS)
finish("error!\n", 1);
- driver_access_fifo_close();
+ accessor_fifo_close();
dbg("cmpi-cp: normal exit\n");
finish(NULL, 0);
Modified: src/cmpi-db/cmpi-db-fifo-quit.c
===================================================================
--- src/cmpi-db/cmpi-db-fifo-quit.c 2010-06-07 19:18:15 UTC (rev 153)
+++ src/cmpi-db/cmpi-db-fifo-quit.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -11,8 +11,8 @@
{
char msg[100];
- driver_access_fifo_setup(NULL);
- bool success = driver_access_fifo();
+ accessor_fifo_setup(NULL);
+ bool success = accessor_fifo_init();
assert(success);
fprintf(to_cmpi, "quit\n");
Modified: src/dense-1/dense.c
===================================================================
--- src/dense-1/dense.c 2010-06-07 19:18:15 UTC (rev 153)
+++ src/dense-1/dense.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -282,6 +282,7 @@
DEBUG(lru_table_printdata(cmpi_cache));
MPIRPC_Null(caller, unique);
+ DONE;
}
void
Modified: test/driver/test-cmd-get.c
===================================================================
--- test/driver/test-cmd-get.c 2010-06-07 19:18:15 UTC (rev 153)
+++ test/driver/test-cmd-get.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -14,7 +14,7 @@
crash(char* message)
{
printf("%s\n", message);
- driver_access_fifo_close();
+ accessor_fifo_close();
exit(1);
}
@@ -27,7 +27,7 @@
char* key = argv[optind];
- code = driver_access_fifo();
+ code = accessor_fifo_init();
assert(code);
fprintf(to_cmpi, "get %s\n", key);
Modified: test/driver/test-cmd-put.c
===================================================================
--- test/driver/test-cmd-put.c 2010-06-07 19:18:15 UTC (rev 153)
+++ test/driver/test-cmd-put.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -14,28 +14,16 @@
{
test_cmd_setup(argc, argv);
- driver_access_fifo();
+ accessor_fifo_init();
char* key = argv[optind];
- // printf("key: %s\n", key);
char* data = "hello";
char output[32];
int tmp;
- fprintf(to_cmpi, "put %s %i\n", key, (int) strlen(data)+1);
- fflush(to_cmpi);
- fgets(output, 128, from_cmpi);
- assert(!strncmp(output, "ok", 2));
- // printf("got ok\n");
+ accessor_put(key, data, strlen(data)+1);
- int i = fwrite(data, sizeof(char), strlen(data)+1, to_cmpi);
- // printf("wrote: %i\n", i);
- fflush(to_cmpi);
-
- fgets(output, 128, from_cmpi);
- assert(!strncmp(output, "ok", 2));
-
return 0;
}
Modified: test/driver/test-cmd-quit.c
===================================================================
--- test/driver/test-cmd-quit.c 2010-06-07 19:18:15 UTC (rev 153)
+++ test/driver/test-cmd-quit.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -14,7 +14,7 @@
test_cmd_setup(argc, argv);
- error = driver_access_fifo();
+ error = accessor_fifo_init();
assert(error);
fprintf(to_cmpi, "quit\n");
Modified: test/driver/test-cmd-sleep.c
===================================================================
--- test/driver/test-cmd-sleep.c 2010-06-07 19:18:15 UTC (rev 153)
+++ test/driver/test-cmd-sleep.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -15,7 +15,7 @@
test_cmd_setup(argc, argv);
- code = driver_access_fifo();
+ code = accessor_fifo_init();
assert(code);
fprintf(to_cmpi, "sleep %i\n", sleep_time);
Modified: test/driver/test-cmd.c
===================================================================
--- test/driver/test-cmd.c 2010-06-07 19:18:15 UTC (rev 153)
+++ test/driver/test-cmd.c 2010-06-07 19:30:44 UTC (rev 154)
@@ -53,5 +53,5 @@
// printf("cmd -d %s\n", dir);
- driver_access_fifo_setup(dir);
+ accessor_fifo_setup(dir);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jmw...@us...> - 2011-04-15 20:45:13
|
Revision: 176
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=176&view=rev
Author: jmwozniak
Date: 2011-04-15 20:45:06 +0000 (Fri, 15 Apr 2011)
Log Message:
-----------
More memory leak fixes (test/cmpi/test-manyputs)
Modified Paths:
--------------
src/cmpi/cmpi.c
src/dense-1/cmpi_dense.c
src/dense-1/dense.c
test/cmpi/test-manyputs.c
Modified: src/cmpi/cmpi.c
===================================================================
--- src/cmpi/cmpi.c 2011-04-15 20:30:46 UTC (rev 175)
+++ src/cmpi/cmpi.c 2011-04-15 20:45:06 UTC (rev 176)
@@ -45,16 +45,13 @@
}
/**
- Returns a copy of the matching value or NULL if not found.
+ Returns pointer to the matching value or NULL if not found.
*/
char*
cmpi_params_search(char* key)
{
- char* result;
- result = hashtable_search(cmpi_params, key);
- if (result)
- return heap(result);
- return NULL;
+ char* result = hashtable_search(cmpi_params, key);
+ return result;
}
void
Modified: src/dense-1/cmpi_dense.c
===================================================================
--- src/dense-1/cmpi_dense.c 2011-04-15 20:30:46 UTC (rev 175)
+++ src/dense-1/cmpi_dense.c 2011-04-15 20:45:06 UTC (rev 176)
@@ -261,7 +261,6 @@
int n = sscanf(nodes_msg, "%i", &dense_nodes);
// SHOW_I(dense_nodes);
assert(n == 1);
- free(nodes_msg);
}
else
{
Modified: src/dense-1/dense.c
===================================================================
--- src/dense-1/dense.c 2011-04-15 20:30:46 UTC (rev 175)
+++ src/dense-1/dense.c 2011-04-15 20:45:06 UTC (rev 176)
@@ -161,7 +161,6 @@
/**
Instruct a node to store a value.
Asynchronous. Copies key into MPIRPC.
- Frees value on completion
*/
MPIRPC*
DENSE_Store(MPIRPC_Node node, char* key, char* value, int length)
Modified: test/cmpi/test-manyputs.c
===================================================================
--- test/cmpi/test-manyputs.c 2011-04-15 20:30:46 UTC (rev 175)
+++ test/cmpi/test-manyputs.c 2011-04-15 20:45:06 UTC (rev 176)
@@ -22,7 +22,7 @@
char* s = cmpi_params_search("reps");
if (s == NULL || strlen(s) == 0)
{
- NOTE("No reps given!");
+ puts("No reps given!");
exit(1);
}
int reps;
@@ -39,6 +39,7 @@
char* value = useless_data(10);
cmpi_put(key, value, strlen(value)+1);
+ free(value);
}
sleep((mpi_size-mpi_rank)*3+10);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|