1 /** @file 2 3 A brief file description 4 5 @section license License 6 7 Licensed to the Apache Software Foundation (ASF) under one 8 or more contributor license agreements. See the NOTICE file 9 distributed with this work for additional information 10 regarding copyright ownership. The ASF licenses this file 11 to you under the Apache License, Version 2.0 (the 12 "License"); you may not use this file except in compliance 13 with the License. You may obtain a copy of the License at 14 15 http://www.apache.org/licenses/LICENSE-2.0 16 17 Unless required by applicable law or agreed to in writing, software 18 distributed under the License is distributed on an "AS IS" BASIS, 19 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 See the License for the specific language governing permissions and 21 limitations under the License. 22 */ 23 24 #pragma once 25 26 #include "I_EventSystem.h" 27 #include "tscore/Regression.h" 28 29 /* 30 Regression Test Composition State Machine 31 32 See RegressionSM.cc at the end for an example 33 */ 34 35 struct RegressionSM : public Continuation { 36 RegressionTest *t = nullptr; // for use with rprint 37 38 // methods to override 39 virtual void run(); // replace with leaf regression 40 virtual RegressionSM * cloneRegressionSM41 clone() 42 { 43 return new RegressionSM(*this); 44 } // replace for run_xxx(int n,...); 45 46 // public API 47 void done(int status = REGRESSION_TEST_NOT_RUN); 48 void run(int *pstatus); 49 void run_in(int *pstatus, ink_hrtime t); 50 51 // internal 52 int status = REGRESSION_TEST_INPROGRESS; 53 int *pstatus = nullptr; 54 RegressionSM *parent = nullptr; 55 int nwaiting = 0; 56 int nchildren = 0; 57 std::vector<RegressionSM *> children; 58 intptr_t n = 0; 59 intptr_t ichild = 0; 60 bool parallel = false; 61 bool repeat = false; 62 Action *pending_action = nullptr; 63 64 int regression_sm_start(int event, void *data); 65 int regression_sm_waiting(int event, void *data); 66 void set_status(int status); 67 void child_done(int status); 68 void xrun(RegressionSM *parent); 69 tRegressionSM70 RegressionSM(RegressionTest *at = nullptr) : t(at) { mutex = new_ProxyMutex(); } 71 72 RegressionSM(const RegressionSM &); 73 }; 74 75 RegressionSM *r_sequential(RegressionTest *t, int n, RegressionSM *sm); 76 RegressionSM *r_sequential(RegressionTest *t, RegressionSM *sm, ...); // terminate list in NULL 77 RegressionSM *r_parallel(RegressionTest *t, int n, RegressionSM *sm); 78 RegressionSM *r_parallel(RegressionTest *t, RegressionSM *sm, ...); // terminate list in NULL 79