Threaded example modified to avoid false alarms.
authorZdeněk Šustr <sustr4@cesnet.cz>
Mon, 20 Dec 2010 13:27:03 +0000 (13:27 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Mon, 20 Dec 2010 13:27:03 +0000 (13:27 +0000)
TestPlan documentation updated.

org.glite.lb.client/examples/job_status_threaded.c
org.glite.lb.doc/src/LBTP-Tests.tex

index 8b83bf9..66aec08 100644 (file)
@@ -23,6 +23,7 @@ limitations under the License.
 #include <errno.h>
 #include <time.h>
 #include <pthread.h>
+#include <unistd.h>
 
 #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);
index 6b4c711..24d0dc2 100644 (file)
@@ -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}