From 1a33ac27fa87b013ca6dc95be53b5b8a40a8f197 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: Ic9aeb32d09b45af0d75c8c51fa421b8f5a25f39c Signed-off-by: Romain Forlot --- test/afb-test/tests/mapi_tests.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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