From: Derrick Brashear Date: Tue, 17 Apr 2012 04:39:37 +0000 (-0400) Subject: tests: modernize tests to compile in warning-as-errorland X-Git-Tag: upstream/1.8.0_pre1^2~2042 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=97dfe2b73c753bafedf8961ff4219ee4efdb350c;p=packages%2Fo%2Fopenafs.git tests: modernize tests to compile in warning-as-errorland the tests haven't been loved as we've been killing warnings. clean up. Change-Id: I9c36114d3172c4a6347f5e890df6edb5caf796b4 Reviewed-on: http://gerrit.openafs.org/7232 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/Makefile.in b/Makefile.in index 5095faa5a..c61b54cd0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -671,6 +671,9 @@ finale_nolibafs: project cmd comerr afsd butc tbutc tbudb libuafs audit kauth lo tools platform kopenafs authtools $(DIR_roken) +${COMPILE_PART1} finale ${COMPILE_PART2} +rpctestlib: util fsint rx opr libafsrpc libafsauthent + +${TEST_PART1} rpctestlib ${COMPILE_PART2} + check test: finale cd tests && $(MAKE) check diff --git a/tests/auth/superuser-t.c b/tests/auth/superuser-t.c index a3ddbcdac..095abf194 100644 --- a/tests/auth/superuser-t.c +++ b/tests/auth/superuser-t.c @@ -41,6 +41,7 @@ #include #include +#include #include #include "test.h" diff --git a/tests/opr/jhash-t.c b/tests/opr/jhash-t.c index a802fe55c..9dd7e1dad 100644 --- a/tests/opr/jhash-t.c +++ b/tests/opr/jhash-t.c @@ -40,14 +40,14 @@ int main(int argc, char **argv) { plan(11); - uint32_t test[] = {3526055646, 2064483663, 3234460805, 3963629775}; + uint32_t test[] = {3526055646UL, 2064483663UL, 3234460805UL, 3963629775UL}; is_int(256, opr_jhash_size(8), "opr_jhash_size returns expected value"); is_int(255, opr_jhash_mask(8), "opr_jhash_mask returns expected value"); is_int(0xdeadbeef, opr_jhash(test, 0, 0), "empty array hashes as expected"); is_int(766530906, opr_jhash(test, 4, 0), "simple array works"); - is_int(3782684773, opr_jhash(test, 4, 1), "changing initval works"); + is_int(3782684773UL, opr_jhash(test, 4, 1), "changing initval works"); test[2]++; is_int(1977082159, opr_jhash(test, 4, 0), "modifying value works"); diff --git a/tests/rpctestlib/Makefile.in b/tests/rpctestlib/Makefile.in index 5f820bf90..4a435597d 100644 --- a/tests/rpctestlib/Makefile.in +++ b/tests/rpctestlib/Makefile.in @@ -11,9 +11,8 @@ srcdir=@srcdir@ include @TOP_OBJDIR@/src/config/Makefile.config include @TOP_OBJDIR@/src/config/Makefile.pthread - RTL=@TOP_OBJDIR@/tests/rpctestlib -RX=@TOP_OBJDIR@/src/rx +RX = ${srcdir}/../../src/rx VICED=@TOP_OBJDIR@/src/viced UTIL=@TOP_OBJDIR@/src/util FSINT=@TOP_OBJDIR@/src/fsint @@ -35,13 +34,14 @@ RXOBJS = rx_pthread.o LIBOBJS= ${RTLOBJS} ${FSINTOBJS} ${RXOBJS} -LIBS=${TOP_LIBDIR}/libafsauthent.a ${TOP_LIBDIR}/libafsrpc.a ${TOP_LIBDIR}/util.a +LIBS=${TOP_LIBDIR}/libafsauthent.a ${TOP_LIBDIR}/libafsrpc.a ${TOP_LIBDIR}/libopr.a ${TOP_LIBDIR}/util.a all: xmpl_driver CFLAGS_rx_pthread.o = -DDPF_FSLOG rx_pthread.o: ${RX}/rx_pthread.c + $(AFS_CCRULE) $(RX)/rx_pthread.c rpc_test_main.o: ${RTL}/rpc_test_main.c ${headers} rpc_test_procs.o: ${RTL}/rpc_test_procs.c ${headers} @@ -49,15 +49,21 @@ rpc_test_cb_procs.o: ${RTL}/rpc_test_cb_procs.c ${headers} CFLAGS_afsaux.o = -I{FSINT} afsaux.o: ${FSINT}/afsaux.c + $(AFS_CCRULE) ${FSINT}/afsaux.c afscbint.ss.o: ${FSINT}/afscbint.ss.c + $(AFS_CCRULE) ${FSINT}/afscbint.ss.c afsint.cs.o: ${FSINT}/afsint.cs.c + $(AFS_CCRULE) ${FSINT}/afsint.cs.c afsint.ss.o: ${FSINT}/afsint.ss.c + $(AFS_CCRULE) ${FSINT}/afsint.ss.c afsint.xdr.o: ${FSINT}/afsint.xdr.c + $(AFS_CCRULE) ${FSINT}/afsint.xdr.c afscbint.xdr.o: ${FSINT}/afscbint.xdr.c + $(AFS_CCRULE) ${FSINT}/afscbint.xdr.c xmpl_driver: librpc_test_lib.a rpc_test_main.o ${LIBS} $(AFS_LDRULE) rpc_test_main.o librpc_test_lib.a \ - ${LIBS} ${MT_LIBS} ${XLIBS} + ${LIBS} $(LIB_hcrypto) $(LIB_roken) ${MT_LIBS} ${XLIBS} librpc_test_lib.a: ${LIBOBJS} $(RM) -f $@ diff --git a/tests/rpctestlib/rpc_test_cb_procs.c b/tests/rpctestlib/rpc_test_cb_procs.c index 5aa579755..aa2c7a298 100644 --- a/tests/rpctestlib/rpc_test_cb_procs.c +++ b/tests/rpctestlib/rpc_test_cb_procs.c @@ -57,8 +57,6 @@ #endif #ifdef AFS_DARWIN_ENV #include -#else -#include #endif #include #include @@ -237,7 +235,6 @@ afs_int32 SRXAFSCB_TellMeAboutYourself(struct rx_call *a_call, struct interfaceAddr * addr, Capabilities *capabilities) { - afs_int32 code; rpc_test_request_ctx *ctx = CTX_FOR_RXCALL(a_call); printf("%s: SRXAFSCB_TellMeAboutYourself: enter (%s)\n", prog, diff --git a/tests/rpctestlib/rpc_test_main.c b/tests/rpctestlib/rpc_test_main.c index c36bb9d15..a83460e4a 100644 --- a/tests/rpctestlib/rpc_test_main.c +++ b/tests/rpctestlib/rpc_test_main.c @@ -56,8 +56,6 @@ #endif #ifdef AFS_DARWIN_ENV #include -#else -#include #endif #include #include diff --git a/tests/rpctestlib/rpc_test_procs.c b/tests/rpctestlib/rpc_test_procs.c index 24b1064b5..7b70a861c 100644 --- a/tests/rpctestlib/rpc_test_procs.c +++ b/tests/rpctestlib/rpc_test_procs.c @@ -37,55 +37,25 @@ #include "rpc_test_procs.h" -#include -#include -#include - -#ifdef AFS_NT40_ENV -#else -#include -#include -#include -#include -#include -#include -#include -#endif - -#include -#include #ifdef AFS_NT40_ENV -#include #include #include #else -#include +#include #include #include -#include #endif #include #define FSINT_COMMON_XG 1 -#include -#include -#include #include #include #include #include #include -#ifdef HAVE_DIRENT_H -#include -#endif #ifdef HAVE_DIRECT_H #include #endif -#ifdef AFS_DARWIN_ENV -#include -#else -#include -#endif #include #include #include @@ -112,7 +82,7 @@ typedef struct rpc_test_pkg_params { } rpc_test_pkg_params; static rpc_test_pkg_params rpc_test_params; -afs_int32 rpc_test_PkgInit() +afs_int32 rpc_test_PkgInit(void) { afs_int32 code = 0; static afs_uint32 rpc_test_initialized = 0; /* once */ @@ -120,7 +90,7 @@ afs_int32 rpc_test_PkgInit() if (!rpc_test_initialized) { rpc_test_initialized = 1; } else { - printf("%s: rpc_test_PkgInit: package already initialized\n"); + printf("%s: rpc_test_PkgInit: package already initialized\n", prog); exit(1); } @@ -156,7 +126,6 @@ init_callback_service_lwp(void *arg) { struct rx_securityClass *sc; struct rx_service *svc; - afs_int32 code = 0; rpc_test_request_ctx *ctx = (rpc_test_request_ctx *) arg; @@ -195,7 +164,7 @@ init_callback_service_lwp(void *arg) rx_StartServer(1); - printf("%s: init_callback_service_lwp: finished"); + printf("%s: init_callback_service_lwp: finished", prog); return (NULL); @@ -230,7 +199,6 @@ afs_int32 init_fs_channel(rpc_test_request_ctx **octx, char *cb_if, char *listen_addr_s, char *prefix, char *fs_addr_s, afs_uint32 flags) { - char cmd[512]; rpc_test_request_ctx *ctx; afs_int32 code = 0; #ifdef AFS_NT40_ENV @@ -251,10 +219,10 @@ afs_int32 init_fs_channel(rpc_test_request_ctx **octx, char *cb_if, /* afscbint (server) */ sprintf(ctx->cb_svc_name, "cb_%d", ctx->cno); - sprintf(ctx->cb_if_s, cb_if); - sprintf(ctx->cb_listen_addr_s, listen_addr_s); - sprintf(ctx->cb_prefix_s, prefix); - sprintf(ctx->fs_addr_s, fs_addr_s); + sprintf(ctx->cb_if_s, "%s", cb_if); + sprintf(ctx->cb_listen_addr_s, "%s", listen_addr_s); + sprintf(ctx->cb_prefix_s, "%s", prefix); + sprintf(ctx->fs_addr_s, "%s", fs_addr_s); #if defined(RPC_TEST_ADD_ADDRESSES) #if defined(AFS_LINUX26_ENV) @@ -297,7 +265,6 @@ afs_int32 init_fs_channel(rpc_test_request_ctx **octx, char *cb_if, /* unlock this */ pthread_mutex_unlock(&ctx->mtx); -out: return (code); } /* init_fs_channel */ @@ -320,7 +287,6 @@ afs_int32 rpc_test_afs_fetch_status(rpc_test_request_ctx *ctx, AFSFid *fid, AFSFetchStatus *outstatus) { - struct rx_call *tcall; struct AFSVolSync tsync; struct AFSCallBack tcb; afs_int32 code = 0; @@ -336,7 +302,6 @@ afs_int32 rpc_test_afs_store_status(rpc_test_request_ctx *ctx, AFSFid *fid, AFSStoreStatus *instatus, AFSFetchStatus *outstatus) { - struct rx_call *tcall; struct AFSVolSync tsync; afs_int32 code = 0; @@ -400,7 +365,6 @@ afs_int32 rpc_test_afs_downgrade_byterangelock(rpc_test_request_ctx *ctx, afs_int32 destroy_fs_channel(rpc_test_request_ctx *ctx) { - char cmd[512]; afs_int32 code = 0; #if defined(RPC_TEST_ADD_ADDRESSES) #if defined(AFS_LINUX26_ENV) @@ -416,8 +380,6 @@ destroy_fs_channel(rpc_test_request_ctx *ctx) } /* destroy_fs_channel */ void -rpc_test_PkgShutdown() +rpc_test_PkgShutdown(void) { - afs_int32 code = 0; - } /* rpc_test_PkgShutdown */ diff --git a/tests/rpctestlib/rpc_test_procs.h b/tests/rpctestlib/rpc_test_procs.h index ee7527b9c..7e2ffc03e 100644 --- a/tests/rpctestlib/rpc_test_procs.h +++ b/tests/rpctestlib/rpc_test_procs.h @@ -74,8 +74,8 @@ typedef struct rpc_test_request_ctx { #define CTX_FOR_RXCALL(call) \ (rx_GetServiceSpecific((rx_ServiceOf(rx_ConnectionOf(call))), ctx_key)) -afs_int32 rpc_test_PkgInit(); -void rpc_test_PkgShutdown(); +afs_int32 rpc_test_PkgInit(void); +void rpc_test_PkgShutdown(void); /* call channel, callback RPC server multiplexing */ afs_int32 init_fs_channel(rpc_test_request_ctx **ctx /* out */, char *cb_if, @@ -83,7 +83,7 @@ afs_int32 init_fs_channel(rpc_test_request_ctx **ctx /* out */, char *cb_if, afs_int32 destroy_fs_channel(rpc_test_request_ctx *ctx); /* test proc wrappers */ -afs_int32 rpc_test_fetch_status(); +afs_int32 rpc_test_fetch_status(void); afs_int32 rpc_test_afs_fetch_status(rpc_test_request_ctx *ctx, AFSFid *fid, AFSFetchStatus *outstatus); #if defined(AFS_BYTE_RANGE_FLOCKS) /* when will then be now? soon. */