• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

RegressionSM.h

Go to the documentation of this file.
00001 /** @file
00002 
00003   A brief file description
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 #ifndef _RegressionSM_h
00025 #define _RegressionSM_h
00026 
00027 #include "I_EventSystem.h"
00028 
00029 /*
00030   Regression Test Composition State Machine
00031 
00032   See RegressionSM.cc at the end for an example
00033 */
00034 
00035 struct RegressionSM :  public Continuation {
00036 
00037   RegressionTest *t; // for use with rprint
00038 
00039   // methods to override
00040   virtual void run(); // replace with leaf regression
00041   virtual RegressionSM *clone() { return new RegressionSM(*this); } // replace for run_xxx(int n,...);
00042 
00043   // public API
00044   void done(int status = REGRESSION_TEST_NOT_RUN);
00045   void run(int *pstatus);
00046   void run_in(int *pstatus, ink_hrtime t);
00047 
00048   // internal
00049   int status;
00050   int *pstatus;
00051   RegressionSM *parent;
00052   int nwaiting;
00053   int nchildren;
00054   DynArray<RegressionSM*> children;
00055   intptr_t n, ichild;
00056   bool par, rep;
00057   Action *pending_action;
00058 
00059   int regression_sm_start(int event, void *data);
00060   int regression_sm_waiting(int event, void *data);
00061   void set_status(int status);
00062   void child_done(int status);
00063   void xrun(RegressionSM *parent);
00064 
00065   RegressionSM(RegressionTest *at = NULL) :
00066     t(at), status(REGRESSION_TEST_INPROGRESS),
00067     pstatus(0), parent(0), nwaiting(0), nchildren(0), children(0), ichild(0), par(false), rep(false),
00068     pending_action(0)
00069   {
00070     mutex = new_ProxyMutex();
00071   }
00072 
00073   RegressionSM(const RegressionSM &);
00074 };
00075 
00076 RegressionSM *r_sequential(RegressionTest *t, int n, RegressionSM *sm);
00077 RegressionSM *r_sequential(RegressionTest *t, RegressionSM *sm, ...); // terminate list in NULL
00078 RegressionSM *r_parallel(RegressionTest *t, int n, RegressionSM *sm);
00079 RegressionSM *r_parallel(RegressionTest *t, RegressionSM *sm, ...); // terminate list in NULL
00080 
00081 #endif

Generated by  doxygen 1.7.1