diff --git a/Makefile.in b/Makefile.in index ee34294ee9..3abbce8816 100644 --- a/Makefile.in +++ b/Makefile.in @@ -562,7 +562,7 @@ afsmonitor: cmd comerr gtx xstat echo Not building afsmonitor, because no curses-headers found. ; \ fi -tests: rxtests ubiktests rpctestlib viced +tests: rxtests ubiktests viced # pthread based user space RX library libafsrpc: comerr fsint hcrypto lwp rx rxkad rxstat sys util rxgk @@ -649,9 +649,6 @@ finale_nolibafs_notest: project cmd comerr afsd butc tbutc tbudb libuafs audit k authtools $(DIR_roken) rxgk +${COMPILE_PART1} finale ${COMPILE_PART2} -rpctestlib: util fsint rx opr libafsrpc libafsauthent - +${TEST_PART1} rpctestlib ${COMPILE_PART2} - finale: finale_notest test_build finale_nolibafs: finale_nolibafs_notest test_build_nolibafs @@ -936,7 +933,6 @@ distclean: clean src/volser/Makefile \ src/xstat/Makefile \ tests/Makefile \ - tests/rpctestlib/Makefile \ tests/tap/Makefile \ tests/auth/Makefile \ tests/cmd/Makefile \ diff --git a/NTMakefile b/NTMakefile index e3be8f99a3..52d84ab030 100644 --- a/NTMakefile +++ b/NTMakefile @@ -704,13 +704,6 @@ afsrdr: config $(NTMAKE) $(CD) ..\..\.. -rpctestlib: config fsint libafsrpc - @echo ***** $@ - $(DOCD) $(TESTS)\$@ - $(CD) $(TESTS)\$@ - $(NTMAKE) - $(CD) ..\.. - libafscp: libafscp_headers util afs volser vlserver rx auth fsint afsdobjs @echo ***** $@ $(DOCD) $(SRC)\$@ @@ -743,7 +736,7 @@ finale: netidmgr_plugin $(NTMAKE) $(CD) ..\.. -install: finale afsrdr tools rpctestlib extra +install: finale afsrdr tools extra @echo Build Finished Successfully diff --git a/configure.ac b/configure.ac index b7bbf504aa..139ed522c8 100644 --- a/configure.ac +++ b/configure.ac @@ -192,7 +192,6 @@ AC_CONFIG_FILES([ tests/cmd/Makefile tests/common/Makefile tests/opr/Makefile - tests/rpctestlib/Makefile tests/rx/Makefile tests/tap/Makefile tests/util/Makefile diff --git a/src/config/NTMakefile b/src/config/NTMakefile index 0ff166d16f..bcd36f13e6 100644 --- a/src/config/NTMakefile +++ b/src/config/NTMakefile @@ -127,9 +127,6 @@ idirs: doclink ! IF (!EXIST($(OJT)\tests)) $(MKDIR) $(OJT)\tests ! ENDIF -! IF (!EXIST($(OJT)\tests\rpctestlib)) - $(MKDIR) $(OJT)\tests\rpctestlib -! ENDIF ! IF (!EXIST($(OJT)\libadmin)) $(MKDIR) $(OJT)\libadmin ! ENDIF diff --git a/tests/rpctestlib/Makefile.in b/tests/rpctestlib/Makefile.in deleted file mode 100644 index df82732a15..0000000000 --- a/tests/rpctestlib/Makefile.in +++ /dev/null @@ -1,77 +0,0 @@ -# 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 -# -# Portions Copyright (c) 2003 Apple Computer, Inc. - -srcdir=@srcdir@ -include @TOP_OBJDIR@/src/config/Makefile.config -include @TOP_OBJDIR@/src/config/Makefile.pthread - -RTL=@TOP_OBJDIR@/tests/rpctestlib -RX = ${srcdir}/../../src/rx -VICED=@TOP_OBJDIR@/src/viced -FSINT=@TOP_OBJDIR@/src/fsint -OSI=@TOP_OBJDIR@/src/osi - -MODULE_CFLAGS=-DNINTERFACE -DRXDEBUG -DFSSYNC_BUILD_SERVER \ - -DSALVSYNC_BUILD_CLIENT -I${RX} ${OSI_XCFLAGS} \ - -DSUBSYS_LOG_MACRO=RTLLog - -headers= ${RTL}/rpc_test_procs.h - -RTLOBJS= rpc_test_procs.o rpc_test_cb_procs.o - -FSINTOBJS= afscbint.ss.o afsint.cs.o afscbint.xdr.o \ - afsint.xdr.o - -RXOBJS = rx_pthread.o - -LIBOBJS= ${RTLOBJS} ${FSINTOBJS} ${RXOBJS} - -LIBS=${TOP_LIBDIR}/libafsauthent.a ${TOP_LIBDIR}/libafsrpc.a ${TOP_LIBDIR}/libopr.a \ - $(top_builddir)/src/util/liboafs_util.la - -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} -rpc_test_cb_procs.o: ${RTL}/rpc_test_cb_procs.c ${headers} - -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} - $(LT_LDRULE_static) rpc_test_main.o librpc_test_lib.a \ - ${LIBS} ${LIB_hcrypto} ${MT_LIBS} - -librpc_test_lib.a: ${LIBOBJS} - $(RM) -f $@ - $(AR) crv $@ ${LIBOBJS} - $(RANLIB) $@ - -install: - -dest: - -clean: - $(LT_CLEAN) - $(RM) -f *.o *.a *.gch xmpl_driver core - -include @TOP_OBJDIR@/src/config/Makefile.version diff --git a/tests/rpctestlib/NTMakefile b/tests/rpctestlib/NTMakefile deleted file mode 100644 index 7f5dde0fd8..0000000000 --- a/tests/rpctestlib/NTMakefile +++ /dev/null @@ -1,83 +0,0 @@ -# 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 - -AFSDEV_AUXCDEFINES = -DAFS_PTHREAD_ENV -DRXDEBUG - -RELDIR=tests\rpctestlib -!INCLUDE $(AFSROOT)\src\config\NTMakefile.$(SYS_NAME) -!INCLUDE $(AFSROOT)\src\config\NTMakefile.version - -SRC_DIR = . - -############################################################################ -# Build rpc_test.lib and xmpl_driver.exe - -EXEFILE = $(OUT)\xmpl_driver.exe -LIBFILE = $(OUT)\rpc_test.lib - -RTL = $(AFSROOT)\tests\rpctestlib -RX = $(AFSROOT)\src\rx -VICED = $(AFSROOT)\src\viced -UTIL = $(AFSROOT)\src\util -FSINT = $(AFSROOT)\src\fsint - -HEADERS = $(RTL)\rpc_test_procs.h - -RXOBJS = $(OUT)\xdr_int64.obj \ - $(OUT)\xdr_int32.obj - -RTLOBJS= $(OUT)\rpc_test_procs.obj $(OUT)\rpc_test_cb_procs.obj - -FSINTOBJS = $(OUT)\afscbint.ss.obj $(OUT)\afsint.cs.obj \ - $(OUT)\afscbint.xdr.obj $(OUT)\afsint.xdr.obj - -LIBOBJS = $(RTLOBJS) $(FSINTOBJS) $(RXOBJS) - -EXEOBJS = $(OUT)\rpc_test_main.obj - -all: $(EXEFILE) - -$(RTLOBJS) $(OUT)\rpc_test_main.obj: $(RTL)\$$(@B).c $(HEADERS) - $(C2OBJ) -I$(RTL) $** - -$(RXOBJS): $(RX)\$$(@B).c - $(C2OBJ) -I$(RX) $** - -$(FSINTOBJS): $(FSINT)\$$(@B).C - $(C2OBJ) -I$(FSINT) $** - -$(LIBFILE): $(LIBOBJS) - $(LIBARCH) - -EXELIBS = \ - $(DESTDIR)\lib\afsauthent.lib \ - $(DESTDIR)\lib\afsrpc.lib \ - $(DESTDIR)\lib\afs\afscmd.lib \ - $(DESTDIR)\lib\afs\afsaudit.lib \ - $(DESTDIR)\lib\afs\afscom_err.lib \ - $(DESTDIR)\lib\afs\afsreg.lib \ - $(DESTDIR)\lib\afs\afsprocmgmt.lib \ - $(DESTDIR)\lib\afs\afseventlog.lib \ - $(DESTDIR)\lib\afs\mtafsutil.lib \ - $(DESTDIR)\lib\afs\mtafsvol.lib \ - $(DESTDIR)\lib\afs\mtafsvldb.lib \ - $(DESTDIR)\lib\afspthread.lib \ - $(DESTDIR)\lib\afsroken.lib - -$(EXEFILE): $(EXEOBJS) $(EXELIBS) $(LIBFILE) - $(EXECONLINK) - $(_VC_MANIFEST_EMBED_EXE) - $(EXEPREP) - $(CODESIGN_USERLAND) - $(SYMSTORE_IMPORT) - -install: $(EXEFILE) - -mkdir: - $(ECHO) "(mkdir: no target)" -clean:: - -$(DEL) $(EXEFILE) $(LIBFILE) $(LIBOBJS) $(EXEOBJS) diff --git a/tests/rpctestlib/rpc_test_cb_procs.c b/tests/rpctestlib/rpc_test_cb_procs.c deleted file mode 100644 index aa2c7a2980..0000000000 --- a/tests/rpctestlib/rpc_test_cb_procs.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (c) 2010, Linux Box Corporation. - * All Rights Reserved. - * - * Portions Copyright (c) 2007, Hartmut Reuter, - * RZG, Max-Planck-Institut f. Plasmaphysik. - * All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include - -#include - -#include - -#include "rpc_test_procs.h" - -#include -#include -#include -#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 -#endif -#include -#include -#include -#ifdef AFS_PTHREAD_ENV -#include -#endif - -extern const char *prog; -extern pthread_key_t ctx_key; - -#if defined(AFS_EXTENDED_CALLBACK) -#define RPC_TEST_EXTENDED_CALLBACK 1 - -afs_int32 SRXAFSCB_ExtendedCallBack( - /*IN */ struct rx_call *a_call, - /*IN */ HostIdentifier * Server, - /*IN */ AFSXCBInvocationSeq * Invocations_Array, - /*OUT*/ AFSExtendedCallBackRSeq * CallBack_Result_Array) -{ - rpc_test_request_ctx *ctx; - - ctx = CTX_FOR_RXCALL(a_call); - - printf("%s: SRXAFSCB_ExtendedCallBack: enter (%s)\n", prog, - ctx->cb_svc_name); - - return (0); -}; -#endif /* AFS_EXTENDED_CALLBACK */ - -#if defined(AFS_BYTE_RANGE_FLOCKS) -afs_int32 SRXAFSCB_AsyncIssueByteRangeLock( - /*IN */ struct rx_call *a_call, - /*IN */ HostIdentifier * Server, - /*IN */ AFSByteRangeLockSeq Locks_Array) -{ - rpc_test_request_ctx *ctx = CTX_FOR_RXCALL(a_call); - - printf("%s: SRXAFSCB_AsyncIssueByteRangeLock: enter (%s)\n", prog, - ctx->cb_svc_name); - - return (0); -} -#endif /* AFS_BYTE_RANGE_FLOCKS */ - -afs_int32 -SRXAFSCB_CallBack(struct rx_call *a_call, AFSCBFids *Fids_Array, - AFSCBs *CallBack_Array) -{ - rpc_test_request_ctx *ctx = CTX_FOR_RXCALL(a_call); - - printf("%s: SRXAFSCB_CallBack: enter (%s)\n", prog, - ctx->cb_svc_name); - - return (0); -} - - -afs_int32 -SRXAFSCB_InitCallBackState(struct rx_call *a_call) -{ - return (0); -} - - -afs_int32 -SRXAFSCB_Probe(struct rx_call *a_call) -{ - return (0); -} - - -afs_int32 -SRXAFSCB_GetCE(struct rx_call *a_call, - afs_int32 index, - AFSDBCacheEntry * ce) -{ - return(0); -} - - -afs_int32 -SRXAFSCB_GetLock(struct rx_call *a_call, - afs_int32 index, - AFSDBLock * lock) -{ - return(0); -} - - -afs_int32 -SRXAFSCB_XStatsVersion(struct rx_call *a_call, - afs_int32 * versionNumberP) -{ - return(0); -} - - -afs_int32 -SRXAFSCB_GetXStats(struct rx_call *a_call, - afs_int32 clientVersionNumber, - afs_int32 collectionNumber, - afs_int32 * srvVersionNumberP, - afs_int32 * timeP, - AFSCB_CollData * dataP) -{ - return(0); -} - -afs_int32 -SRXAFSCB_ProbeUuid(struct rx_call *a_call, afsUUID *a_uuid) -{ - rpc_test_request_ctx *ctx = CTX_FOR_RXCALL(a_call); - if ( !afs_uuid_equal(&ctx->cb_listen_addr.uuid, a_uuid) ) - return (1); - else - return (0); -} - - -afs_int32 -SRXAFSCB_WhoAreYou(struct rx_call *a_call, struct interfaceAddr *addr) -{ - return SRXAFSCB_TellMeAboutYourself(a_call, addr, NULL); -} - - -afs_int32 -SRXAFSCB_InitCallBackState2(struct rx_call *a_call, struct interfaceAddr * - addr) -{ - return RXGEN_OPCODE; -} - - -afs_int32 -SRXAFSCB_InitCallBackState3(struct rx_call *a_call, afsUUID *a_uuid) -{ - return (0); -} - - -afs_int32 -SRXAFSCB_GetCacheConfig(struct rx_call *a_call, afs_uint32 callerVersion, - afs_uint32 *serverVersion, afs_uint32 *configCount, - cacheConfig *config) -{ - return RXGEN_OPCODE; -} - -afs_int32 -SRXAFSCB_GetLocalCell(struct rx_call *a_call, char **a_name) -{ - return RXGEN_OPCODE; -} - - -afs_int32 -SRXAFSCB_GetCellServDB(struct rx_call *a_call, afs_int32 a_index, - char **a_name, serverList *a_hosts) -{ - return RXGEN_OPCODE; -} - - -afs_int32 -SRXAFSCB_GetServerPrefs(struct rx_call *a_call, afs_int32 a_index, - afs_int32 *a_srvr_addr, afs_int32 *a_srvr_rank) -{ - return RXGEN_OPCODE; -} - - -afs_int32 -SRXAFSCB_TellMeAboutYourself(struct rx_call *a_call, struct interfaceAddr * - addr, Capabilities *capabilities) -{ - rpc_test_request_ctx *ctx = CTX_FOR_RXCALL(a_call); - - printf("%s: SRXAFSCB_TellMeAboutYourself: enter (%s)\n", prog, - ctx->cb_svc_name); - - addr->numberOfInterfaces = ctx->cb_listen_addr.numberOfInterfaces; - addr->uuid = ctx->cb_listen_addr.uuid; - - if (capabilities) { - afs_uint32 *dataBuffP; - afs_int32 dataBytes; - - dataBytes = 1 * sizeof(afs_uint32); - dataBuffP = (afs_uint32 *) xdr_alloc(dataBytes); - dataBuffP[0] = CLIENT_CAPABILITY_ERRORTRANS; -#if defined(AFS_EXTENDED_CALLBACK) - if (ctx->flags & RPC_TEST_REQ_CTX_FLAG_XCB) - dataBuffP[0] |= CLIENT_CAPABILITY_EXT_CALLBACK; -#endif /* AFS_EXTENDED_CALLBACK */ - capabilities->Capabilities_len = dataBytes / sizeof(afs_uint32); - capabilities->Capabilities_val = dataBuffP; - } - - return (0); - -} /* SRXAFSCB_TellMeAboutYourself */ - - -afs_int32 -SRXAFSCB_GetCellByNum(struct rx_call *a_call, afs_int32 a_cellnum, - char **a_name, serverList *a_hosts) -{ - return RXGEN_OPCODE; -} - - -afs_int32 -SRXAFSCB_GetCE64(struct rx_call *a_call, afs_int32 a_index, - struct AFSDBCacheEntry64 *a_result) -{ - return RXGEN_OPCODE; -} diff --git a/tests/rpctestlib/rpc_test_main.c b/tests/rpctestlib/rpc_test_main.c deleted file mode 100644 index a83460e4a2..0000000000 --- a/tests/rpctestlib/rpc_test_main.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2010, Linux Box Corporation. - * All Rights Reserved. - * - * Portions Copyright (c) 2007, Hartmut Reuter, - * RZG, Max-Planck-Institut f. Plasmaphysik. - * All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include - -#include - -#include - -#include "rpc_test_procs.h" - -#include -#include -#include -#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 -#endif -#include -#include -#include -#ifdef AFS_PTHREAD_ENV -#include -#endif - -const char *prog = "lockharness"; - -#ifndef AFS_PTHREAD_ENV -#error compilation without pthreads is not supported -#endif - - -int -main(int argc, char **argv) -{ - int i, code; - rpc_test_request_ctx *c1, *c2; - AFSFetchStatus outstatus; - - printf("%s: start\n", prog); - - code = rpc_test_PkgInit(); - - /* replace with appropriate test addresses */ - code = init_fs_channel(&c1, "eth0", "10.1.1.213", "24", - "10.1.1.81", /* fs */ RPC_TEST_REQ_CTX_FLAG_NONE); - code = init_fs_channel(&c2, "eth0", "10.1.1.213", "24", - "10.1.1.81" /* fs */, RPC_TEST_REQ_CTX_FLAG_XCB); - - printf("%s: channels initialized\n", prog); - - i = 0; -repeat: - { - /* XXXX fid members should be...dynamic */ - AFSFid fid = { 536870915, 12, 4016}; - code = rpc_test_afs_fetch_status(c1, &fid, &outstatus); - printf("%s: c1 call returned %d\n", prog, code); - } - - { - /* XXXX fid members should be...dynamic */ - AFSFid fid = { 536870915, 12, 4016}; - code = rpc_test_afs_fetch_status(c2, &fid, &outstatus); - printf("%s: c2 call returned %d\n", prog, code); - } - - /* force bcb at c1 */ - { - AFSFid fid = { 536870915, 12, 4016}; - AFSStoreStatus instatus; - instatus.Mask = 0; - instatus.SegSize = 0; - instatus.Owner = outstatus.Owner; - instatus.Group = outstatus.Group; - instatus.UnixModeBits = outstatus.UnixModeBits; - instatus.ClientModTime = time(NULL); - code = rpc_test_afs_store_status(c2, &fid, &instatus, &outstatus); - printf("%s: c2 store status returned %d\n", prog, code); - } - - /* force bcb at c2 */ - { - AFSFid fid = { 536870915, 12, 4016}; - AFSStoreStatus instatus; - instatus.Mask = 0; - instatus.SegSize = 0; - instatus.Owner = outstatus.Owner; - instatus.Group = outstatus.Group; - instatus.UnixModeBits = outstatus.UnixModeBits; - instatus.ClientModTime = time(NULL); - code = rpc_test_afs_store_status(c1, &fid, &instatus, &outstatus); - printf("%s: c1 store status returned %d\n", prog, code); - } - i++; - if (i < 10) - goto repeat; - -#if defined(AFS_BYTE_RANGE_FLOCKS) - /* set a lock on c1 */ - { - AFSFid fid = { 536870915, 12, 4016}; - AFSByteRangeLock lock; - memset(&lock, 0, sizeof(AFSByteRangeLock)); - lock.Fid = fid; - lock.Type = LockWrite; - lock.Flags = 0; - lock.Owner = 1001; - lock.Uniq = 1; - lock.Offset = 50; - lock.Length = 100; - code = rpc_test_afs_set_byterangelock(c1, &lock); - printf("%s: c1 set lock returned %d\n", prog, code); - } - - /* try to set the same lock in c2 (should FAIL) */ - { - AFSFid fid = { 536870915, 12, 4016}; - AFSByteRangeLock lock; - memset(&lock, 0, sizeof(AFSByteRangeLock)); - lock.Fid = fid; - lock.Type = LockWrite; - lock.Flags = 0; - lock.Owner = 1002; - lock.Uniq = 2; - lock.Offset = 50; - lock.Length = 100; - code = rpc_test_afs_set_byterangelock(c2, &lock); - printf("%s: c2 set lock returned %d\n", prog, code); - } - - /* release lock on c1 */ - { - AFSFid fid = { 536870915, 12, 4016}; - AFSByteRangeLock lock; - memset(&lock, 0, sizeof(AFSByteRangeLock)); - lock.Fid = fid; - lock.Type = LockWrite; - lock.Flags = 0; - lock.Owner = 1001; - lock.Uniq = 1; - lock.Offset = 50; - lock.Length = 100; - code = rpc_test_afs_release_byterangelock(c1, &lock); - printf("%s: c1 set lock returned %d\n", prog, code); - } -#endif /* AFS_BYTE_RANGE_FLOCKS */ - - printf("%s: wait %d sec for processing\n", prog, 5); - sleep(5); - - code = destroy_fs_channel(c1); - code = destroy_fs_channel(c2); - - rpc_test_PkgShutdown(); - - printf("%s: finish\n", prog); - - exit (0); - -} /* main */ diff --git a/tests/rpctestlib/rpc_test_procs.c b/tests/rpctestlib/rpc_test_procs.c deleted file mode 100644 index 586324207a..0000000000 --- a/tests/rpctestlib/rpc_test_procs.c +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 2010, Linux Box Corporation. - * All Rights Reserved. - * - * Portions Copyright (c) 2007, Hartmut Reuter, - * RZG, Max-Planck-Institut f. Plasmaphysik. - * All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include - -#include - -#include - -#include "rpc_test_procs.h" - -#ifdef AFS_NT40_ENV -#include -#include -#else -#include -#include -#include -#endif -#include -#define FSINT_COMMON_XG 1 -#include -#include -#include -#include - -#include -#ifdef HAVE_DIRECT_H -#include -#endif -#include -#include -#include -#ifdef AFS_PTHREAD_ENV -#include -#endif - -extern const char *prog; -const int ctx_key = 1; - -#if 1 -#define RPC_TEST_GLOBAL_RX_INIT 1 -#else -#undef RPC_TEST_GLOBAL_RX_INIT -#endif - -const afs_uint32 fs_port = 7000; - -typedef struct rpc_test_pkg_params { - pthread_mutex_t mtx; - pthread_mutexattr_t mtx_attrs; - afs_uint32 cb_next_port; - afs_uint32 next_cno; -} rpc_test_pkg_params; -static rpc_test_pkg_params rpc_test_params; - -afs_int32 rpc_test_PkgInit(void) -{ - afs_int32 code = 0; - static afs_uint32 rpc_test_initialized = 0; /* once */ - - if (!rpc_test_initialized) { - rpc_test_initialized = 1; - } else { - printf("%s: rpc_test_PkgInit: package already initialized\n", prog); - exit(1); - } - -#ifndef AFS_NT40_ENV - code = pthread_mutexattr_init(&rpc_test_params.mtx_attrs); - if (code) { - printf("%s: rpc_test_PkgInit: pthread_mutexattr_init failed\n", prog); - exit(1); - } - code = pthread_mutex_init(&rpc_test_params.mtx, &rpc_test_params.mtx_attrs); - if (code) { - printf("%s: rpc_test_PkgInit: pthread_mutex_init failed\n", prog); - exit(1); - } -#endif - - /* start connection sequence */ - rpc_test_params.next_cno = 1; - - /* set the starting port in sequence */ - rpc_test_params.cb_next_port = 7105; - -#if defined(RPC_TEST_GLOBAL_RX_INIT) - rx_Init(0); -#endif - - return (code); - -} /* rpc_test_PkgInit */ - -static void * -init_callback_service_lwp(void *arg) -{ - struct rx_securityClass *sc; - struct rx_service *svc; - - rpc_test_request_ctx *ctx = (rpc_test_request_ctx *) arg; - - printf("%s: init_callback_service_lwp: listen_addr: %s " - "(%d) cb_port: %d\n", - prog, ctx->cb_listen_addr_s, ctx->cb_listen_addr.addr_in[0], - ctx->cb_port); - - sc = (struct rx_securityClass *) rxnull_NewServerSecurityObject(); - if (!sc) { - fprintf(stderr,"rxnull_NewServerSecurityObject failed for callback " - "service\n"); - exit(1); - } - -#if defined(RPC_TEST_GLOBAL_RX_INIT) - svc = rx_NewServiceHost(htonl(INADDR_ANY), htons(ctx->cb_port), 1, - ctx->cb_svc_name, &sc, 1, RXAFSCB_ExecuteRequest); -#else - svc = rx_NewService(0, 1, ctx->cb_svc_name, &sc, 1, RXAFSCB_ExecuteRequest); -#endif - /* stash context */ - rx_SetServiceSpecific(svc, ctx_key, ctx); - - if (!svc) { - fprintf(stderr,"rx_NewServiceHost failed for callback service\n"); - exit(1); - } - - /* XXX stash service so we can hijack its rx_socket when inititiating - * RPC calls */ - ctx->svc = svc; - - /* release pkg mutex before entering rx processing loop */ - pthread_mutex_unlock(&rpc_test_params.mtx); - - rx_StartServer(1); - - printf("%s: init_callback_service_lwp: finished", prog); - - return (NULL); - -} /* callback_service_lwp */ - -afs_int32 init_callback_service(rpc_test_request_ctx *ctx) -{ - pthread_t tid; - pthread_attr_t tattr; - afs_int32 code = 0; - - afs_uuid_create(&(ctx->cb_listen_addr.uuid)); - -#if !defined(RPC_TEST_GLOBAL_RX_INIT) - code = rx_Init((int) htons(ctx->cb_port)); -#endif /* RPC_TEST_GLOBAL_RX_INIT */ - - assert(pthread_attr_init(&tattr) == 0); - assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0); - assert(pthread_create(&tid, &tattr, init_callback_service_lwp, ctx) == 0); - - return (code); - -} /* init_callback_service */ - -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) -{ - rpc_test_request_ctx *ctx; - afs_int32 code = 0; -#ifdef AFS_NT40_ENV - afs_int32 sslen = sizeof(struct sockaddr); -#endif - - ctx = *octx = (rpc_test_request_ctx *) malloc(sizeof(rpc_test_request_ctx)); - memset(ctx, 0, sizeof(rpc_test_request_ctx)); - - /* initialize a local mutex */ - code = pthread_mutex_init(&ctx->mtx, &rpc_test_params.mtx_attrs); - - /* lock package before rx setup--which has global deps, atm */ - pthread_mutex_lock(&rpc_test_params.mtx); - - ctx->cno = rpc_test_params.next_cno++; - ctx->flags = flags; - - /* afscbint (server) */ - sprintf(ctx->cb_svc_name, "cb_%d", ctx->cno); - 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) - sprintf(cmd, "ip addr add %s/%s dev %s label %s", listen_addr_s, prefix, - cb_if, cb_if); - code = system(cmd); -#endif -#endif /* RPC_TEST_ADD_ADDRESSES */ - - /* lock this */ - pthread_mutex_lock(&ctx->mtx); - - /* set up rx */ - ctx->cb_port = rpc_test_params.cb_next_port++; - ctx->cb_listen_addr.numberOfInterfaces = 1; - -#ifdef AFS_NT40_ENV - code = WSAStringToAddressA(listen_addr_s, AF_INET, NULL, - (struct sockaddr*) &(ctx->cb_listen_addr), &sslen); -#else - code = inet_pton(AF_INET, listen_addr_s, - (void*) &(ctx->cb_listen_addr.addr_in[0])); -#endif - - code = init_callback_service(ctx /* LOCKED, && rpc_test_params->mtx LOCKED */); - - /* fsint (client) */ - -#ifdef AFS_NT40_ENV - code = WSAStringToAddressA(fs_addr_s, AF_INET, NULL, - (struct sockaddr*) &(ctx->fs_addr.addr_in[0]), &sslen); -#else - code = inet_pton(AF_INET, fs_addr_s, (void*) &(ctx->fs_addr.addr_in[0])); -#endif - ctx->sc = rxnull_NewClientSecurityObject(); - ctx->sc_index = RX_SECIDX_NULL; - ctx->conn = rx_NewConnection(ctx->fs_addr.addr_in[0], (int) htons(fs_port), - 1, ctx->sc, ctx->sc_index); - - /* unlock this */ - pthread_mutex_unlock(&ctx->mtx); - - return (code); - -} /* init_fs_channel */ - -/* XXX use the pkg lock to protect the state of rx_socket for - * the duration of the call, switching it out for the stashed - * rx_socket created by rx_NewService for this channel */ -#define RXCALL_WITH_SOCK(code, ctx, call) \ - do { \ - osi_socket prev_rx_socket; \ - pthread_mutex_lock(&rpc_test_params.mtx); \ - prev_rx_socket = rx_socket; \ - rx_socket = ctx->svc->socket; \ - code = call; \ - rx_socket = prev_rx_socket; \ - pthread_mutex_unlock(&rpc_test_params.mtx); \ -} while(0); - -afs_int32 -rpc_test_afs_fetch_status(rpc_test_request_ctx *ctx, AFSFid *fid, - AFSFetchStatus *outstatus) -{ - struct AFSVolSync tsync; - struct AFSCallBack tcb; - afs_int32 code = 0; - - RXCALL_WITH_SOCK(code, ctx, - (RXAFS_FetchStatus(ctx->conn, fid, outstatus, &tcb, &tsync))); - - return (code); - -} /* rpc_test_afs_fetch_status */ - -afs_int32 -rpc_test_afs_store_status(rpc_test_request_ctx *ctx, AFSFid *fid, - AFSStoreStatus *instatus, AFSFetchStatus *outstatus) -{ - struct AFSVolSync tsync; - afs_int32 code = 0; - - RXCALL_WITH_SOCK(code, ctx, - (RXAFS_StoreStatus(ctx->conn, fid, instatus, outstatus, &tsync))); - - return (code); - -} /* rpc_test_afs_fetch_status */ - -#if defined(AFS_BYTE_RANGE_FLOCKS) -afs_int32 rpc_test_afs_set_byterangelock(rpc_test_request_ctx *ctx, - AFSByteRangeLock * lock) -{ - struct rx_call *tcall; - afs_int32 code = 0; - - RXCALL_WITH_SOCK(code, ctx, - (RXAFS_SetByteRangeLock(ctx->conn, lock))); - - return (code); - -} /* rpc_test_afs_set_byterangelock */ - -afs_int32 rpc_test_afs_release_byterangelock(rpc_test_request_ctx *ctx, - AFSByteRangeLock * lock) -{ - struct rx_call *tcall; - afs_int32 code = 0; - - RXCALL_WITH_SOCK(code, ctx, - (RXAFS_ReleaseByteRangeLock(ctx->conn, lock))); - - return (code); - -} /* rpc_test_afs_release_byterangelock */ - -afs_int32 rpc_test_afs_upgrade_byterangelock(rpc_test_request_ctx *ctx, - AFSByteRangeLock * lock) -{ - afs_int32 code = 0; - - /* TODO: implement */ - - return (code); - -} /* rpc_test_afs_upgrade_byterangelock */ - -afs_int32 rpc_test_afs_downgrade_byterangelock(rpc_test_request_ctx *ctx, - AFSByteRangeLock * Lock) -{ - afs_int32 code = 0; - - /* TODO: implement */ - - return (code); - -} /* rpc_test_afs_downgrade_byterangelock */ -#endif /* AFS_BYTE_RANGE_FLOCKS */ - -afs_int32 -destroy_fs_channel(rpc_test_request_ctx *ctx) -{ - afs_int32 code = 0; -#if defined(RPC_TEST_ADD_ADDRESSES) -#if defined(AFS_LINUX26_ENV) - sprintf(cmd, "ip addr del %s/%s dev %s label %s", ctx->cb_listen_addr_s, - ctx->cb_prefix_s, ctx->cb_if_s, ctx->cb_if_s); - code = system(cmd); -#endif -#endif /* RPC_TEST_ADD_ADDRESSES */ - assert(ctx); - free(ctx); - return (code); - -} /* destroy_fs_channel */ - -void -rpc_test_PkgShutdown(void) -{ -} /* rpc_test_PkgShutdown */ diff --git a/tests/rpctestlib/rpc_test_procs.h b/tests/rpctestlib/rpc_test_procs.h deleted file mode 100644 index 7e2ffc03ea..0000000000 --- a/tests/rpctestlib/rpc_test_procs.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2010, Linux Box Corporation. - * All Rights Reserved. - * - * Portions Copyright (c) 2007, Hartmut Reuter, - * RZG, Max-Planck-Institut f. Plasmaphysik. - * All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _RPC_TEST_PROCS_H -#define _RPC_TEST_PROCS_H - -#include -#include -#include - -#include -#include -#include -#include -#include -#define FSINT_COMMON_XG 1 -#include -#include - -#define RPC_TEST_REQ_CTX_FLAG_NONE 0x0000 -#define RPC_TEST_REQ_CTX_FLAG_XCB 0x0001 - -typedef struct rpc_test_request_ctx { - afs_uint32 flags; - /* sync */ - pthread_mutex_t mtx; - /* local address */ - char cb_svc_name[256]; - char cb_if_s[256]; - char cb_listen_addr_s[256]; - char cb_prefix_s[256]; - char fs_addr_s[256]; - interfaceAddr cb_listen_addr; - interfaceAddr fs_addr; - /* rx connection */ - afs_uint32 cno; - afs_uint32 cb_port; - struct rx_connection *conn; - struct rx_securityClass *sc; - struct rx_service *svc; /* until rx fixes client socket mgmt */ - afs_int32 sc_index; - /* stats */ - afs_uint32 calls; -} rpc_test_request_ctx; - - -#define CTX_FOR_RXCALL(call) \ - (rx_GetServiceSpecific((rx_ServiceOf(rx_ConnectionOf(call))), ctx_key)) - -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, - char *listen_addr_s, char *prefix, char *fs_addr_s, afs_uint32 flags); -afs_int32 destroy_fs_channel(rpc_test_request_ctx *ctx); - -/* test proc wrappers */ -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. */ -afs_int32 rpc_test_afs_set_byterangelock(rpc_test_request_ctx *ctx, - AFSByteRangeLock * Lock); -afs_int32 rpc_test_afs_release_byterangelock(rpc_test_request_ctx *ctx, - AFSByteRangeLock * Lock); -afs_int32 rpc_test_afs_upgrade_byterangelock(rpc_test_request_ctx *ctx, - AFSByteRangeLock * Lock); -afs_int32 rpc_test_afs_downgrade_byterangelock(rpc_test_request_ctx *ctx, - AFSByteRangeLock * Lock); -#endif /* AFS_BYTE_RANGE_FLOCKS */ - -afs_int32 rpc_test_afs_store_status(rpc_test_request_ctx *ctx, AFSFid *fid, - AFSStoreStatus *instatus, AFSFetchStatus *outstatus); -afs_int32 rpc_test_afs_storedata_range(rpc_test_request_ctx *ctx, AFSFid *fid, - void *stuff); - -#endif /* _RPC_TEST_PROCS_H */