summaryrefslogtreecommitdiffstats
path: root/test/afb-test/tests/low-can_BasicAPITest.lua
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-07-27 20:02:56 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-07-28 02:31:40 +0200
commit88281216540f5f61bcee7076259a25573c1cb50e (patch)
treee5ee4ee963de23972aca9e45b4bad7e905721bfe /test/afb-test/tests/low-can_BasicAPITest.lua
parentab1adbd3a5d69dced58ef2a37d5defea600452e9 (diff)
Several tests improvements and fixes
- New tests about authenticate and write on CAN bus. - Fixes diagnostic messages handling, all diagnostic messages are received through the same handle then in its data there is the detailled message name. - Set after and before method the same between the both file then they could be played separately. About now setting multiple times those methods will override them and the latest set wins - Disable the Step3 for now because of segfault - Fix unsubscribe argument to match the previous subscription else it doesn't match and verb call fails - Fix: typo,wrong variable Change-Id: I2f4c2873e57611c946a99d4313021bb7bfea679c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'test/afb-test/tests/low-can_BasicAPITest.lua')
-rw-r--r--test/afb-test/tests/low-can_BasicAPITest.lua31
1 files changed, 21 insertions, 10 deletions
diff --git a/test/afb-test/tests/low-can_BasicAPITest.lua b/test/afb-test/tests/low-can_BasicAPITest.lua
index 5dddb55e..bda5bf0e 100644
--- a/test/afb-test/tests/low-can_BasicAPITest.lua
+++ b/test/afb-test/tests/low-can_BasicAPITest.lua
@@ -33,35 +33,46 @@ _AFT.setAfterEach(function()
os.execute("pkill linuxcan-canpla")
end)
+_AFT.setAfterAll( function()
+ os.execute("pkill canplayer")
+ os.execute("pkill linuxcan-canpla")
+ return 0
+end)
+
+_AFT.testVerbStatusError("low-can_write_wo_auth", "low-can", "write", { signal_name = "engine.speed", signal_value = 1234})
+_AFT.testVerbStatusSuccess("low-can_auth", "low-can", "auth", {})
+_AFT.testVerbStatusError("low-can_write_unwritable_signal", "low-can", "write", { signal_name = "engine.speed", signal_value = 1234})
+_AFT.testVerbStatusSuccess("low-can_write", "low-can", "write", { signal_name = "hvac.temperature.left", signal_value = 21})
+_AFT.testVerbStatusSuccess("low-can_write_raw", "low-can", "write", { bus_name= "hs", frame= { can_id= 1568, can_dlc=8, can_data= {255,255,255,255,255,255,255,255}}})
+
_AFT.testVerbStatusSuccess("low-can_list", "low-can", "list", {})
_AFT.testVerbStatusSuccess("low-can_get", "low-can", "get", { event = "engine.speed"})
_AFT.describe("Diagnostic_engine_speed_simulation", function()
-
+
local api = "low-can"
local evt = "diagnostic_messages.engine.speed"
_AFT.assertVerbStatusSuccess(api,"subscribe", { event = evt })
- _AFT.addEventToMonitor(api .. "/" .. evt ,function(eventName, data)
- _AFT.assertIsTrue(data.name == "diagnostic_messages.engine.speed")
+ _AFT.addEventToMonitor(api .."/diagnostic_messages", function(eventName, data)
+ _AFT.assertIsTrue(data.name == "diagnostic_messages.engine.speed")
end)
local ret = os.execute("./var/replay_launcher.sh ./var/test1.canreplay")
_AFT.assertIsTrue(ret)
- _AFT.assertEvtReceived(api .. "/" .. evt, 1000000)
+ _AFT.assertEvtReceived(api .."/diagnostic_messages", 1000000)
- _AFT.assertVerbStatusSuccess("low-can","unsubscribe", { event = "diagnostic_messages.engine.speed" })
+ _AFT.assertVerbStatusSuccess("low-can","unsubscribe", { event = evt })
end)
_AFT.describe("Subscribe_all", function()
local api = "low-can"
- local evt = "messages.vehicle.average.speed"
+ local evt = "messages.vehicle.average.speed"
-
- _AFT.addEventToMonitor(api .. "/" .. evt, function(eventName, data)
- _AFT.assertEquals(data.name,"messages.vehicle.average.speed")
+ _AFT.addEventToMonitor(api .."/".. evt, function(eventName, data)
+ _AFT.assertEquals(eventName, api .."/".. evt)
end)
_AFT.assertVerbStatusSuccess(api,"subscribe", { event = "*" })
@@ -69,7 +80,7 @@ _AFT.describe("Subscribe_all", function()
local ret = os.execute("./var/replay_launcher.sh ./var/test2-3.canreplay")
_AFT.assertIsTrue(ret)
- _AFT.assertEvtReceived(api .. "/" .. evt, 5000000);
+ _AFT.assertEvtReceived(api .."/".. evt, 5000000);
_AFT.assertVerbStatusSuccess(api,"unsubscribe", { event = "*" })