[C-MPI-commits] SF.net SVN: c-mpi:[168]
Status: Pre-Alpha
Brought to you by:
jmwozniak
|
From: <jmw...@us...> - 2011-04-14 23:54:32
|
Revision: 168
http://c-mpi.svn.sourceforge.net/c-mpi/?rev=168&view=rev
Author: jmwozniak
Date: 2011-04-14 23:54:25 +0000 (Thu, 14 Apr 2011)
Log Message:
-----------
Misc. code cleanups
Modified Paths:
--------------
Makefile.in
TODO.txt
include/cmpi-types.h
include/cmpi.h
include/cmpi_dense-1.h
include/inlist.h
include/kda-2.h
include/list.h
include/mpirpc.h
src/adts/About.txt
src/adts/inlist.c
src/adts/lru_table.c
src/cmpi/driver.c
src/cmpi/node.c
src/dense-1/cmpi_dense.c
src/dense-1/dense.c
src/kda-2/cmpi_kademlia.c
src/kda-2/kademlia.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_helpers.h
test/cmpi/test-manyputs.c
test/cmpi/test-putget.c
test/cmpi/test-tables.c
test/cmpi/test-update01.c
test/cmpi/test-update02.c
test/driver/module.mk.in
test/driver/test-cmd-get.c
test/driver/test-cmd-quit.c
test/driver/test-cmd-sleep.c
test/driver/test-quit.zsh
test/driver/test.zsh
test/driver/test_driver_fifo.c
test/mpirpc/test-args.c
test/mpirpc/test-args.zsh
test/mpirpc/test-blob.c
test/mpirpc/test-blob.zsh
test/mpirpc/test-ping.c
test/mpirpc/test-returns.c
tools/test-helpers.zsh
Added Paths:
-----------
include/cmpi-driver.h
Removed Paths:
-------------
include/driver.h
Modified: Makefile.in
===================================================================
--- Makefile.in 2011-04-14 23:53:21 UTC (rev 167)
+++ Makefile.in 2011-04-14 23:54:25 UTC (rev 168)
@@ -12,7 +12,7 @@
# INPUT CONTROL VARIABLES
# D : if 1, turn on debugging output in CMPI programs
# G : if 1, certain tests wait for GDB to attach
-# S : if 1, turn on debugging symbols
+# S : if 0, turn off debugging symbols
# T : if 1, turn on MPE printf debugging
# V : if 1, turn on normal make output
@@ -93,7 +93,9 @@
ifeq ($(G),1)
GDB_WAIT="-D GDB_WAIT"
endif
-ifeq ($(S),1)
+ifeq ($(S),0)
+ GGDB = 0
+else
GGDB = 1
endif
ifeq ($(T),1)
Modified: TODO.txt
===================================================================
--- TODO.txt 2011-04-14 23:53:21 UTC (rev 167)
+++ TODO.txt 2011-04-14 23:54:25 UTC (rev 168)
@@ -8,3 +8,5 @@
* Simplify header files, move more definitions into the C files
that need them
+
+* Migrate away from requiring D=1 for test output
Added: include/cmpi-driver.h
===================================================================
--- include/cmpi-driver.h (rev 0)
+++ include/cmpi-driver.h 2011-04-14 23:54:25 UTC (rev 168)
@@ -0,0 +1,47 @@
+
+#include <cmpi-config.h>
+
+#include <getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <cmpi.h>
+#include <io_tools.h>
+
+/**
+ Maximum command line for driver.
+*/
+#define CMPI_DRIVER_MAX_COMMAND (100+CMPI_KEY_LENGTH)
+
+typedef struct
+{
+ FILE* source;
+ FILE* sink;
+ char command[CMPI_DRIVER_MAX_COMMAND];
+ char data[CMPI_VALUE_LENGTH];
+ bool quitting;
+} cmpi_driver;
+
+enum
+{
+ CMPI_DRIVER_FILE,
+ CMPI_DRIVER_STDIN,
+ CMPI_DRIVER_PIPE
+};
+
+//// API...
+
+cmpi_driver* driver_create(void);
+
+bool driver_setup_stdin(cmpi_driver* driver);
+bool driver_setup_file(cmpi_driver* driver, char* filename);
+bool driver_setup_fifo(cmpi_driver* driver);
+
+void driver_process(cmpi_driver* driver);
+
+//// Internal functions...
+
+struct list* driver_tokens(cmpi_driver* driver);
+
+
+
Modified: include/cmpi-types.h
===================================================================
--- include/cmpi-types.h 2011-04-14 23:53:21 UTC (rev 167)
+++ include/cmpi-types.h 2011-04-14 23:54:25 UTC (rev 168)
@@ -2,7 +2,7 @@
#ifndef CMPI_TYPES_H
#define CMPI_TYPES_H
-#define CMPI_KEY_LENGTH 64
+#define CMPI_KEY_LENGTH 64
#define CMPI_VALUE_LENGTH (64*1024)
/**
Modified: include/cmpi.h
===================================================================
--- include/cmpi.h 2011-04-14 23:53:21 UTC (rev 167)
+++ include/cmpi.h 2011-04-14 23:54:25 UTC (rev 168)
@@ -40,7 +40,7 @@
extern int cmpi_nodes;
-#define CMPI_BLOB_LENGTH LIST_MAX_DATUM
+#define CMPI_BLOB_LENGTH (4*1024*1024)
extern struct lru_table* cmpi_cache;
@@ -118,7 +118,6 @@
//// Methods to aid passing information to user programs:
void cmpi_params_init(void);
-
/**
Stores a copy of the key, value pair.
*/
Modified: include/cmpi_dense-1.h
===================================================================
--- include/cmpi_dense-1.h 2011-04-14 23:53:21 UTC (rev 167)
+++ include/cmpi_dense-1.h 2011-04-14 23:54:25 UTC (rev 168)
@@ -2,13 +2,6 @@
#ifndef CMPI_DENSE_1_H
#define CMPI_DENSE_1_H
-#include "dense-1.h"
+// Nothing to do
-//// Helpers:
-
-void add_contacts(void);
-
-void DENSE_Read_params(void);
-
-
#endif
Deleted: include/driver.h
===================================================================
--- include/driver.h 2011-04-14 23:53:21 UTC (rev 167)
+++ include/driver.h 2011-04-14 23:54:25 UTC (rev 168)
@@ -1,47 +0,0 @@
-
-#include <cmpi-config.h>
-
-#include <getopt.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <cmpi.h>
-#include <io_tools.h>
-
-/**
- Maximum command line for driver.
-*/
-#define CMPI_DRIVER_MAX_COMMAND (100+CMPI_KEY_LENGTH)
-
-typedef struct
-{
- FILE* source;
- FILE* sink;
- char command[CMPI_DRIVER_MAX_COMMAND];
- char data[CMPI_VALUE_LENGTH];
- bool quitting;
-} cmpi_driver;
-
-enum
-{
- CMPI_DRIVER_FILE,
- CMPI_DRIVER_STDIN,
- CMPI_DRIVER_PIPE
-};
-
-//// API...
-
-cmpi_driver* driver_create(void);
-
-bool driver_setup_stdin(cmpi_driver* driver);
-bool driver_setup_file(cmpi_driver* driver, char* filename);
-bool driver_setup_fifo(cmpi_driver* driver);
-
-void driver_process(cmpi_driver* driver);
-
-//// Internal functions...
-
-struct list* driver_tokens(cmpi_driver* driver);
-
-
-
Modified: include/inlist.h
===================================================================
--- include/inlist.h 2011-04-14 23:53:21 UTC (rev 167)
+++ include/inlist.h 2011-04-14 23:54:25 UTC (rev 168)
@@ -7,16 +7,9 @@
#ifndef INLIST_H
#define INLIST_H
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <stdbool.h>
+#include <stdlib.h>
-#include <mpi_tools.h>
-
-// Maximum size of a kinlist datum
-#define INLIST_MAX_DATUM 100
-
struct inlist_item
{
int data;
@@ -43,8 +36,6 @@
bool inlist_remove(struct inlist* target, int data);
-bool inlist_erase(struct inlist* target, int data, size_t n);
-
int inlist_pop(struct inlist* target);
int inlist_peek(struct inlist* target);
Modified: include/kda-2.h
===================================================================
--- include/kda-2.h 2011-04-14 23:53:21 UTC (rev 167)
+++ include/kda-2.h 2011-04-14 23:54:25 UTC (rev 168)
@@ -136,6 +136,8 @@
char* KDA_Description(void);
char* KDA_id_tostring(KDA_ID other_id);
+KDA_Neighbor* KDA_Random_neighbor(void);
+
//// Remote API:
MPIRPC* KDA_Translate(MPIRPC_Node node, KDA_ID id);
MPIRPC* KDA_Translate_k(MPIRPC_Node node, KDA_ID id);
@@ -146,6 +148,4 @@
MPIRPC* KDA_Retrieve(KDA_Neighbor* neighbor, char* key);
-
-
#endif
Modified: include/list.h
===================================================================
--- include/list.h 2011-04-14 23:53:21 UTC (rev 167)
+++ include/list.h 2011-04-14 23:54:25 UTC (rev 168)
@@ -13,7 +13,7 @@
#include <mpi_tools.h>
-// Maximum size of a list datum
+// Maximum size of a list datum (only used for debug printing)
#define LIST_MAX_DATUM 1024
struct list_item
Modified: include/mpirpc.h
===================================================================
--- include/mpirpc.h 2011-04-14 23:53:21 UTC (rev 167)
+++ include/mpirpc.h 2011-04-14 23:54:25 UTC (rev 168)
@@ -4,6 +4,10 @@
#include <cmpi-config.h>
+#include <mpi.h>
+
+#include <stdbool.h>
+
#define MPIRPC_MAX_NAME 128
#define MPIRPC_MAX_ARGS 256
#define MPIRPC_PROCEED_NULL ((void (*)(MPIRPC*)) 1)
@@ -125,6 +129,8 @@
void MPIRPC_Snooze_reset(void);
+void MPIRPC_Snooze_set(int s);
+
//// Data structure helpers...
int MPIRPC_Node_cmp(void* node1, void* node2);
Modified: src/adts/About.txt
===================================================================
--- src/adts/About.txt 2011-04-14 23:53:21 UTC (rev 167)
+++ src/adts/About.txt 2011-04-14 23:54:25 UTC (rev 168)
@@ -1,15 +1,19 @@
+Index of possible ADT functions
+
void _append(target, key)
bool _add(target, key)
+ { should allow duplicates }
+bool _add_unique(target, cmp(), key)
{ false and do nothing if key found }
-bool _add_unique(target, cmp(), key)
- {false and do nothing if key found }
bool _contains(target, key)
bool _matches(target, cmp(), data)
DATA _search(target, key)
DATA _inspect(target, data, n)
+ { search for data in target that matches given data in n bytes }
_update(target, key, data, offset, length)
_set(target, key, data)
+ { reset the value of the given key }
DATA _poll() { head }
DATA _pop() { tail }
DATA _get(i)
Modified: src/adts/inlist.c
===================================================================
--- src/adts/inlist.c 2011-04-14 23:53:21 UTC (rev 167)
+++ src/adts/inlist.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -1,6 +1,11 @@
#include "inlist.h"
+#include <stdio.h>
+#include <string.h>
+
+#include <mpi_tools.h>
+
struct inlist*
inlist_create()
{
@@ -367,6 +372,7 @@
}
/**
+ Allocate and return string containing ints in this inlist
Returns pointer to allocated output location, 12*size.
*/
char*
@@ -403,7 +409,6 @@
free(target);
}
-
/*
*
** Dump inlist to string a la snprintf()
Modified: src/adts/lru_table.c
===================================================================
--- src/adts/lru_table.c 2011-04-14 23:53:21 UTC (rev 167)
+++ src/adts/lru_table.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -73,7 +73,7 @@
Adds new item to end of table list and lru list.
Sets those two item ptrs to each other.
- @param key
+ @param key May not be NULL
@param data
@return NULL if the table is not overfull or a
@@ -85,6 +85,7 @@
void* data, int length)
{
NOTE_FS(key);
+ assert(key);
struct keyvalue* result = NULL;
Modified: src/cmpi/driver.c
===================================================================
--- src/cmpi/driver.c 2011-04-14 23:53:21 UTC (rev 167)
+++ src/cmpi/driver.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -8,8 +8,10 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <unistd.h>
-#include <driver.h>
+#include <cmpi-driver.h>
+#include <list.h>
char* filename = NULL;
@@ -119,7 +121,7 @@
void
driver_put(cmpi_driver* driver, struct list* tokens)
{
- char* key = tokens->head->next->data;
+ char* key = (char*) tokens->head->next->data;
char value[CMPI_VALUE_LENGTH];
int length;
int n;
Modified: src/cmpi/node.c
===================================================================
--- src/cmpi/node.c 2011-04-14 23:53:21 UTC (rev 167)
+++ src/cmpi/node.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -10,6 +10,9 @@
* -t <tag> symbolic tag number.
*/
+#include <getopt.h>
+#include <unistd.h>
+
#include <node.h>
#include <cmpi_mode.h>
#include <io_tools.h>
@@ -20,6 +23,7 @@
void
options(int argc, char* argv[])
{
+
struct option options[] =
{
{"cache", required_argument, NULL, 'c'},
@@ -38,7 +42,7 @@
// Defaults...
cmpi_cache_limit = 10000;
- snooze_max = 500000;
+ int snooze_max = 500000;
debug_rank = mpi_rank;
cmpi_nodes = mpi_size;
@@ -115,6 +119,8 @@
}
c++;
}
+
+ MPIRPC_Snooze_set(snooze_max);
}
/**
Modified: src/dense-1/cmpi_dense.c
===================================================================
--- src/dense-1/cmpi_dense.c 2011-04-14 23:53:21 UTC (rev 167)
+++ src/dense-1/cmpi_dense.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -3,11 +3,17 @@
#include <cmpi_dense-1.h>
+#include <dense-1.h>
+
/**
List of node ranks to contact for DENSE routines.
*/
-struct inlist* contacts;
+static struct inlist* contacts;
+// void add_contacts(void);
+
+static void DENSE_Read_params(void);
+
CMPI_RETURN
cmpi_init_impl()
{
@@ -123,8 +129,7 @@
NOTE("got ranks: ");
DEBUG(inlist_printf(ranks));
- for (item = ranks->head;
- item; item = item->next)
+ for (item = ranks->head; item; item = item->next)
{
SHOW_I(item->data);
MPIRPC_Node_make(MPI_COMM_WORLD, item->data, &node);
@@ -170,6 +175,9 @@
return CMPI_SUCCESS;
}
+/**
+ Blocking call.
+*/
CMPI_RETURN
cmpi_get(char* key, char** value, int* length)
{
@@ -236,7 +244,10 @@
}
}
-void
+/**
+ Extract parameters from C-MPI specific to DENSE
+ */
+static void
DENSE_Read_params(void)
{
// NOTE_F;
Modified: src/dense-1/dense.c
===================================================================
--- src/dense-1/dense.c 2011-04-14 23:53:21 UTC (rev 167)
+++ src/dense-1/dense.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -154,8 +154,7 @@
char args[32];
sprintf(args, "%X", id);
MPIRPC* rpc =
- MPIRPC_Call(node, "query_id_k", args,
- NULL, MPIRPC_PROCEED_NULL);
+ MPIRPC_Call(node, "query_id_k", args, NULL, MPIRPC_PROCEED_NULL);
return rpc;
}
@@ -187,9 +186,9 @@
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);
+ MPIRPC* rpc =
+ MPIRPC_Call_blob(node, "update", args, value, length,
+ NULL, MPIRPC_PROCEED_NULL);
return rpc;
}
@@ -197,14 +196,13 @@
Instruct a node to retrieve a value.
Asynchronous. Copies key into MPIRPC.
User must use MPIRPC->result_length
- to find number of bytes retrieved.
+ to find number of bytes retrieved.
*/
MPIRPC*
DENSE_Retrieve(MPIRPC_Node node, char* key)
{
MPIRPC* rpc =
- MPIRPC_Call(node, "retrieve", key,
- NULL, MPIRPC_PROCEED_NULL);
+ MPIRPC_Call(node, "retrieve", key, NULL, MPIRPC_PROCEED_NULL);
return rpc;
}
@@ -250,7 +248,7 @@
sscanf(args, "%X", &object_id);
int other_rank = object_id % dense_nodes;
char* result = malloc(10*sizeof(char));
- int length = sprintf(result, "%i", other_rank);
+ int length = sprintf(result, "%i", other_rank)+1;
MPIRPC_Return(caller, unique, result, length);
}
Modified: src/kda-2/cmpi_kademlia.c
===================================================================
--- src/kda-2/cmpi_kademlia.c 2011-04-14 23:53:21 UTC (rev 167)
+++ src/kda-2/cmpi_kademlia.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -83,7 +83,7 @@
}
NOTE("CONTACT LOOKUP FAILED: LINKING");
- KDA_Harpoon(random_neighbor()->node, neighbor->id);
+ KDA_Harpoon(KDA_Random_neighbor()->node, neighbor->id);
add_contacts();
return contact_lookup(neighbor);
Modified: src/kda-2/kademlia.c
===================================================================
--- src/kda-2/kademlia.c 2011-04-14 23:53:21 UTC (rev 167)
+++ src/kda-2/kademlia.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -98,7 +98,6 @@
static char* id_tostring(void);
static void listen_loop(void);
static void bootstrap(MPIRPC_Node node);
-KDA_Neighbor* random_neighbor(void);
int KDA_Neighbor_table_size(void);
@@ -215,7 +214,7 @@
}
KDA_Neighbor*
-random_neighbor()
+KDA_Random_neighbor()
{
int i;
struct list_item* item;
@@ -1014,7 +1013,7 @@
dump_bucket_ids()
{
char* result = bucket_ids_tostring();
- printf(result);
+ printf("%s", result);
free(result);
}
Modified: src/mpi_tools/mpi_tools.c
===================================================================
--- src/mpi_tools/mpi_tools.c 2011-04-14 23:53:21 UTC (rev 167)
+++ src/mpi_tools/mpi_tools.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -162,9 +162,9 @@
note(char* msg)
{
if (msg == NULL)
- fprintf(debug_file, "[%i] (NULL) \n", debug_rank);
+ fprintf(debug_file, "(NULL) \n");
else
- fprintf(debug_file, "[%i] %s \n", debug_rank, msg);
+ fprintf(debug_file, "%s \n", msg);
fflush(debug_file);
Modified: src/mpirpc/mpirpc.c
===================================================================
--- src/mpirpc/mpirpc.c 2011-04-14 23:53:21 UTC (rev 167)
+++ src/mpirpc/mpirpc.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -1,7 +1,6 @@
#include <mpi_tools.h>
-#include <stdbool.h>
#include <unistd.h>
#include <itable.h>
@@ -338,7 +337,7 @@
/**
Receives RPC and issues it to local procedure handler.
name is on the stack.
- Handler should free args and blob.
+ Handler should free blob.
*/
void
MPIRPC_Request(MPIRPC_Node caller)
@@ -392,8 +391,7 @@
MPI_Recv(blob, blob_length, MPI_CHAR, caller.rank,
MPIRPC_TAG_ARGS, caller.comm, &status);
}
- /* printf("\t [%i] %s(%s) for %i \n",
- mpi_rank, name, args, caller); */
+ printf("\t %s(%s) from %i \n", name, args, caller.rank);
char* (*handler)(MPIRPC_Node,int,char*,char*,int) =
hashtable_search(portmap, name);
@@ -798,11 +796,18 @@
usleep(snooze_amount *= 2);
}
-void MPIRPC_Snooze_reset()
+void
+MPIRPC_Snooze_reset()
{
snooze_amount = snooze_amount_reset;
}
+void
+MPIRPC_Snooze_set(int s)
+{
+ snooze_max = s;
+}
+
/**
Convenience method for MPI_Comm_get_name().
Places the name in a static location.
Modified: test/adts/test-dpkm_list.c
===================================================================
--- test/adts/test-dpkm_list.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/adts/test-dpkm_list.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -11,7 +11,7 @@
{
if (item)
{
- note_s("extra: ", item->key);
+ printf("extra: %s\n", item->key);
free(item);
}
}
@@ -20,7 +20,7 @@
{
if (item)
{
- note_s("extra: ", item->key);
+ printf("extra: %s\n", item->key);
printdata("data: ", item->data, strlen(item->data));
printf("\n");
free(item->data);
@@ -32,7 +32,7 @@
{
if (item)
{
- note_s("extra: ", item->key);
+ printf("extra: %s\n", item->key);
printdata("data: ", item->data, item->length);
printf("\n");
free(item->key);
@@ -44,11 +44,6 @@
int
main(int argc, char* argv[])
{
- MPI_Init(&argc, &argv);
- whoami();
-
- dmalloc_setup();
-
struct dpkm_list* L = dpkm_list_create(4);
char s[1000];
@@ -105,7 +100,7 @@
extra(item);
dpkm_list_printf("%i", L);
- note("polling...");
+ puts("polling...");
while ((item = dpkm_list_poll(L)))
{
@@ -136,23 +131,18 @@
dpkm_list_printdata(L2);
char* key = makekey(j);
void* data = makedata(j);
- note_s("adding: ", key);
+ printf("adding: %s\n", key);
item = dpkm_list_add(L2, key, data, j);
extra_key_data(item);
}
}
dpkm_list_printdata(L2);
- note_i("size: ", L2->size);
+ printf("size: %i\n", L2->size);
while (item = dpkm_list_poll(L2))
extra_key_data(item);
- note_i("size: ", L2->size);
+ printf("size: %i\n", L2->size);
assert(L2->size == 0);
dpkm_list_free(L2);
-
- DMALLOC_COMPLETE;
-
- MPI_Finalize();
- return 0;
}
Modified: test/adts/test-inlist.c
===================================================================
--- test/adts/test-inlist.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/adts/test-inlist.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -3,6 +3,8 @@
* Test inlist functionality.
* */
+#include <mpi.h>
+
#include <inlist.h>
#include "test_helpers.h"
@@ -10,11 +12,6 @@
int
main(int argc, char* argv[])
{
- MPI_Init(&argc, &argv);
- whoami();
-
- dmalloc_setup();
-
char* s = " 1 4 2 ";
struct inlist* L = inlist_parse(s);
@@ -23,9 +20,5 @@
inlist_free(L);
- MPI_Finalize();
-
- DMALLOC_COMPLETE;
-
return 0;
}
Modified: test/adts/test-lru_table01.c
===================================================================
--- test/adts/test-lru_table01.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/adts/test-lru_table01.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -5,12 +5,6 @@
#include <lru_table.h>
-/*
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-*/
-
#include "test_helpers.h"
void extra_kv(struct keyvalue* kv)
@@ -30,6 +24,10 @@
if (kv)
{
printf("extra: %s \n", kv->key);
+ if (kv->data)
+ free(kv->data);
+ if (kv->key)
+ free(kv->key);
free(kv);
}
}
@@ -40,10 +38,8 @@
MPI_Init(&argc, &argv);
whoami();
- dmalloc_setup();
+ struct lru_table* table = lru_table_create(5, 4);
- struct lru_table* table = lru_table_create(5, 4);
-
int* one = malloc(sizeof(int));
int* two = malloc(sizeof(int));
@@ -91,7 +87,7 @@
free(one);
free(two);
- note("loop...");
+ printf("loop...");
table = lru_table_create(6, 4);
for (int i = 0; i < 30; i++)
{
@@ -105,14 +101,14 @@
}
else
{
- note_s("search: ", key);
+ printf("search: %s\n", key);
kv = lru_table_search(table, key);
free(key);
extra_kv(kv);
}
}
- note("draining...");
+ puts("draining...");
while ((kv = lru_table_poll(table)))
{
printf("polled: %s\n", kv->key, kv->data);
@@ -189,9 +185,10 @@
// dmalloc_shutdown();
+ printf("\n");
+ printf("Normal exit.\n");
+
MPI_Finalize();
- DMALLOC_COMPLETE;
-
return 0;
}
Modified: test/adts/test_helpers.h
===================================================================
--- test/adts/test_helpers.h 2011-04-14 23:53:21 UTC (rev 167)
+++ test/adts/test_helpers.h 2011-04-14 23:54:25 UTC (rev 168)
@@ -1,15 +1,6 @@
-/*
-#define TEST_DMALLOC \
- DMALLOC_SETUP( \
- { \
- SHOW_S(dmalloc_logpath); \
- dmalloc_shutdown(); \
- dmalloc_log_unfreed(); \
- });
+#include <stdio.h>
-*/
-
void* makedata(int n)
{
char* result = malloc(n*sizeof(char));
Modified: test/cmpi/test-manyputs.c
===================================================================
--- test/cmpi/test-manyputs.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/cmpi/test-manyputs.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -5,6 +5,8 @@
"reps" key in the CMPI cache.
*/
+#include <unistd.h>
+
#include "test_helpers.h"
/**
Modified: test/cmpi/test-putget.c
===================================================================
--- test/cmpi/test-putget.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/cmpi/test-putget.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -3,6 +3,8 @@
Put two keys and get one of them.
*/
+#include <unistd.h>
+
#include "test_helpers.h"
void
Modified: test/cmpi/test-tables.c
===================================================================
--- test/cmpi/test-tables.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/cmpi/test-tables.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -3,6 +3,10 @@
Assemble and debug tables.
*/
+#include <unistd.h>
+
+#include <cmpi.h>
+
#include "test_helpers.h"
void
Modified: test/cmpi/test-update01.c
===================================================================
--- test/cmpi/test-update01.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/cmpi/test-update01.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -3,6 +3,8 @@
Put three keys, update one, and get the updated value.
*/
+#include <unistd.h>
+
#include "test_helpers.h"
void
Modified: test/cmpi/test-update02.c
===================================================================
--- test/cmpi/test-update02.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/cmpi/test-update02.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -3,6 +3,8 @@
Update two new keys, update those, and retrieve one.
*/
+#include <unistd.h>
+
#include "test_helpers.h"
void
Modified: test/driver/module.mk.in
===================================================================
--- test/driver/module.mk.in 2011-04-14 23:53:21 UTC (rev 167)
+++ test/driver/module.mk.in 2011-04-14 23:54:25 UTC (rev 168)
@@ -47,7 +47,8 @@
test/driver/test%.out: test/driver/test%.zsh $(TEST_PROGS) $(TEST_DRIVER)
$(Q) " TEST $(@) "
- $(E) test/driver/test.zsh $(@) $(NODES) $(CLIENTS) $(<) $(DRIVER_DIR)
+ $(E) LAUNCH=$(LAUNCH) test/driver/test.zsh $(@) \
+ $(NODES) $(CLIENTS) $(<) $(DRIVER_DIR)
test/driver/test-success.out: test/cmpi/test-success.out \
$(TEST_DRIVER_OUTPUT)
Modified: test/driver/test-cmd-get.c
===================================================================
--- test/driver/test-cmd-get.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/driver/test-cmd-get.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -22,6 +22,7 @@
main(int argc, char* argv[])
{
int code;
+ char* t;
test_cmd_setup(argc, argv);
@@ -35,7 +36,7 @@
int length;
char message[32];
- fgets(message, 32, from_cmpi); // &length);
+ t = fgets(message, 32, from_cmpi); // &length);
// printf("length: %s\n", message);
// if (code != 1)
// crash("No response from driver!");
Modified: test/driver/test-cmd-quit.c
===================================================================
--- test/driver/test-cmd-quit.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/driver/test-cmd-quit.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -11,6 +11,7 @@
main(int argc, char* argv[])
{
int error;
+ int t;
test_cmd_setup(argc, argv);
@@ -20,7 +21,7 @@
fprintf(to_cmpi, "quit\n");
fflush(to_cmpi);
char output[32];
- fscanf(from_cmpi, "%s", output);
+ t = fscanf(from_cmpi, "%s", output);
assert(!strcmp(output, "ok"));
Modified: test/driver/test-cmd-sleep.c
===================================================================
--- test/driver/test-cmd-sleep.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/driver/test-cmd-sleep.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -12,6 +12,7 @@
main(int argc, char* argv[])
{
int code;
+ int t;
test_cmd_setup(argc, argv);
@@ -21,7 +22,8 @@
fprintf(to_cmpi, "sleep %i\n", sleep_time);
fflush(to_cmpi);
char output[32];
- fscanf(from_cmpi, "%s", output);
+ t = fscanf(from_cmpi, "%s", output);
+ assert(t == 0);
if (!(output[0] == 'o' &&
output[1] == 'k'))
Modified: test/driver/test-quit.zsh
===================================================================
--- test/driver/test-quit.zsh 2011-04-14 23:53:21 UTC (rev 167)
+++ test/driver/test-quit.zsh 2011-04-14 23:54:25 UTC (rev 168)
@@ -1 +1,3 @@
+#!/bin/zsh
+
test/driver/test-cmd-quit.x -d ${DRIVER_DIR}
Modified: test/driver/test.zsh
===================================================================
--- test/driver/test.zsh 2011-04-14 23:53:21 UTC (rev 167)
+++ test/driver/test.zsh 2011-04-14 23:54:25 UTC (rev 168)
@@ -12,8 +12,8 @@
bail()
{
- kill ${BOMB_PID}
- crash $1
+ [[ ${BOMB_PID} != "" ]] && kill ${BOMB_PID}
+ crash $1
}
# set -x
@@ -24,6 +24,8 @@
fi
CMPI_OPTS="-p driver_dir=${DRIVER_DIR}"
+[[ ${LAUNCH} == "" ]] && bail "No LAUNCH specified!"
+
DRIVER=test/driver/test_driver.x
${LAUNCH} -n ${TOTAL} ${DRIVER} -n ${NODES} ${CMPI_OPTS} > ${OUTPUT} &
DRIVER_PID=${!}
@@ -41,3 +43,7 @@
check_exits ${TOTAL} ${OUTPUT}
return 0
+
+# Local variables:
+# sh-basic-offset: 2
+# End:
Modified: test/driver/test_driver_fifo.c
===================================================================
--- test/driver/test_driver_fifo.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/driver/test_driver_fifo.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -1,6 +1,6 @@
#include <node.h>
-#include <driver.h>
+#include <cmpi-driver.h>
#include "test_helpers.h"
Modified: test/mpirpc/test-args.c
===================================================================
--- test/mpirpc/test-args.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/mpirpc/test-args.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -5,6 +5,8 @@
NULL return values.
*/
+#include <mpi_tools.h>
+#include <gossip.h>
#include <mpirpc.h>
void
Modified: test/mpirpc/test-args.zsh
===================================================================
--- test/mpirpc/test-args.zsh 2011-04-14 23:53:21 UTC (rev 167)
+++ test/mpirpc/test-args.zsh 2011-04-14 23:54:25 UTC (rev 168)
@@ -11,7 +11,7 @@
shift
LAUNCH=${*}
-eval ${LAUNCH} -n 2 ${PROGRAM} > ${OUTPUT} 2>&1
+eval ${LAUNCH} -n 2 ${VALGRIND} ${PROGRAM} > ${OUTPUT} 2>&1
CODE=$?
[[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
Modified: test/mpirpc/test-blob.c
===================================================================
--- test/mpirpc/test-blob.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/mpirpc/test-blob.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -5,6 +5,8 @@
for non-0-length blobs.
*/
+#include <mpi_tools.h>
+#include <gossip.h>
#include <mpirpc.h>
#include "test_helpers.h"
@@ -15,7 +17,7 @@
{
int a;
sscanf(args, "%i", &a);
- show_fsi(args, a);
+ printf("handle_test: %i\n", a);
assert(blob[0] == '\n');
assert(blob[1] == '\0');
@@ -25,6 +27,7 @@
printf("asserts ok\n");
MPIRPC_Null(caller, unique);
+ free(blob);
}
int
@@ -35,8 +38,6 @@
MPI_Init(&argc, &argv);
MPIRPC_Init();
- DMALLOC_SETUP(dmalloc_setup());
-
MPIRPC_Comm_add(MPI_COMM_WORLD);
MPIRPC_Node neighbor;
@@ -50,7 +51,7 @@
char* result;
MPIRPC_Node_make(MPI_COMM_WORLD, 1, &neighbor);
result = MPIRPC_Block_blob(neighbor, "test", "0", blob, 4);
- show_s(result);
+ printf("result: %s\n", result);
}
else
{
@@ -62,8 +63,4 @@
printf("Normal exit.\n");
MPIRPC_Finalize();
MPI_Finalize();
-
- TEST_DMALLOC;
-
- return 0;
}
Modified: test/mpirpc/test-blob.zsh
===================================================================
--- test/mpirpc/test-blob.zsh 2011-04-14 23:53:21 UTC (rev 167)
+++ test/mpirpc/test-blob.zsh 2011-04-14 23:54:25 UTC (rev 168)
@@ -11,7 +11,7 @@
shift
LAUNCH=${*}
-eval ${LAUNCH} -n 2 ${PROGRAM} > ${OUTPUT} 2>&1
+eval ${LAUNCH} -n 2 ${VALGRIND} ${PROGRAM} > ${OUTPUT} 2>&1
CODE=$?
[[ ${CODE} == 0 ]] || crash "exit code was: ${CODE}"
Modified: test/mpirpc/test-ping.c
===================================================================
--- test/mpirpc/test-ping.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/mpirpc/test-ping.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -4,6 +4,10 @@
No arguments or return values.
*/
+#include <unistd.h>
+
+#include <mpi_tools.h>
+#include <gossip.h>
#include <mpirpc.h>
#include "test_helpers.h"
Modified: test/mpirpc/test-returns.c
===================================================================
--- test/mpirpc/test-returns.c 2011-04-14 23:53:21 UTC (rev 167)
+++ test/mpirpc/test-returns.c 2011-04-14 23:54:25 UTC (rev 168)
@@ -5,6 +5,9 @@
for NULL, 0-length, and non-0-length return values.
*/
+#include <mpi_tools.h>
+#include <gossip.h>
+
#include <mpirpc.h>
#include "test_helpers.h"
Modified: tools/test-helpers.zsh
===================================================================
--- tools/test-helpers.zsh 2011-04-14 23:53:21 UTC (rev 167)
+++ tools/test-helpers.zsh 2011-04-14 23:54:25 UTC (rev 168)
@@ -23,7 +23,12 @@
crash()
{
print $1
- mv -v ${OUTPUT} ${OUTPUT}.failed
+ if [ -f ${OUTPUT} ]
+ then
+ mv -v ${OUTPUT} ${OUTPUT}.failed
+ else
+ print "Not created: ${OUTPUT}"
+ fi
exit 1
}
@@ -48,3 +53,7 @@
N=$( grep -c "Normal exit." ${OUTPUT} )
(( N == TOTAL )) || crash "N != ${TOTAL}"
}
+
+# Local variables:
+# mode: sh
+# End:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|