From 833ceb23c94a88bed12c8cbe30017b01f5fd318d Mon Sep 17 00:00:00 2001 From: glenux Date: Wed, 25 Feb 2004 09:10:13 +0000 Subject: [PATCH] *** empty log message *** --- test/create_delete.c | 4 ++-- test/put_get.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 test/put_get.c diff --git a/test/create_delete.c b/test/create_delete.c index a50dc17..3fd2fe6 100644 --- a/test/create_delete.c +++ b/test/create_delete.c @@ -20,7 +20,7 @@ int main(void) { sprintf(testId,"test%d",(int)getuid()); printf("RequestedId: %s\n",testId); - + printf("Void size: %d\n",sizeof(void)); mSPAC=msgSpaceCreate(testId,0,3,poolInfos); pid_t pid=fork(); @@ -41,7 +41,7 @@ int main(void) { montext=msgAllocate(mSPAC,2,280,0); *montext=42; printf("### test Valeur0 %d ###\n",(int)*montext); - sleep(2); + //sleep(2); montext=msgAllocate(mSPAC,2,270,0); *montext=17; printf("### test Valeur1 %d ###\n",(int)*montext); diff --git a/test/put_get.c b/test/put_get.c new file mode 100644 index 0000000..dac0ab0 --- /dev/null +++ b/test/put_get.c @@ -0,0 +1,45 @@ +#include +#include "libnazgul.h" + +int main(void) { + // msgSpace mS=0; + + msgSpaceId testId; + msgSpace * mSPAC; + msgPool poolInfos[3]; + char * montext; + + poolInfos[0].bufferNb=4; + poolInfos[0].bufferSize=200; + + poolInfos[1].bufferNb=5; + poolInfos[1].bufferSize=250; + + sprintf(testId,"test%d",(int)getuid()); + printf("RequestedId: %s\n",testId); + printf("Void size: %d\n",sizeof(void)); + //creation de l'espace de messages + mSPAC=msgSpaceCreate(testId,1,2,poolInfos); + + pid_t pid=fork(); + + + + if (pid ==0){ + mSPAC=msgSpaceOpen(testId); + sleep(2); + printf("Get..."); fflush(stdout); + montext=msgGet(mSPAC,0,0); + printf("get-ok\n"); + } else { + mSPAC=msgSpaceOpen(testId); + montext=msgAllocate(mSPAC,2,280,0); + *montext=42; + printf("### test Valeur0 %d ###\n",(int)*montext); + printf("Put..."); fflush(stdout); + msgPut(mSPAC,0,montext); + printf("put-ok\n"); + //sleep(2); + } + return 0; +}