qpcpp/examples/qutest/dpp/test_philo.tcl

84 lines
3.4 KiB
Tcl
Raw Normal View History

2018-07-16 16:32:57 -04:00
# test-script for QUTest unit testing harness
# see https://www.state-machine.com/qtools/qutest.html
2017-05-17 13:15:09 -04:00
# preamble...
proc on_reset {} {
expect_pause
2018-06-16 17:21:53 -04:00
glb_filter SM
loc_filter SM_AO AO_Philo<2>
2017-05-17 13:15:09 -04:00
continue
2018-06-16 17:21:53 -04:00
expect "===RTC===> St-Init Obj=AO_Philo<2>,State=QP::QHsm::top->thinking"
expect "===RTC===> St-Entry Obj=AO_Philo<2>,State=thinking"
expect "%timestamp Init===> Obj=AO_Philo<2>,State=thinking"
2018-05-25 12:24:18 -04:00
glb_filter SM AO UA
2018-06-16 17:21:53 -04:00
current_obj SM_AO AO_Philo<2>
2017-05-17 13:15:09 -04:00
}
# tests...
2018-03-19 14:51:26 -04:00
test "TIMEOUT->Philo (post)"
post TIMEOUT_SIG
2018-06-16 17:21:53 -04:00
expect "%timestamp AO-Post Sdr=QS_RX,Obj=AO_Philo<2>,Evt<Sig=TIMEOUT_SIG,*"
expect "%timestamp AO-GetL Obj=AO_Philo<2>,Evt<Sig=TIMEOUT_SIG,*"
expect "%timestamp Disp===> Obj=AO_Philo<2>,Sig=TIMEOUT_SIG,State=thinking"
expect "===RTC===> St-Exit Obj=AO_Philo<2>,State=thinking"
expect "===RTC===> St-Entry Obj=AO_Philo<2>,State=hungry"
expect "%timestamp ===>Tran Obj=AO_Philo<2>,Sig=TIMEOUT_SIG,State=thinking->hungry"
2017-05-17 13:15:09 -04:00
expect "%timestamp Trg-Done QS_RX_EVENT"
2018-03-19 14:51:26 -04:00
test "publish EAT(2)" -noreset
2018-06-16 17:21:53 -04:00
loc_filter SM_AO AO_Philo<2>
2018-03-19 14:51:26 -04:00
publish EAT_SIG [binary format c 2]
2018-06-16 17:21:53 -04:00
expect "%timestamp AO-Post Sdr=QS_RX,Obj=AO_Philo<2>,Evt<Sig=EAT_SIG,*"
2018-03-19 14:51:26 -04:00
expect "%timestamp Trg-Done QS_RX_EVENT"
2018-06-16 17:21:53 -04:00
expect "%timestamp AO-GetL Obj=AO_Philo<2>,Evt<Sig=EAT_SIG,*"
expect "%timestamp Disp===> Obj=AO_Philo<2>,Sig=EAT_SIG,State=hungry"
2018-05-25 12:24:18 -04:00
expect "%timestamp BSP_CALL BSP::random 123"
2018-06-16 17:21:53 -04:00
expect "===RTC===> St-Entry Obj=AO_Philo<2>,State=eating"
expect "%timestamp ===>Tran Obj=AO_Philo<2>,Sig=EAT_SIG,State=hungry->eating"
2018-03-19 14:51:26 -04:00
expect "%timestamp Trg-Done QS_RX_EVENT"
2018-05-22 15:32:27 -04:00
test "TIMEOUT->thinking (ASSERT)"
2017-05-17 13:15:09 -04:00
probe QActive::post_ 1
dispatch TIMEOUT_SIG
2018-06-16 17:21:53 -04:00
expect "%timestamp Disp===> Obj=AO_Philo<2>,Sig=TIMEOUT_SIG,State=thinking"
expect "===RTC===> St-Exit Obj=AO_Philo<2>,State=thinking"
2017-05-17 13:15:09 -04:00
expect "%timestamp TstProbe Fun=QActive::post_,Data=1"
2018-03-19 14:51:26 -04:00
expect "%timestamp =ASSERT= Mod=qf_actq,Loc=110"
2018-05-22 15:32:27 -04:00
test "TIMEOUT->eating (PUBLISH from AO)"
2018-03-19 14:51:26 -04:00
glb_filter OFF
dispatch TIMEOUT_SIG
expect "%timestamp Trg-Done QS_RX_EVENT"
dispatch EAT_SIG [binary format c 2]
expect "%timestamp Trg-Done QS_RX_EVENT"
glb_filter SM AO QF
dispatch TIMEOUT_SIG
expect "%timestamp QF-New Sig=TIMEOUT_SIG,*"
2018-06-16 17:21:53 -04:00
expect "%timestamp Disp===> Obj=AO_Philo<2>,Sig=TIMEOUT_SIG,State=eating"
2018-03-19 14:51:26 -04:00
expect "%timestamp QF-New Sig=DONE_SIG,*"
2018-06-16 17:21:53 -04:00
expect "%timestamp QF-Pub Sdr=AO_Philo<2>,Evt<Sig=DONE_SIG,Pool=1,Ref=0>"
2018-03-19 14:51:26 -04:00
expect "%timestamp QF-gcA Evt<Sig=DONE_SIG,Pool=1,Ref=2>"
2018-06-16 17:21:53 -04:00
expect "===RTC===> St-Exit Obj=AO_Philo<2>,State=eating"
expect "===RTC===> St-Entry Obj=AO_Philo<2>,State=thinking"
expect "%timestamp ===>Tran Obj=AO_Philo<2>,Sig=TIMEOUT_SIG,State=eating->thinking"
2018-03-19 14:51:26 -04:00
expect "%timestamp QF-gc Evt<Sig=TIMEOUT_SIG,Pool=1,Ref=1>"
expect "%timestamp Trg-Done QS_RX_EVENT"
2017-05-17 13:15:09 -04:00
test "timeEvt->Philo (tick)"
glb_filter SM AO TE
current_obj TE l_philo<2>.m_timeEvt
tick
2018-06-16 17:21:53 -04:00
expect " TE0-ADis Obj=l_philo<2>.m_timeEvt,AO=AO_Philo<2>"
expect "%timestamp TE0-Post Obj=l_philo<2>.m_timeEvt,Sig=TIMEOUT_SIG,AO=AO_Philo<2>"
expect "%timestamp AO-Post Sdr=QS_RX,Obj=AO_Philo<2>,Evt<Sig=TIMEOUT_SIG*"
expect "%timestamp AO-GetL Obj=AO_Philo<2>,Evt<Sig=TIMEOUT_SIG*"
expect "%timestamp Disp===> Obj=AO_Philo<2>,Sig=TIMEOUT_SIG,State=thinking"
expect "%timestamp TE0-DisA Obj=l_philo<2>.m_timeEvt,AO=AO_Philo<2>"
expect "===RTC===> St-Exit Obj=AO_Philo<2>,State=thinking"
expect "===RTC===> St-Entry Obj=AO_Philo<2>,State=hungry"
expect "%timestamp ===>Tran Obj=AO_Philo<2>,Sig=TIMEOUT_SIG,State=thinking->hungry"
2017-05-17 13:15:09 -04:00
expect "%timestamp Trg-Done QS_RX_TICK"
# the end
end