tests: modernize tests to compile in warning-as-errorland
authorDerrick Brashear <shadow@dementix.org>
Tue, 17 Apr 2012 04:39:37 +0000 (00:39 -0400)
committerDerrick Brashear <shadow@your-file-system.com>
Thu, 6 Sep 2012 11:43:30 +0000 (04:43 -0700)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

Makefile.in
tests/auth/superuser-t.c
tests/opr/jhash-t.c
tests/rpctestlib/Makefile.in
tests/rpctestlib/rpc_test_cb_procs.c
tests/rpctestlib/rpc_test_main.c
tests/rpctestlib/rpc_test_procs.c
tests/rpctestlib/rpc_test_procs.h

index 5095faa..c61b54c 100644 (file)
@@ -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
 
index a3ddbcd..095abf1 100644 (file)
@@ -41,6 +41,7 @@
 #include <rx/rxkad.h>
 #include <rx/rx_identity.h>
 
+#include <hcrypto/des.h>
 #include <tests/tap/basic.h>
 
 #include "test.h"
index a802fe5..9dd7e1d 100644 (file)
@@ -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");
index 5f820bf..4a43559 100644 (file)
@@ -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 $@
index 5aa5797..aa2c7a2 100644 (file)
@@ -57,8 +57,6 @@
 #endif
 #ifdef AFS_DARWIN_ENV
 #include <sys/malloc.h>
-#else
-#include <malloc.h>
 #endif
 #include <afs/errors.h>
 #include <afs/sys_prototypes.h>
@@ -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,
index c36bb9d..a83460e 100644 (file)
@@ -56,8 +56,6 @@
 #endif
 #ifdef AFS_DARWIN_ENV
 #include <sys/malloc.h>
-#else
-#include <malloc.h>
 #endif
 #include <afs/errors.h>
 #include <afs/sys_prototypes.h>
index 24b1064..7b70a86 100644 (file)
 
 #include "rpc_test_procs.h"
 
-#include <stdio.h>
-#include <sys/types.h>
-#include <string.h>
-
-#ifdef AFS_NT40_ENV
-#else
-#include <sys/param.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#endif
-
-#include <string.h>
-#include <fcntl.h>
 #ifdef AFS_NT40_ENV
-#include <io.h>
 #include <windows.h>
 #include <WINNT/afsevent.h>
 #else
-#include <pwd.h>
+#include <sys/file.h>
 #include <afs/venus.h>
 #include <sys/time.h>
-#include <netdb.h>
 #endif
 #include <afs/afsint.h>
 #define FSINT_COMMON_XG 1
-#include <sys/stat.h>
-#include <errno.h>
-#include <signal.h>
 #include <afs/vice.h>
 #include <afs/cmd.h>
 #include <afs/auth.h>
 #include <afs/cellconfig.h>
 
 #include <afs/com_err.h>
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
 #ifdef HAVE_DIRECT_H
 #include <direct.h>
 #endif
-#ifdef AFS_DARWIN_ENV
-#include <sys/malloc.h>
-#else
-#include <malloc.h>
-#endif
 #include <afs/errors.h>
 #include <afs/sys_prototypes.h>
 #include <rx/rx_prototypes.h>
@@ -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 */
index ee7527b..7e2ffc0 100644 (file)
@@ -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. */