[C-MPI-commits] SF.net SVN: c-mpi:[42] test
Status: Pre-Alpha
Brought to you by:
jmwozniak
|
From: <jmw...@us...> - 2010-04-28 20:28:38
|
Revision: 42
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=42&view=rev
Author: jmwozniak
Date: 2010-04-28 20:28:31 +0000 (Wed, 28 Apr 2010)
Log Message:
-----------
Fixing test/cmpi/test06, add some docs.
Modified Paths:
--------------
include/mpirpc.h
src/mpirpc/mpirpc.c
test/adts/test-lru_table02.c
test/cmpi/module.mk.in
test/cmpi/test-startup.zsh
test/cmpi/test06.c
test/cmpi/test_helpers.c
Modified: include/mpirpc.h
===================================================================
--- include/mpirpc.h 2010-04-28 20:27:32 UTC (rev 41)
+++ include/mpirpc.h 2010-04-28 20:28:31 UTC (rev 42)
@@ -48,7 +48,7 @@
char args[MPIRPC_MAX_ARGS];
char* blob;
int blob_length;
- char* result;
+ void* result;
int result_length;
void* extras;
void (*proceed) (struct mpirpc* rpc);
Modified: src/mpirpc/mpirpc.c
===================================================================
--- src/mpirpc/mpirpc.c 2010-04-28 20:27:32 UTC (rev 41)
+++ src/mpirpc/mpirpc.c 2010-04-28 20:28:31 UTC (rev 42)
@@ -738,8 +738,8 @@
}
/**
- Free the RPC and its args
- except for the result and extras once it completes.
+ Frees: the RPC and args.
+ Does not free: the result, extras, and the blob.
Must be called by the user (usually in the proceed function).
*/
void
Modified: test/adts/test-lru_table02.c
===================================================================
--- test/adts/test-lru_table02.c 2010-04-28 20:27:32 UTC (rev 41)
+++ test/adts/test-lru_table02.c 2010-04-28 20:28:31 UTC (rev 42)
@@ -22,9 +22,9 @@
lru_table_printf("%s", table);
char* data1 = "data1";
char* data2 = "data2";
- lru_table_add(table, "key1", strdup(data1), strlen(data1)+1);
+ lru_table_add(table, "key1", heap(data1), strlen(data1)+1);
lru_table_printf("%s", table);
- lru_table_add(table, "key2", strdup(data2), strlen(data2)+1);
+ lru_table_add(table, "key2", heap(data2), strlen(data2)+1);
lru_table_printf("%s", table);
char* overwrite = "XJKLJKL";
Modified: test/cmpi/module.mk.in
===================================================================
--- test/cmpi/module.mk.in 2010-04-28 20:27:32 UTC (rev 41)
+++ test/cmpi/module.mk.in 2010-04-28 20:28:31 UTC (rev 42)
@@ -9,7 +9,7 @@
# is actually called.
TEST_CMPI_SRC += $(shell find test/cmpi -name "*.c" ! -name test_helpers.c)
-TEST_SRC += $(TEST_CMPI_SRCS)
+TEST_SRC += $(TEST_CMPI_SRC)
TEST_HELPER_SRC += test/cmpi/test_helpers.c
ifeq (@USE_COMM_WORLD@,1)
@@ -19,14 +19,14 @@
$(patsubst %.x, %.zsh, $(<)) $(<) $(LAUNCH)
test/cmpi/test%.x: test/cmpi/test%.o test/cmpi/test_helpers.o src/cmpi/node.o $(CMPI)
- $(Q) " MPICC $(@) "
+ $(Q) " LINK $(@) "
$(E)$(MPICC) $(MPE) $(<) test/cmpi/test_helpers.o src/cmpi/node.o \
$(CMPI) $(LIBS) -o $(@)
else
test/cmpi/test%.x: test/cmpi/test%.o test/cmpi/test_helpers.o src/cmpi/client.o $(CMPI)
- $(Q) " MPICC $(@) "
+ $(Q) " LINK $(@) "
$(E)$(MPICC) $(MPE) $(<) test/cmpi/test_helpers.o src/cmpi/client.o $(CMPI) $(LIBS) -o $(@)
endif
Modified: test/cmpi/test-startup.zsh
===================================================================
--- test/cmpi/test-startup.zsh 2010-04-28 20:27:32 UTC (rev 41)
+++ test/cmpi/test-startup.zsh 2010-04-28 20:28:31 UTC (rev 42)
@@ -1,25 +1,16 @@
#!/bin/zsh
+# Be sure to make tests with D=1
+
# set -x
-# Be sure to make tests with D=1
+source tools/test-helpers.zsh
PROGRAM=$1
OUT=${PROGRAM%.x}.out
shift
LAUNCH=${*}
-crash()
-{
- print $1
- mv ${OUT} ${OUT}.failed
- exit 1
-}
-
-source tools/helpers.zsh
-
-USE_COMM_WORLD=$( grep USE_COMM_WORLD cmpi-config.h | col 3 )
-
if (( USE_COMM_WORLD == 1 ))
then
Modified: test/cmpi/test06.c
===================================================================
--- test/cmpi/test06.c 2010-04-28 20:27:32 UTC (rev 41)
+++ test/cmpi/test06.c 2010-04-28 20:28:31 UTC (rev 42)
@@ -1,42 +1,53 @@
/**
- Update two new keys, update those, and retrieve one.
+ Update two new keys, update those, and retrieve one.
*/
-#include "test_helpers.h"
+#include "test_helpers.h"
void
cmpi_client_code()
{
char key1[10];
char key2[10];
- char key3[10];
+ char key3[10];
sprintf(key1, "key1_%i", mpi_rank);
sprintf(key2, "key2_%i", mpi_rank);
sprintf(key3, "key3_%i", mpi_rank);
wait_for_notification();
- notify_next();
-
- cmpi_update(key1, "value1", 0);
- cmpi_update(key2, "value2", 0);
- cmpi_update(key2, "X", 3);
- cmpi_update(key3, "value3", 3);
- cmpi_update(key3, "X", 1);
- cmpi_update(key3, "X", 5);
-
- sleep(2);
+ notify_next();
+ char* value = malloc(64*sizeof(char));
+
+ sprintf(value, "value1");
+ cmpi_update(key1, value, strlen(value)+1, 0);
+ sprintf(value, "value2");
+ cmpi_update(key2, value, strlen(value)+1, 0);
+ sprintf(value, "X");
+ cmpi_update(key2, value, strlen(value)+1, 3);
+ sprintf(value, "value3");
+ cmpi_update(key3, value, strlen(value)+1, 0);
+ sprintf(value, "X");
+ cmpi_update(key3, "X", strlen(value)+1, 1);
+ sprintf(value, "value1");
+ cmpi_update(key3, "X", strlen(value)+1, 3);
+
+ free(value);
+
+ sleep(2);
+
char* result;
- cmpi_get(key1, &result);
- printf("RESULT_1: %s\n", result);
- cmpi_get(key2, &result);
+ int length;
+ cmpi_get(key1, &result, &length);
+ printf("RESULT_1: %s\n", result);
+ cmpi_get(key2, &result, &length);
printf("RESULT_2: %s\n", result);
- cmpi_get(key3, &result);
- printf("RESULT_3: %s\n", result);
- NOTE("GET SUCCEEDED");
-
- sleep(2);
-
- cmpi_shutdown();
+ cmpi_get(key3, &result, &length);
+ printf("RESULT_3: %s\n", result);
+ NOTE("GET SUCCEEDED");
+
+ sleep(2);
+
+ cmpi_shutdown();
}
Modified: test/cmpi/test_helpers.c
===================================================================
--- test/cmpi/test_helpers.c 2010-04-28 20:27:32 UTC (rev 41)
+++ test/cmpi/test_helpers.c 2010-04-28 20:28:31 UTC (rev 42)
@@ -29,6 +29,7 @@
{
int tmp;
MPI_Status status;
+ NOTE_F;
MPI_Recv(&tmp, 1, MPI_INT,
MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
assert(tmp == -2);
@@ -37,6 +38,7 @@
void
notify_next(void)
{
+ NOTE_F;
if (mpi_rank < mpi_size-1)
{
int msg = -2;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|