From: Jeffrey Altman Date: Thu, 18 Nov 2010 03:33:48 +0000 (-0500) Subject: more rx/tests cleanups X-Git-Tag: openafs-devel-1_7_1~1241 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=75aacd6a10b1ebd426907268aa584bdd1be61833 more rx/tests cleanups Include roken.h, always reference rx headers with rx prefix, add a resource file for Windows, remove warnings from testclient and testserver. add a .gitignore file. Change-Id: If75560ff9b21dc9a1abf99159d26214eb6b0b9a3 Reviewed-on: http://gerrit.openafs.org/3323 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/rx/test/.gitignore b/src/rx/test/.gitignore new file mode 100644 index 0000000..d617a22 --- /dev/null +++ b/src/rx/test/.gitignore @@ -0,0 +1,7 @@ +# After changing this file, please run +# git ls-files -i --exclude-standard +# to check that you haven't inadvertently ignored any tracked files. + +/rxperf +/testclient +/testserver diff --git a/src/rx/test/NTMakefile b/src/rx/test/NTMakefile index 695d02c..cdbdb6f 100644 --- a/src/rx/test/NTMakefile +++ b/src/rx/test/NTMakefile @@ -18,14 +18,17 @@ LIBS = \ $(DESTDIR)\lib\afs\afsreg.lib \ $(DESTDIR)\lib\afs\mtafsutil.lib \ $(DESTDIR)\lib\afsrpc.lib \ - $(DESTDIR)\lib\afspthread.lib + $(DESTDIR)\lib\afspthread.lib \ + $(DESTDIR)\lib\afsroken.lib RXTESTOBJS = $(OUT)\testclient.obj $(OUT)\testserver.obj tests: $(OUT)\rxperf.exe $(OUT)\testclient.exe $(OUT)\testserver.exe $(OUT)\tableGen.exe $(OUT)\generator.exe -$(OUT)\rxperf.exe: $(OUT)\rxperf.obj $(LIBS) +$(OUT)\rxperf.res: rxperf.rc AFS_component_version_number.h + +$(OUT)\rxperf.exe: $(OUT)\rxperf.obj $(OUT)\rxperf.res $(LIBS) $(EXECONLINK) $(_VC_MANIFEST_EMBED_EXE) $(CODESIGN_USERLAND) @@ -61,7 +64,5 @@ mkdir: install: tests -install9x: tests - clean:: - $(DEL) $(TESTS) + $(DEL) $(TESTS) $(OUT)\rxperf.res diff --git a/src/rx/test/rxperf.c b/src/rx/test/rxperf.c index 3f4a918..30461f5 100644 --- a/src/rx/test/rxperf.c +++ b/src/rx/test/rxperf.c @@ -41,6 +41,7 @@ nn * We are using getopt since we want it to be possible to link to #include #include +#include #include #include @@ -78,7 +79,6 @@ nn * We are using getopt since we want it to be possible to link to #include /* not stricly right, but if we have a errx() there * is hopefully a err.h */ #endif -#include #include #include #include diff --git a/src/rx/test/rxperf.rc b/src/rx/test/rxperf.rc new file mode 100644 index 0000000..ea52ab8 --- /dev/null +++ b/src/rx/test/rxperf.rc @@ -0,0 +1,17 @@ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +/* Define VERSIONINFO resource */ + +#define AFS_VERINFO_FILE_DESCRIPTION "RX Performance Test (pthread)" +#define AFS_VERINFO_NAME "rxperf" +#define AFS_VERINFO_FILENAME "rxperf.exe" + +#include "AFS_component_version_number.h" +#include "..\..\config\NTVersioninfo.rc" diff --git a/src/rx/test/testclient.c b/src/rx/test/testclient.c index 16ad50b..5b633df 100644 --- a/src/rx/test/testclient.c +++ b/src/rx/test/testclient.c @@ -11,7 +11,7 @@ #include #include - +#include #include #include @@ -27,10 +27,10 @@ #endif #include #include -#include "rx_clock.h" -#include "rx.h" -#include "rx_globals.h" -#include "rx_null.h" +#include +#include +#include +#include #include #include @@ -48,7 +48,10 @@ FILE *debugFile; int timeout; struct clock waitTime, computeTime; -void OpenFD(); +void OpenFD(int n); +void Abort(const char *msg, ...); +void Quit(char *msg); +int SendFile(char *file, struct rx_connection *conn); void intSignal(int ignore) @@ -310,9 +313,8 @@ main(argc, argv) Quit("testclient: done!\n"); } -int SendFile(file, conn) - char *file; - struct rx_connection *conn; +int +SendFile(char *file, struct rx_connection *conn) { struct rx_call *call; int fd; @@ -402,9 +404,15 @@ int SendFile(file, conn) return(0); } -Abort(msg, a, b, c, d, e) +void +Abort(char *msg, ...) { - printf((char *)msg, a, b, c, d, e); + va_list args; + + va_start(args, msg); + printf((char *)msg, args); + va_end(args); + printf("\n"); if (debugFile) { rx_PrintStats(debugFile); @@ -414,10 +422,10 @@ Abort(msg, a, b, c, d, e) exit(1); } -Quit(char *msg, int a, int b, int c, int d, int e) +void +Quit(char *msg) { - printf((char *)msg, a, b, c, d, e); - printf("\n"); + printf("%s\n", msg); if (debugFile) { rx_PrintStats(debugFile); fflush(debugFile); @@ -432,8 +440,7 @@ Quit(char *msg, int a, int b, int c, int d, int e) */ #include void -OpenFD(n) - int n; +OpenFD(int n) { int i; struct stat sbuf; diff --git a/src/rx/test/testserver.c b/src/rx/test/testserver.c index dd812e0..1228919 100644 --- a/src/rx/test/testserver.c +++ b/src/rx/test/testserver.c @@ -11,7 +11,7 @@ #include #include - +#include #include #include @@ -28,10 +28,10 @@ #endif #include #include -#include "rx_clock.h" -#include "rx.h" -#include "rx_globals.h" -#include "rx_null.h" +#include +#include +#include +#include int error; /* Return this error number on a call */ int print = 0, eventlog = 0, rxlog = 0; @@ -40,8 +40,8 @@ FILE *debugFile; char *rcvFile; int logstdout = 0; -void Abort(char *msg, int a, int b, int c, int d, int e); -void Quit(char *msg, int a, int b, int c, int d, int e); +void Abort(char *msg, ...); +void Quit(char *msg); void OpenFD(int n); int FileRequest(struct rx_call *call); int SimpleRequest(struct rx_call *call); @@ -49,7 +49,7 @@ int SimpleRequest(struct rx_call *call); void intSignal(int ignore) { - Quit("Interrupted",0,0,0,0,0); + Quit("Interrupted"); } void @@ -57,7 +57,7 @@ quitSignal(int ignore) { static int quitCount = 0; if (++quitCount > 1) - Quit("rx_ctest: second quit signal, aborting",0,0,0,0,0); + Quit("rx_ctest: second quit signal, aborting"); rx_debugFile = debugFile = fopen("rx_stest.db", "w"); if (debugFile) rx_PrintStats(debugFile); @@ -150,7 +150,7 @@ main(argc, argv) argv++, argc--; } if (err || argc != 0) - Quit("usage: rx_stest [-silent] [-rxlog] [-eventlog]",0,0,0,0,0); + Quit("usage: rx_stest [-silent] [-rxlog] [-eventlog]"); if (rxlog || eventlog) { if (logstdout) @@ -158,7 +158,7 @@ main(argc, argv) else debugFile = fopen("rx_stest.db", "w"); if (debugFile == NULL) - Quit("Couldn't open rx_stest.db",0,0,0,0,0); + Quit("Couldn't open rx_stest.db"); if (rxlog) rx_debugFile = debugFile; if (eventlog) @@ -195,7 +195,7 @@ main(argc, argv) 1, /*Execute request */ rcvFile ? FileRequest : SimpleRequest); if (!service) - Abort("rx_NewService returned 0!\n",0,0,0,0,0); + Abort("rx_NewService returned 0!\n"); rx_SetMinProcs(service, 2); rx_SetMaxProcs(service, 100); @@ -227,7 +227,7 @@ int SimpleRequest(struct rx_call *call) t.tv_usec = computeTime.usec; #ifdef AFS_PTHREAD_ENV if (select(0, 0, 0, 0, &t) != 0) - Quit("Select didn't return 0",0,0,0,0,0); + Quit("Select didn't return 0"); #else IOMGR_Sleep(t.tv_sec); #endif @@ -291,7 +291,7 @@ FileRequest(struct rx_call *call) while (nbytes = rx_Read(call, buffer, blockSize)) { if (write(fd, buffer, nbytes) != nbytes) { perror("writev"); - Abort("Write Failed.\n",0,0,0,0,0); + Abort("Write Failed.\n"); break; } } @@ -306,22 +306,27 @@ FileRequest(struct rx_call *call) } void -Abort(char *msg, int a, int b, int c, int d, int e) +Abort(char *msg, ...) { - printf((char *)msg, a, b, c, d, e); + va_list args; + + va_start(args, msg); + printf((char *)msg, args); + va_end(args); + printf("\n"); if (debugFile) { rx_PrintStats(debugFile); fflush(debugFile); } - abort(); + afs_abort(); + exit(1); } void -Quit(char *msg, int a, int b, int c, int d, int e) +Quit(char *msg) { - printf((char *)msg, a, b, c, d, e); - printf("\n"); + printf("%s\n", msg); if (debugFile) { rx_PrintStats(debugFile); fflush(debugFile);