CHT cleanup; integrated cht tests into make check.
This commit is contained in:
parent
3642716431
commit
eed439d53a
4 changed files with 51 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
TESTS=./run
|
||||
LDADD=-lconfuse $(top_builddir)/src/apps/cht/libcht.a $(top_builddir)/src/2pc/lib2pc.a $(top_builddir)/src/libdfa/libdfa.a \
|
||||
$(top_builddir)/src/lladd/liblladd.a $(top_builddir)/src/pbl/libpbl.a $(top_builddir)/src/libdfa/librw.a
|
||||
bin_PROGRAMS=simple cht_server client coordinator subordinate
|
||||
|
|
|
@ -37,13 +37,14 @@ int main(int argc, char ** argv) {
|
|||
unsigned int newLen = sizeof(int);
|
||||
int ret = cHtLookup(xid, cht_client, new_ht, &newOne, sizeof(int), &newTwo, &newLen);
|
||||
xid++;
|
||||
printf("lookup returned %d (%d->%d)\n", ret, newOne, newTwo);
|
||||
//printf("lookup returned %d (%d->%d)\n", ret, newOne, newTwo);
|
||||
assert(ret);
|
||||
assert(newOne == one);
|
||||
assert(newTwo == two);
|
||||
assert(newLen == sizeof(int));
|
||||
}
|
||||
|
||||
// shutdown main thread somehow...
|
||||
/** @todo devise a way to cleanly shut a CHT down. */
|
||||
|
||||
// dfa_free(cht_client);
|
||||
}
|
||||
|
|
7
test/cht/prepend
Executable file
7
test/cht/prepend
Executable file
|
@ -0,0 +1,7 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
$| = 1;
|
||||
while(my $line = <STDIN>) {
|
||||
print("$ARGV[0]:\t$line");
|
||||
}
|
40
test/cht/run
Executable file
40
test/cht/run
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
|
||||
print("\n\nRunning Cluster Hash Table self test.\n");
|
||||
print("-------------------------------------\n");
|
||||
|
||||
mkdir 'coord';
|
||||
mkdir 'sub0';
|
||||
mkdir 'sub1';
|
||||
mkdir 'sub2';
|
||||
mkdir 'sub3';
|
||||
|
||||
chdir 'coord';
|
||||
system ("rm *.txt");
|
||||
system ("../coordinator ../cluster.conf > /dev/null &");
|
||||
chdir '..';
|
||||
chdir 'sub0';
|
||||
system ("rm *.txt");
|
||||
system ("../subordinate 0 ../cluster.conf > /dev/null &");
|
||||
chdir '..';
|
||||
chdir 'sub1';
|
||||
system ("rm *.txt");
|
||||
system ("../subordinate 1 ../cluster.conf > /dev/null &");
|
||||
chdir '..';
|
||||
chdir 'sub2';
|
||||
system ("rm *.txt");
|
||||
system ("../subordinate 2 ../cluster.conf > /dev/null &");
|
||||
chdir '..';
|
||||
chdir 'sub3';
|
||||
system ("rm *.txt");
|
||||
system ("../subordinate 3 ../cluster.conf > /dev/null &");
|
||||
chdir '..';
|
||||
|
||||
system ("rm *.txt");
|
||||
my $ret = system ("./client 2>&1");
|
||||
|
||||
`killall coordinator`;
|
||||
`killall subordinate`;
|
||||
|
||||
exit $ret;
|
Loading…
Reference in a new issue