From 5cbc23886bfa33fdd77a9b95fc1dbedfeab06310 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Mon, 8 Oct 2018 16:25:54 +0200 Subject: Test the LockWait feature This commit adds a test that ensures that the timeout waiting an event expires correctly and that we correctly wait for the indicated time. Change-Id: I70c5aaf8d66588b4073cb772163d20344fdaf77c Signed-off-by: Romain Forlot --- test/afb-test/tests/mapi_tests.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/afb-test') diff --git a/test/afb-test/tests/mapi_tests.lua b/test/afb-test/tests/mapi_tests.lua index ced9ea0..e8cf142 100644 --- a/test/afb-test/tests/mapi_tests.lua +++ b/test/afb-test/tests/mapi_tests.lua @@ -31,3 +31,15 @@ _AFT.describe("Test_turning_on", function() _AFT.assertEvtGrpReceived({[evt1] = 1, [evt2] = 1}) end) + + +_AFT.describe("testLockWait",function() + local evt1 = "low-can/messages_engine_speed" + local timeout = 2000000 + _AFT.addEventToMonitor(evt1) + local start = os.time() * 1000000 + _AFT.assertEvtNotReceived(evt1, timeout) + local stop = os.time() * 1000000 + + _AFT.assertIsTrue( (stop - start) >= timeout, "Timeout not reached, LockWait feature is not working." ) + end, nil, nil) -- cgit 1.2.3-korg