[C-MPI-commits] SF.net SVN: c-mpi:[147] test
Status: Pre-Alpha
Brought to you by:
jmwozniak
|
From: <jmw...@us...> - 2010-05-23 23:18:20
|
Revision: 147
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=147&view=rev
Author: jmwozniak
Date: 2010-05-23 23:18:14 +0000 (Sun, 23 May 2010)
Log Message:
-----------
More DMALLOC
Modified Paths:
--------------
Makefile.in
include/cmpi-cp.h
include/dpkm_list.h
include/lru_table.h
include/mpi_tools.h
src/adts/dpkm_list.c
src/adts/keyvalue.c
src/adts/lru_table.c
src/cmpi/cmpi.c
src/cmpi-cp/cmpi-cp.c
src/dense-1/dense.c
src/mpi_tools/mpi_tools.c
src/mpirpc/mpirpc.c
test/adts/test-dpkm_list.c
test/adts/test-inlist.c
test/adts/test-lru_table01.c
test/adts/test-lru_table02.c
test/adts/test_helpers.h
test/cmpi-db/test-loop.zsh
test/mpirpc/test-args.c
Modified: Makefile.in
===================================================================
--- Makefile.in 2010-05-22 21:40:52 UTC (rev 146)
+++ Makefile.in 2010-05-23 23:18:14 UTC (rev 147)
@@ -477,23 +477,31 @@
# Formats to one file per line & extracts junk and extra files in *.d
deps.txt: $(CMPI_DEPS)
$(Q) " DEPS.TXT "
- $(E) cat $(CMPI_DEPS) | fmt -w 1 | cut -f 1 | \
- sed 's/ //g;s/\\//g' | \
- grep -v '.*\.o\>\|.*\.po\>\|.*\.d\>' | \
- sort -u > $(@)
+ $(E) cat $(CMPI_DEPS) | \
+ fmt -w 1 | cut -f 1 | \
+ sed 's/ //g;s/\\//g' | \
+ grep -v '.*\.o\>\|.*\.po\>\|.*\.d\>' | \
+ sort -u > $(@)
+RM_ALL = find . -name .svn -prune -o -name $(1) -exec rm -fv \{\} \;
+
# top rule for cleaning up tree
-clean::
+clean:
$(Q) " CLEAN"
$(E)rm -fv $(CMPI_DEPS) $(TEST_DEPS) \
- $(MPIRPC) $(CMPI) $(ADTS_OBJS) $(MPIRPC_OBJS) $(CMPI_OBJS) \
+ $(MPIRPC) $(CMPI) \
+ $(ADTS_OBJS) $(MPIRPC_OBJS) $(CMPI_OBJS) \
$(KDA_OBJS) $(CMPI_IO) $(CMPI_OBJS) $(TABLE_OBJS) \
hex unhex hexord unpublish node driver \
$(TEST_OUTPUT) $(TEST_PROGS) $(TEST_OBJS) \
$(PROGS) $(CMPICP_OBJS) $(CMPIDB_OBJS) splint.out
- $(E)find . -name "*.failed" -exec rm -fv \{\} \;
- $(E)find . -name "*.bombed" -exec rm -fv \{\} \;
- $(E)find . -name "test-success.out" -exec rm -fv \{\} \;
+ $(E) $(call RM_ALL, "*.failed" )
+ $(E) $(call RM_ALL, "*.bombed" )
+ $(E) $(call RM_ALL, "tool.out" )
+ $(E) $(call RM_ALL, "input.data" )
+ $(E) $(call RM_ALL, "output.data" )
+ $(E) $(call RM_ALL, "test-success.out" )
+ $(E) $(call RM_ALL, "dmalloc*.out" )
# $(E)find . -name "*.avg" -exec rm -fv \{\} \;
# $(E)find . -name "*.per" -exec rm -fv \{\} \;
Modified: include/cmpi-cp.h
===================================================================
--- include/cmpi-cp.h 2010-05-22 21:40:52 UTC (rev 146)
+++ include/cmpi-cp.h 2010-05-23 23:18:14 UTC (rev 147)
@@ -1,5 +1,11 @@
-// #include <node.h>
+/**
+ * CMPI-CP command-line tool
+ *
+ * This has to be as small and fast as possible.
+ * We do not compile with MPICC or any of our libs.
+ * */
+
#include <accessor.h>
#include <getopt.h>
Modified: include/dpkm_list.h
===================================================================
--- include/dpkm_list.h 2010-05-22 21:40:52 UTC (rev 146)
+++ include/dpkm_list.h 2010-05-23 23:18:14 UTC (rev 147)
@@ -102,10 +102,13 @@
void dpkm_list_printf(char* format, struct dpkm_list* target);
-void dpkm_list_fprintf(FILE* file, char* format, struct dpkm_list* target);
+void dpkm_list_fprintf(FILE* file, char* format,
+ struct dpkm_list* target);
void dpkm_list_printdata(struct dpkm_list* target);
+void dpkm_list_fprintdata(FILE* file, struct dpkm_list* target);
+
int dpkm_list_tostring(char* str, size_t size,
char* format, struct dpkm_list* target);
Modified: include/lru_table.h
===================================================================
--- include/lru_table.h 2010-05-22 21:40:52 UTC (rev 146)
+++ include/lru_table.h 2010-05-23 23:18:14 UTC (rev 147)
@@ -31,7 +31,7 @@
struct lru_table* lru_table_create(int capacity, int limit);
struct keyvalue* lru_table_add(struct lru_table *table,
- char* key, char* data, int length);
+ char* key, void* data, int length);
bool lru_table_update(struct lru_table *table,
char* key, char* data, int offset, int length);
@@ -48,4 +48,6 @@
void lru_table_printdata(struct lru_table* target);
+void lru_table_fprintdata(FILE* file, struct lru_table* target);
+
#endif
Modified: include/mpi_tools.h
===================================================================
--- include/mpi_tools.h 2010-05-22 21:40:52 UTC (rev 146)
+++ include/mpi_tools.h 2010-05-23 23:18:14 UTC (rev 147)
@@ -62,6 +62,7 @@
void printbinary(unsigned int number);
void printdata(char* tag, char* data, int length);
+void fprintdata(FILE* file, char* tag, char* data, int length);
int flip2(int i);
unsigned int ilog2(unsigned int j);
unsigned int isqrt(unsigned int j);
@@ -135,7 +136,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_P(m,s) DEBUG(note_p(m,))
#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))
@@ -353,7 +354,6 @@
{ \
SHOW_S(dmalloc_logpath); \
dmalloc_shutdown(); \
- /* free(dmalloc_logpath); */ \
dmalloc_log_unfreed(); \
});
Modified: src/adts/dpkm_list.c
===================================================================
--- src/adts/dpkm_list.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/adts/dpkm_list.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -199,10 +199,9 @@
}
*/
- /**
- Return list head data.
- */
-
+/**
+ Return list head data.
+*/
void*
dpkm_list_peek(struct dpkm_list* target)
{
@@ -864,14 +863,14 @@
Print list using printdata() for values.
*/
void
-dpkm_list_printdata(struct dpkm_list* target)
+dpkm_list_fprintdata(FILE* file, struct dpkm_list* target)
{
struct dpkm_list_item* item;
- printf("[");
+ fprintf(file, "[");
for (item = target->head; item; item = item->next)
{
- printf("(%s@%i,", item->key, item->length);
+ fprintf(file, "(%s@%i,", item->key, item->length);
printdata("", item->data, item->length);
printf(")");
if (item->next)
@@ -880,6 +879,12 @@
printf("]\n");
}
+void
+dpkm_list_printdata(struct dpkm_list* target)
+{
+ dpkm_list_fprintdata(stdout, target);
+}
+
/**
Free this dpkm_list but not its data.
*/
Modified: src/adts/keyvalue.c
===================================================================
--- src/adts/keyvalue.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/adts/keyvalue.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -1,16 +1,17 @@
-#include <stdlib.h>
+#include <stdlib.h>
#include "keyvalue.h"
/**
- Free this keyvalue pair and its member data pointers.
+ Free this keyvalue pair and its member data pointers.
*/
void
keyvalue_destroy(struct keyvalue* kv)
{
- NOTE_F;
+ NOTE_F;
+ assert(kv);
free(kv->key);
free(kv->data);
- free(kv);
+ free(kv);
}
Modified: src/adts/lru_table.c
===================================================================
--- src/adts/lru_table.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/adts/lru_table.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -73,15 +73,16 @@
Adds new item to end of table list and lru list.
Sets those two item ptrs to each other.
- @param key Must be on the heap.
- @param data Must be on the heap.
+ @param key
+ @param data
@return NULL if the table is not overfull or a
struct keyvalue* representing the key/data pair
that was LRU and selected as a victim.
*/
struct keyvalue*
-lru_table_add(struct lru_table* table, char* key, char* data, int length)
+lru_table_add(struct lru_table* table, char* key,
+ void* data, int length)
{
NOTE_FS(key);
@@ -101,7 +102,6 @@
if (victim == NULL)
{
- NOTE("no victim\n");
table->size++;
}
else
@@ -220,9 +220,6 @@
else
{
int oldest_index = hash_string(oldest->key, table->capacity);
- // SHOW_P((void*) oldest);
- // NOTE_S("OLDEST: ", oldest->key);
- // NOTE_S("OLDEST: ", ((struct dpkm_list_item*) oldest->ptr)->key);
dpkm_list_excise(table->array[oldest_index], oldest->ptr);
result = (struct keyvalue*) malloc(sizeof(struct keyvalue));
// SHOW_S(oldest->key);
@@ -231,6 +228,7 @@
result->length = oldest->length;
free(oldest->ptr);
free(oldest);
+ table->size--;
}
return result;
@@ -325,21 +323,28 @@
/**
*/
void
-lru_table_printdata(struct lru_table* target)
+lru_table_fprintdata(FILE* file, struct lru_table* target)
{
int i;
- printf("LRU_TABLE(%i) \n{\n", target->size);
- printf("LRU: ");
- dpkm_list_printdata(target->lru);
+ fprintf(file, "LRU_TABLE(%i) \n{\n", target->size);
+ fprintf(file, "LRU: ");
+ dpkm_list_fprintdata(file, target->lru);
for (i = 0; i < target->capacity; i++)
if (target->array[i]->size > 0)
{
- printf(" %i: ", i);
- dpkm_list_printdata(target->array[i]);
+ fprintf(file, " %i: ", i);
+ dpkm_list_fprintdata(file, target->array[i]);
}
- printf("}\n");
+ fprintf(file, "}\n");
}
+void
+lru_table_printdata(struct lru_table* target)
+{
+ lru_table_fprintdata(stdout, target);;
+}
+
+
/** Dump dpkm_list to string a la snprintf()
size must be greater than 2.
format specifies the output format for the data items
Modified: src/cmpi/cmpi.c
===================================================================
--- src/cmpi/cmpi.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/cmpi/cmpi.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -115,7 +115,7 @@
int result;
NOTE_F;
- DEBUG(lru_table_fprintf(debug_file, "%s", cmpi_cache));
+ DEBUG(lru_table_fprintdata(debug_file, cmpi_cache));
struct keyvalue* found = lru_table_search(cmpi_cache, key);
if (found)
@@ -129,6 +129,7 @@
}
else
{
+ printf("LOADPAIR!\n");
result = cmpi_disk_loadpair(key, data);
if (*data != NULL)
Modified: src/cmpi-cp/cmpi-cp.c
===================================================================
--- src/cmpi-cp/cmpi-cp.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/cmpi-cp/cmpi-cp.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -23,12 +23,26 @@
int value_size;
void
+finish(char* msg, int code)
+{
+ if (msg)
+ printf("%s\n", msg);
+#ifdef DMALLOC
+ printf("dmalloc_logpath: %s\n", dmalloc_logpath); \
+ dmalloc_shutdown(); \
+ dmalloc_log_unfreed();
+#endif
+ exit(code);
+}
+
+
+void
cmpi_cp_args(int argc, char* argv[])
{
if (argc == 1)
{
printhelp();
- exit(1);
+ finish(NULL, 1);
}
target1 = argv[1];
target2 = argv[2];
@@ -81,6 +95,9 @@
char data[value_size];
char msg[100];
int count = 0;
+
+ debug(printf("cmpi_cmp_put()...\n"));
+
while (! feof(file))
{
int total = 0;
@@ -134,7 +151,7 @@
int count, c;
int length;
- printf("cmpi_cp_get()\n");
+ debug(printf("cmpi_cp_get()\n"));
// fflush(stdout);
fprintf(to_cmpi, "get %s\n", object);
@@ -143,7 +160,7 @@
// c = fscanf(from_cmpi, "%i\n", &length);
fgets(message, 64, from_cmpi);
//printf("message: %i\n", c);
- printf("message: %s\n", message);
+ debug(printf("message: %s\n", message));
sscanf(message, "%i", &length);
if (length == -1)
@@ -157,7 +174,7 @@
if (c != 1)
{
printf("bad response: %s\n", data);
- exit(1);
+ finish(NULL, 1);
}
printf("count: %i\n", count);
@@ -189,7 +206,7 @@
bad_file(char* filename)
{
printf("Could not open: %s\n", filename);
- exit(1);
+ finish(NULL, 1);
}
/**
@@ -243,7 +260,7 @@
int
main(int argc, char* argv[])
{
- // printf("\ncmpi-cp start\n\n");
+ debug(printf("\ncmpi-cp start\n\n"));
fflush(stdout);
@@ -261,13 +278,12 @@
if (target1_type == CMPI_CP_FILE &&
target2_type == CMPI_CP_FILE)
- {
- printf("cmpi-cp: given two files!\n");
- exit(1);
- }
+ finish("cmpi-cp: given two files!", 1);
driver_access_fifo_setup(NULL);
+ debug(printf("setup\n"));
driver_access_fifo();
+ debug(printf("access\n"));
int result =
cmpi_cp_case(target1_type, object1, target2_type, object2);
@@ -276,12 +292,10 @@
{
// cmpi_get could not find the dht:// target
printf("does not exist: %s\n", target1);
- exit(1);
+ finish(NULL, 1);
}
else if (result != CMPI_SUCCESS)
- {
- printf("error\n");
- exit(1);
- }
+ finish("error!\n", 1);
+
return 0;
}
Modified: src/dense-1/dense.c
===================================================================
--- src/dense-1/dense.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/dense-1/dense.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -275,7 +275,7 @@
char* key = heap(args);
cmpi_cached_store(key, blob, blob_length);
- DEBUG(lru_table_printf("%s", cmpi_cache));
+ DEBUG(lru_table_printdata(cmpi_cache));
MPIRPC_Null(caller, unique);
}
@@ -292,7 +292,7 @@
sscanf(args, "%s %i", key, &offset);
cmpi_cached_update(key, blob, offset, blob_length);
- // DEBUG(lru_table_printf("%s", cmpi_cache));
+ // DEBUG(lru_table_printdata("%s", cmpi_cache));
MPIRPC_Null(caller, unique);
}
@@ -331,7 +331,7 @@
{
MPIRPC_Null(caller, unique);
note("cmpi_cache:");
- lru_table_printf("%s", cmpi_cache);
+ lru_table_printdata(cmpi_cache);
}
void
Modified: src/mpi_tools/mpi_tools.c
===================================================================
--- src/mpi_tools/mpi_tools.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/mpi_tools/mpi_tools.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -80,29 +80,35 @@
*/
void
-printdata(char* tag, char* data, int length)
+fprintdata(FILE* file, char* tag, char* data, int length)
{
int i;
int c;
- printf("%s[", tag);
+ fprintf(file, "%s[", tag);
for (i = 0; i < length; i++)
{
c = data[i];
if (c == '\0')
- printf("\\0");
+ fprintf(file, "\\0");
else if (c == '\n')
- printf("\\n");
+ fprintf(file, "\\n");
else if (c == '\t')
- printf("\\t");
+ fprintf(file, "\\t");
else if (c >= 32 && c <=126)
- printf("%c", c);
+ fprintf(file, "%c", c);
else
- printf("\\%i", (int) c);
+ fprintf(file, "\\%i", (int) c);
}
- printf("]");
+ fprintf(file, "]");
}
void
+printdata(char* tag, char* data, int length)
+{
+ fprintdata(stdout, tag, data, length);
+}
+
+void
printbinary(unsigned int number)
{
int x;
Modified: src/mpirpc/mpirpc.c
===================================================================
--- src/mpirpc/mpirpc.c 2010-05-22 21:40:52 UTC (rev 146)
+++ src/mpirpc/mpirpc.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -389,13 +389,13 @@
/* printf("\t [%i] %s(%s) for %i \n",
mpi_rank, name, args, caller); */
- char* (*f)(MPIRPC_Node,int,char*,char*,int) =
+ char* (*handler)(MPIRPC_Node,int,char*,char*,int) =
hashtable_search(portmap, name);
- if (f == NULL)
+ if (handler == NULL)
printf("No such method: %s \n", name);
else
- f(caller, unique, args, blob, blob_length);
+ handler(caller, unique, args, blob, blob_length);
}
/**
Modified: test/adts/test-dpkm_list.c
===================================================================
--- test/adts/test-dpkm_list.c 2010-05-22 21:40:52 UTC (rev 146)
+++ test/adts/test-dpkm_list.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -5,6 +5,8 @@
#include <dpkm_list.h>
+#include "test_helpers.h"
+
void extra(struct dpkm_list_item* item)
{
if (item)
@@ -39,21 +41,6 @@
}
}
-void* makedata(int n)
-{
- char* result = malloc(n*sizeof(char));
- for (int i = 0; i < n; i++)
- result[i] = 'X';
- return (void*) result;
-}
-
-char* makekey(int i)
-{
- char* result = malloc(16);
- sprintf(result, "%i", i);
- return result;
-}
-
int
main(int argc, char* argv[])
{
Modified: test/adts/test-inlist.c
===================================================================
--- test/adts/test-inlist.c 2010-05-22 21:40:52 UTC (rev 146)
+++ test/adts/test-inlist.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -25,7 +25,7 @@
MPI_Finalize();
- TEST_DMALLOC;
+ DMALLOC_COMPLETE;
return 0;
}
Modified: test/adts/test-lru_table01.c
===================================================================
--- test/adts/test-lru_table01.c 2010-05-22 21:40:52 UTC (rev 146)
+++ test/adts/test-lru_table01.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -5,10 +5,35 @@
#include <lru_table.h>
+/*
#ifdef DMALLOC
#include "dmalloc.h"
#endif
+*/
+#include "test_helpers.h"
+
+void extra_kv(struct keyvalue* kv)
+{
+ if (kv)
+ {
+ printf("extra: %s \n", kv->key);
+ free(kv);
+ }
+}
+
+/**
+ Clean up extra keyvalue and its key and data.
+*/
+void extra_kv_kd(struct keyvalue* kv)
+{
+ if (kv)
+ {
+ printf("extra: %s \n", kv->key);
+ free(kv);
+ }
+}
+
int
main(int argc, char* argv[])
{
@@ -19,90 +44,83 @@
struct lru_table* table = lru_table_create(5, 4);
- int* zero = malloc(sizeof(int));
int* one = malloc(sizeof(int));
int* two = malloc(sizeof(int));
- int* three = malloc(sizeof(int));
- int* four = malloc(sizeof(int));
- int* five = malloc(sizeof(int));
- int* eight = malloc(sizeof(int));
- *zero = 0;
*one = 1;
*two = 2;
- *three = 3;
- *four = 4;
- *five = 5;
- *eight = 8;
struct keyvalue* kv;
- kv = lru_table_add(table, heap("two"), (char*) two, sizeof(int));
+ kv = lru_table_add(table, "one", one, sizeof(int));
lru_table_printf("%i", table);
- if (kv)
- printf("victim: %s \n", kv->key);
+ extra_kv(kv);
printf("\n");
- kv = lru_table_add(table, heap("one"), (char*) one, sizeof(int));
+ kv = lru_table_add(table, "two", two, sizeof(int));
lru_table_printf("%i", table);
- if (kv)
- printf("victim: %s \n", kv->key);
+ extra_kv(kv);
printf("\n");
- struct keyvalue* result;
+ kv = lru_table_search(table, "one");
+ assert(kv);
+ printf("data: %i\n", *(int*) kv->data);
+ free(kv);
- result = lru_table_search(table, "one");
- if (result == NULL)
- printf("one not found\n");
- else
- {
- printf("data: %i\n", (int) *result->data);
- free(result);
- }
+ kv = lru_table_search(table, "two");
+ assert(kv);
+ printf("data: %i\n", *(int*) kv->data);
+ free(kv);
- result = lru_table_search(table, "two");
- if (result == NULL)
- printf("two not found\n");
- else
- {
- printf("data: %i\n", (int) *result->data);
- free(result);
- }
+ kv = lru_table_search(table, "one");
+ assert(kv);
+ printf("data: %i\n", *(int*) kv->data);
+ free(kv);
- result = lru_table_search(table, "one");
- if (result == NULL)
- printf("one not found\n");
- else
+ while ((kv = lru_table_poll(table)))
{
- printf("data: %i\n", (int) *result->data);
- free(result);
+ printf("polled: %s %i\n", kv->key, *kv->data);
+ free(kv);
}
- result = lru_table_search(table, "two");
- if (result == NULL)
- printf("two not found\n");
- else
+ assert(table->size == 0);
+ lru_table_free(table);
+
+ free(one);
+ free(two);
+
+ note("loop...");
+ table = lru_table_create(6, 4);
+ for (int i = 0; i < 30; i++)
{
- printf("data: %i\n", (int) *result->data);
- free(result);
+ lru_table_printdata(table);
+ char* key = makekey(i);
+ if (rand() % 2)
+ {
+ void* data = makedata(i);
+ kv = lru_table_add(table, key, data, i);
+ extra_kv_kd(kv);
+ }
+ else
+ {
+ note_s("search: ", key);
+ kv = lru_table_search(table, key);
+ free(key);
+ extra_kv(kv);
+ }
}
- result = lru_table_search(table, "two");
- if (result == NULL)
- printf("two not found\n");
- else
+ note("draining...");
+ while ((kv = lru_table_poll(table)))
{
- printf("data: %i\n", (int) *result->data);
- free(result);
+ printf("polled: %s\n", kv->key, kv->data);
+ printdata("", kv->data, kv->length);
+ keyvalue_destroy(kv);
}
- while ((result = lru_table_poll(table)))
- {
- printf("polled: %s %i\n", result->key, *result->data);
- keyvalue_destroy(result);
- }
+ assert(table->size == 0);
lru_table_free(table);
/*
Modified: test/adts/test-lru_table02.c
===================================================================
--- test/adts/test-lru_table02.c 2010-05-22 21:40:52 UTC (rev 146)
+++ test/adts/test-lru_table02.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -1,6 +1,6 @@
/**
- * Test lru_table functionality.
+ * Test lru_table update functionality.
* */
#include <lru_table.h>
Modified: test/adts/test_helpers.h
===================================================================
--- test/adts/test_helpers.h 2010-05-22 21:40:52 UTC (rev 146)
+++ test/adts/test_helpers.h 2010-05-23 23:18:14 UTC (rev 147)
@@ -1,9 +1,26 @@
+/*
#define TEST_DMALLOC \
DMALLOC_SETUP( \
{ \
SHOW_S(dmalloc_logpath); \
dmalloc_shutdown(); \
- /* free(dmalloc_logpath); */ \
dmalloc_log_unfreed(); \
});
+
+*/
+
+void* makedata(int n)
+{
+ char* result = malloc(n*sizeof(char));
+ for (int i = 0; i < n; i++)
+ result[i] = 'X';
+ return (void*) result;
+}
+
+char* makekey(int i)
+{
+ char* result = malloc(16);
+ sprintf(result, "%i", i);
+ return result;
+}
Modified: test/cmpi-db/test-loop.zsh
===================================================================
--- test/cmpi-db/test-loop.zsh 2010-05-22 21:40:52 UTC (rev 146)
+++ test/cmpi-db/test-loop.zsh 2010-05-23 23:18:14 UTC (rev 147)
@@ -2,7 +2,7 @@
# Be sure to make tests with D=1
-# set -x
+set -x
OUTPUT=$1
NODES=$2
@@ -12,17 +12,24 @@
LOOPS=10
-cmpicp_error()
+TOOL_OUT=tool.out
+INPUT_DATA=input.data
+OUTPUT_DATA=output.data
+
+tool_error()
{
- ERR=$1
+ TOOL=$1
+ ERR=$2
if [[ ${ERR} != 0 ]]
then
- cat cmpi-cp.out
- rm -v cmpi-cp.out
- print "cmpi-cp error: ${ERR}"
+ cat ${TOOL_OUT}
+ rm -v ${TOOL_OUT}
+ print "${TOOL}: error: ${ERR}"
kill ${DB_PID}
kill ${BOMB_PID}
crash "failed"
+ else
+ print "success"
fi
}
@@ -36,23 +43,27 @@
sleep ${TOTAL}
-print > cmpi-cp.out
+print > ${TOOL_OUT}
for ((i=0 ; i<LOOPS ; i++))
do
- echo "DATA_${i}" > test-cp.input.data
- echo "cmpi-cp insert" >>& cmpi-cp.out
- bin/cmpi-cp test-cp.input.data dht://test-${i} >>& cmpi-cp.out
- cmpicp_error ${?}
+ echo "DATA_${i}" > ${INPUT_DATA}
+ echo "cmpi-cp insert" >>& ${TOOL_OUT}
+ bin/cmpi-cp ${INPUT_DATA} dht://test-${i} >>& ${TOOL_OUT}
+ tool_error "cmpi-cp" ${?} >>& ${TOOL_OUT}
- echo "\n\ncmpi-cp retrieve" >>& cmpi-cp.out
- bin/cmpi-cp dht://test-${i} test-cp.output.data >>& cmpi-cp.out
- cmpicp_error ${?}
- echo "\n read: " >>& cmpi-cp.out
- cat test-cp.output.data >>& cmpi-cp.out
- echo "\n" >>& cmpi-cp.out
+ echo "\n\ncmpi-cp retrieve" >>& ${TOOL_OUT}
+ bin/cmpi-cp dht://test-${i} ${OUTPUT_DATA} >>& ${TOOL_OUT}
+ tool_error "cmpi-cp" ${?} >>& ${TOOL_OUT}
+ echo "\n read: " >>& ${TOOL_OUT}
+ cat ${OUTPUT_DATA} >>& ${TOOL_OUT}
+ echo "\n" >>& ${TOOL_OUT}
done
-bin/cmpi-db-quit >& /dev/null
+echo "quitting" >>& ${TOOL_OUT}
+bin/cmpi-db-quit >>& ${TOOL_OUT}
+tool_error "cmpi-db-quit" ${?} >>& ${TOOL_OUT}
+echo "quit" >>& ${TOOL_OUT}
+
# QUIT_PROCESS=${!}
wait ${DB_PID}
@@ -63,6 +74,4 @@
check_exits ${TOTAL} ${OUTPUT}
-rm -f cmpi-cp.out test-cp1.*.data
-
exit 0
Modified: test/mpirpc/test-args.c
===================================================================
--- test/mpirpc/test-args.c 2010-05-22 21:40:52 UTC (rev 146)
+++ test/mpirpc/test-args.c 2010-05-23 23:18:14 UTC (rev 147)
@@ -12,8 +12,6 @@
char* blob, int blob_length)
{
show_fs(args);
- if (args)
- free(args);
MPIRPC_Null(caller, unique);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|