tests: tbf: Fix dl_tbf polled for data without being in FLOW state

Prior code was wrong, as in it did stuff diferent to what is expected
and actually done in osmo-pcu. In osmo-pcu code, the function is guarded
and only called in FLOW or FINISHED state by the scheduler.

Change-Id: If8029bee90adceee128ebb20c033756efd50e90e
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index f8cb974..1dccfff 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -574,6 +574,12 @@
 
 	OSMO_ASSERT(ms_dl_tbf(ms) != NULL);
 
+	/* Here PCU would answer with data_cnf and trigger
+	 * bts_rcv_imm_ass_cnf(), which would set up the timer X2002. In this
+	 * test we go directly to T0 timeout to move it to FLOW state: */
+	ms_dl_tbf(ms)->handle_timeout();
+	OSMO_ASSERT(ms_dl_tbf(ms)->state_is(TBF_ST_FLOW));
+
 	/* Get first BSN */
 	struct msgb *msg;
 	int fn = 0;
diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err
index f2beb1f..84735aa 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -1570,31 +1570,34 @@
 TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) TX: START Immediate Assignment Downlink (PCH)
  - TRX=0 (0) TS=4 TA=0
 TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) appending 19 bytes
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) downlink (V(A)==0 .. V(S)==0) mcs_mode_restrict=EGPRS
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) Sending new block at BSN 0, CS=CS-1
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) Dequeue next LLC (len=19)
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) Complete DL frame, len=19
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) Dequeue next LLC (len=19)
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) data block (BSN 0, CS-1): 4d 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) need_padding 0 spb_status 0 spb 0 (BSN1 0 BSN2 -1)
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) Copying 1 RLC blocks, 1 BSNs
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) Copying data unit 0 (BSN 0)
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) msg block (BSN 0, CS-1): 07 00 00 4d 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) timer 0 expired. cur_fn=2654167
+TBF(DL-TFI_0){ASSIGN}: Received Event ASSIGN_READY_CCCH
+TBF(DL-TFI_0){ASSIGN}: state_chg to FLOW
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==0) mcs_mode_restrict=EGPRS
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) Sending new block at BSN 0, CS=CS-1
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) Dequeue next LLC (len=19)
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) Complete DL frame, len=19
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) Dequeue next LLC (len=19)
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) data block (BSN 0, CS-1): 4d 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) need_padding 0 spb_status 0 spb 0 (BSN1 0 BSN2 -1)
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) Copying 1 RLC blocks, 1 BSNs
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) Copying data unit 0 (BSN 0)
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) msg block (BSN 0, CS-1): 07 00 00 4d 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 
 MSG = 07 00 00 4d 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) downlink (V(A)==0 .. V(S)==1) mcs_mode_restrict=EGPRS
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) Sending new block at BSN 1, CS=CS-1
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) Complete DL frame, len=19
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) Dequeue next LLC (len=19)
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) data block (BSN 1, CS-1): 4d 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) need_padding 0 spb_status 0 spb 0 (BSN1 1 BSN2 -1)
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) Copying 1 RLC blocks, 1 BSNs
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) Copying data unit 0 (BSN 1)
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) msg block (BSN 1, CS-1): 07 00 02 4d 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==1) mcs_mode_restrict=EGPRS
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) Sending new block at BSN 1, CS=CS-1
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) Complete DL frame, len=19
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) Dequeue next LLC (len=19)
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) data block (BSN 1, CS-1): 4d 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) need_padding 0 spb_status 0 spb 0 (BSN1 1 BSN2 -1)
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) Copying 1 RLC blocks, 1 BSNs
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) Copying data unit 0 (BSN 1)
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) msg block (BSN 1, CS-1): 07 00 02 4d 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 
 MSG = 07 00 02 4d 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) downlink (V(A)==0 .. V(S)==2) mcs_mode_restrict=EGPRS
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) Sending new block at BSN 2, CS=CS-1
-TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) Complete DL frame, len=19
-TBF(DL-TFI_0){ASSIGN}: state_chg to FINISHED
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) downlink (V(A)==0 .. V(S)==2) mcs_mode_restrict=EGPRS
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) Sending new block at BSN 2, CS=CS-1
+TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FLOW) Complete DL frame, len=19
+TBF(DL-TFI_0){FLOW}: state_chg to FINISHED
 TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FINISHED) data block (BSN 2, CS-1): 4d 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 
 TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FINISHED) need_padding 0 spb_status 0 spb 0 (BSN1 2 BSN2 -1)
 TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=FINISHED) Copying 1 RLC blocks, 1 BSNs