Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to verify 3163 issue #2502

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions test_scripts/Defects/7_1/3163_SDL_restart_with_gear_change.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---------------------------------------------------------------------------------------------------
-- Issue: https://github.com/SmartDeviceLink/sdl_core/issues/3163
---------------------------------------------------------------------------------------------------
-- Steps:
-- 1. SDL and HMI started
-- 2. Wait 5 seconds
-- 3. Simulate gear change to R
-- 4. Wait 5 seconds
-- 5. Simulate gear change to D
-- 6. After 10 seconds, simulate gear change to P.
-- 7. Wait 5 seconds
-- 8. Perform ignition off
-- 9. Repeat 1-8 steps
-- SDL does:
-- - work without crashes
---------------------------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require('user_modules/sequences/actions')
local events = require('events')
local utils = require("user_modules/utils")

--[[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false

-- [[ Local Functions ]]
local function ignitionOff()
local timeout = 5000
local event = events.Event()
event.matches = function(event1, event2) return event1 == event2 end
EXPECT_EVENT(event, "SDL shutdown")
:Do(function()
StopSDL()
end)
common.getHMIConnection():SendNotification("BasicCommunication.OnExitAllApplications", { reason = "SUSPEND" })
common.getHMIConnection():ExpectNotification("BasicCommunication.OnSDLPersistenceComplete")
:Do(function()
common.getHMIConnection():SendNotification("BasicCommunication.OnExitAllApplications",{ reason = "IGNITION_OFF" })
end)
common.getHMIConnection():ExpectNotification("BasicCommunication.OnAppUnregistered", { unexpectedDisconnect = false })
:Times(0)

local isSDLShutDownSuccessfully = false
common.getHMIConnection():ExpectNotification("BasicCommunication.OnSDLClose")
:Do(function()
utils.cprint(35, "SDL was shutdown successfully")
isSDLShutDownSuccessfully = true
RAISE_EVENT(event, event)
end)
:Timeout(timeout)
local function forceStopSDL()
if isSDLShutDownSuccessfully == false then
utils.cprint(35, "SDL was shutdown forcibly")
RAISE_EVENT(event, event)
end
end
RUN_AFTER(forceStopSDL, timeout + 500)
end

local function gearChanging(pValue)
common.getHMIConnection():SendNotification("VehicleInfo.OnVehicleData", { prndl = pValue })
end

--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)

runner.Title("Test")
for i = 1,10 do
runner.Title("SDL restart iteration " .. i)
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("Wait 5 seconds", common.run.wait, { 5000 })
runner.Step("Change gear to `REVERSE`", gearChanging, { "REVERSE" })
runner.Step("Wait 5 seconds", common.run.wait, { 5000 })
runner.Step("Change gear to `DRIVE`", gearChanging, { "DRIVE" })
runner.Step("Wait 10 seconds", common.run.wait, { 10000 })
runner.Step("Change gear to `PARK`", gearChanging, { "PARK" })
runner.Step("Ignition off", ignitionOff)
end

runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
1 change: 1 addition & 0 deletions test_sets/Defects/Defects_release_7_1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@
./test_scripts/Defects/7_1/2604_Starting_of_protected_RPC_service_before_and_after_app_registration.lua
./test_scripts/Defects/7_1/1714_OnSystemRequest_send_binaryData_for_any_requestType.lua
./test_scripts/Defects/7_1/3412_Two_Streaming_apps_and_Alert_requests.lua
./test_scripts/Defects/7_1/3163_SDL_restart_with_gear_change.lua