From a0482d7124a347a59b9dca51b7da2c98d16d0328 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Mon, 20 Dec 2010 13:27:03 +0000 Subject: [PATCH] Threaded example modified to avoid false alarms. TestPlan documentation updated. --- org.glite.lb.client/examples/job_status_threaded.c | 15 +++++++++++---- org.glite.lb.doc/src/LBTP-Tests.tex | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/org.glite.lb.client/examples/job_status_threaded.c b/org.glite.lb.client/examples/job_status_threaded.c index 8b83bf9..66aec08 100644 --- a/org.glite.lb.client/examples/job_status_threaded.c +++ b/org.glite.lb.client/examples/job_status_threaded.c @@ -23,6 +23,7 @@ limitations under the License. #include #include #include +#include #include "glite/lb/context-int.h" #ifdef BUILDING_LB_CLIENT @@ -40,7 +41,7 @@ static char *myname; void *thread_meat(char *jobid) { edg_wll_Context ctx; - int result=0; + int result=0, retries; if ( edg_wll_InitContext(&ctx) ) { fprintf(stderr,"cannot initialize edg_wll_Context\n"); @@ -63,9 +64,15 @@ void *thread_meat(char *jobid) { } else free(bserver); - if (edg_wll_JobStatus(ctx, job, EDG_WLL_STAT_CLASSADS | EDG_WLL_STAT_CHILDREN | EDG_WLL_STAT_CHILDSTAT, &status)) { - dgerr(ctx,"edg_wll_JobStatus"); result = 1; - } else printstat_oneline(status,0); + for (retries = 6; retries > 0; retries--) { + if (edg_wll_JobStatus(ctx, job, EDG_WLL_STAT_CLASSADS | EDG_WLL_STAT_CHILDREN | EDG_WLL_STAT_CHILDSTAT, &status)) { + dgerr(ctx,"edg_wll_JobStatus"); result = 1; + } else { + printstat_oneline(status,0); + break; + } + sleep(3); + } if (job) edg_wlc_JobIdFree(job); // if (status.state) edg_wll_FreeStatus(&status); diff --git a/org.glite.lb.doc/src/LBTP-Tests.tex b/org.glite.lb.doc/src/LBTP-Tests.tex index 6b4c711..24d0dc2 100644 --- a/org.glite.lb.doc/src/LBTP-Tests.tex +++ b/org.glite.lb.doc/src/LBTP-Tests.tex @@ -67,6 +67,8 @@ Besides pure System Functionality Tests, this list also includes In-the-Wild tes \hline {\tt lb-test-statistics.sh} & Implemented & Test statistic functions provided by \LB \\ \hline +{\tt lb-test-threaded.sh} & Implemented & Rudimentary test for threaded clients \LB \\ +\hline \end{tabularx} \subsubsection{Event logging examples} @@ -481,6 +483,22 @@ including the checks. \result\ Meaningful values should be returned by both tests. +\subsubsection{Multi-Threaded Operation} + +\req\ \LB\ server running + +\what\ +\begin{enumerate} +\item Register a series of jobs. +\item Run a client using multiple threads to query the server simultaneously. +\item Check if all threads finished OK. +\end{enumerate} + +\how\ \ctblb{lb-test-threaded.sh} + +\note\ The is not a thorough test. It is not capable of discovering rare or improbable problems but it will check the essentials of multi-threaded opration. + +\result\ The test must not hang. Meaningful results (albeit errors) must be returned by all threads. \section{LB ``In the Wild''---Real-World WMS Test} -- 1.8.2.3