Skip to content

Commit

Permalink
Merge pull request #240 from smartdevicelink/release/8.0.0
Browse files Browse the repository at this point in the history
Release 8.0.0
  • Loading branch information
jacobkeeler authored Oct 27, 2021
2 parents 454487d + 8f53052 commit 08354ae
Show file tree
Hide file tree
Showing 15 changed files with 239 additions and 64 deletions.
13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,11 @@ $ sudo apt-get install openssl libssl-dev net-tools
```

**2.** Install Qt5.9+
- For Ubuntu `18.04+`:
- Run the following command:
- Run the following command:
```
$ sudo apt-get install libqt5websockets5 libqt5websockets5-dev
```

- For Ubuntu `16.04`:
- Run the following commands:
```
$ sudo add-apt-repository -y ppa:beineri/opt-qt591-xenial
$ sudo apt-get update
$ sudo apt-get install qt59base qt59websockets
```

**3.** Build ATF

CMake 3.15 or newer is required to generate the build files and can be downloaded from [here](https://cmake.org/download/).
Expand Down Expand Up @@ -93,7 +84,7 @@ $ sudo apt-get install screen rsync
$ cd atf_parallels/docker
$ ./build.sh <ubuntu_version>
```
<b>Note:</b> accepted values are `16`, `18`, and `20` (will be processed as `16.04`, `18.04`, and `20.04` correspondingly).
<b>Note:</b> accepted values are `18` and `20` (will be processed as `18.04`, and `20.04` correspondingly).
If version is not specified `20` will be used by default.

## Settings
Expand Down
7 changes: 2 additions & 5 deletions atf_parallels/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ if [ -z $_ubuntu_ver ]; then
fi

case $_ubuntu_ver in
16|18|20)
18|20)
case $_ubuntu_ver in
16)
_openssl_lib_ver=1.0.0
_expat_lib_ver=1.6.0;;
18)
_expat_lib_ver=1.6.7;;
*)
Expand All @@ -41,7 +38,7 @@ case $_ubuntu_ver in

echo "Ubuntu version: "$_ubuntu_ver;;
*)
warning "Specified Ubuntu version '$_ubuntu_ver' is unexpected. Allowed versions: 16, 18, or 20";
warning "Specified Ubuntu version '$_ubuntu_ver' is unexpected. Allowed versions: 18 or 20";
exit 1;;
esac

Expand Down
66 changes: 42 additions & 24 deletions modules/SDL.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,30 +69,32 @@ end
--- Update SDL logger config in order SDL will be able to write logs through Telnet
local function updateSDLLogProperties()
if config.storeFullSDLLogs == true then
local name = "log4j.rootLogger"
local curValue = SDL.LOGGER.get(name)
local newValue = "TelnetLogging"
if not string.find(curValue, newValue) then
SDL.LOGGER.set(name, curValue .. ", " .. newValue)
end
name = "log4j.appender.TelnetLogging.layout.ConversionPattern"
curValue = SDL.LOGGER.get(name)
if string.sub(curValue, -1) == "n" then
SDL.LOGGER.set(name, string.sub(curValue, 1, -3))
end
if config.loggerName == "LOG4CXX" then
local name = "log4j.rootLogger"
local curValue = SDL.LOGGER.get(name)
local newValue = "TelnetLogging"
if not string.find(curValue, newValue) then
SDL.LOGGER.set(name, curValue .. ", " .. newValue)
end
name = "log4j.appender.TelnetLogging.layout.ConversionPattern"
curValue = SDL.LOGGER.get(name)
if string.sub(curValue, -1) == "n" then
SDL.LOGGER.set(name, string.sub(curValue, 1, -3))
end

local paramsToUpdate = {
{
name = "log4j.appender.TransportManagerLogFile",
value = "SafeFileAppender\nlog4j.appender.TransportManagerLogFile.Threshold=OFF"
},
{
name = "log4j.appender.ProtocolFordHandlingLogFile",
value = "SafeFileAppender\nlog4j.appender.ProtocolFordHandlingLogFile.Threshold=OFF"
local paramsToUpdate = {
{
name = "log4j.appender.TransportManagerLogFile",
value = "SafeFileAppender\nlog4j.appender.TransportManagerLogFile.Threshold=OFF"
},
{
name = "log4j.appender.ProtocolFordHandlingLogFile",
value = "SafeFileAppender\nlog4j.appender.ProtocolFordHandlingLogFile.Threshold=OFF"
}
}
}
for _, item in pairs(paramsToUpdate) do
SDL.LOGGER.set(item.name, item.value)
for _, item in pairs(paramsToUpdate) do
SDL.LOGGER.set(item.name, item.value)
end
end
end
end
Expand Down Expand Up @@ -343,7 +345,11 @@ end
SDL.LOGGER = {}

function SDL.LOGGER.file()
return config.pathToSDL .. "log4cxx.properties"
local configFileName = "boostlogconfig.ini"
if config.loggerName == "LOG4CXX" then
configFileName = "log4cxx.properties"
end
return config.pathToSDL .. configFileName
end

function SDL.LOGGER.get(pParam)
Expand Down Expand Up @@ -541,10 +547,20 @@ function SDL.AppStorage.clean(pPath)
getExecFunc()("rm -rf " .. SDL.AppStorage.path() .. pPath)
end

SDL.AppIcons = {}

function SDL.AppIcons.path()
return getPath(SDL.INI.get("AppIconsFolder"))
end

function SDL.AppIcons.clean()
getExecFunc()("rm -rf " .. SDL.AppIcons.path())
end

SDL.AppInfo = {}

function SDL.AppInfo.file()
return getFilePath(SDL.INI.get("AppInfoStorage"))
return getFilePath(SDL.INI.get("AppInfoStorage"), SDL.INI.get("AppStorageFolder"))
end

function SDL.AppInfo.get()
Expand All @@ -555,6 +571,7 @@ end

function SDL.AppInfo.set(pAppInfo)
local content = json.encode(pAppInfo)
getExecFunc()("mkdir -p " .. SDL.AppStorage.path())
saveFileContent(SDL.AppInfo.file(), content)
end

Expand Down Expand Up @@ -583,6 +600,7 @@ end

function SDL.HMICapCache.set(pHmiCapCache)
local content = json.encode(pHmiCapCache)
getExecFunc()("mkdir -p " .. SDL.AppStorage.path())
saveFileContent(SDL.HMICapCache.file(), content)
end

Expand Down
5 changes: 4 additions & 1 deletion modules/atf_logger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ local function get_function_name(message)

if message.frameType ~= ford_constants.FRAME_TYPE.CONTROL_FRAME then
if message.serviceType == ford_constants.SERVICE_TYPE.CONTROL
and message.rpcType == ford_constants.BINARY_RPC_TYPE.NOTIFICATION
and message.rpcFunctionId == ford_constants.BINARY_RPC_FUNCTION_ID.HANDSHAKE then
return "SSL: Handshake"
end
if message.serviceType == ford_constants.SERVICE_TYPE.CONTROL
and message.rpcFunctionId == ford_constants.BINARY_RPC_FUNCTION_ID.INTERNAL_ERROR then
return "SSL: Internal Error"
end
else
return "controlMsg: " .. getControlFrameMessageName(message.frameInfo)
end
Expand Down
20 changes: 10 additions & 10 deletions modules/configuration/app_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ config.application1 =
{
syncMsgVersion =
{
majorVersion = 7,
minorVersion = 1
majorVersion = 8,
minorVersion = 0
},
appName = "Test Application",
isMediaApplication = true,
Expand All @@ -43,8 +43,8 @@ config.application2 =
{
syncMsgVersion =
{
majorVersion = 7,
minorVersion = 1
majorVersion = 8,
minorVersion = 0
},
appName = "Test Application2",
isMediaApplication = true,
Expand All @@ -71,8 +71,8 @@ config.application3 =
{
syncMsgVersion =
{
majorVersion = 7,
minorVersion = 1
majorVersion = 8,
minorVersion = 0
},
appName = "Test Application3",
isMediaApplication = true,
Expand All @@ -99,8 +99,8 @@ config.application4 =
{
syncMsgVersion =
{
majorVersion = 7,
minorVersion = 1
majorVersion = 8,
minorVersion = 0
},
appName = "Test Application4",
isMediaApplication = true,
Expand All @@ -127,8 +127,8 @@ config.application5 =
{
syncMsgVersion =
{
majorVersion = 7,
minorVersion = 1
majorVersion = 8,
minorVersion = 0
},
appName = "Test Application5",
isMediaApplication = true,
Expand Down
3 changes: 3 additions & 0 deletions modules/configuration/base_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ config.webengineUniqueId = "5lNGKj5n63Hf8QjZPzS7X5yjZWYD0nu6IhKtyQOFRuUZkbY8KOdF

--- Logs and Reports
--

-- Flag which defines the logger name (BOOST, LOG4CXX)
config.loggerName = "LOG4CXX"
--- Flag which defines whether ATF displays time of test step run
config.ShowTimeInConsole = true
--- Flag which defines whether ATF performs validation of Mobile and HMI messages by API
Expand Down
2 changes: 1 addition & 1 deletion modules/connecttest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function Test:initHMI()

EXPECT_HMIEVENT(events.connectedEvent, "Connected websocket")
:Do(function()
registerComponent("Buttons", {"Buttons.OnButtonSubscription"})
registerComponent("Buttons")
registerComponent("TTS")
registerComponent("VR")
registerComponent("BasicCommunication",
Expand Down
2 changes: 1 addition & 1 deletion modules/expectations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function Expectations.Expectation(name, connection)
timesGE = 1, -- Times Greater or Equal
after = { }, -- Expectations that should get complied before this one
ts = timestamp(), -- Timestamp
timeout = 10500, -- Maximum allowed age
timeout = 11500, -- Maximum allowed age
name = name, -- Name to display in error message if failed
connection = connection, -- Network connection
occurences = 0, -- Expectation complience times
Expand Down
132 changes: 132 additions & 0 deletions modules/hmi_adapter/hmi_stream_adapter_controller.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
--- Module which provides transport level interface for emulate connection to SDL from HMI for streaming
--
-- *Dependencies:* `qt`, `network`
--
-- *Globals:* `qt`, `network`
-- @module Stream
-- @copyright [SmartDeviceLink Consortium](https://smartdevicelink.com/consortium/)
-- @license <https://github.com/smartdevicelink/sdl_core/blob/master/LICENSE>

local ATF = require("ATF")

local Stream = { }

--- Type which provides transport level interface for emulate connection with SDL from HMI
-- @type Connection

--- Construct instance of Connection type
-- @tparam string host SDL host address
-- @tparam number port SDL port
-- @tparam number bytes Number of bytes to receive before calling callback
-- @tparam function func Callback when stream ends or number of bytes are received
-- @treturn Connection Constructed instance
function Stream.TcpConnection(host, port, bytes, func)
local res =
{
host = host,
port = port,
callback = func,
callbackBytes = bytes,
receivedBytes = 0,
data = {}
}

res.socket = network.TcpClient()
res.qtproxy = qt.dynamic()

local function flushStreamTcpData()
local file = io.open("tcp_stream.out","w+b")
local streamedData = table.concat(res.data)
file:write(streamedData)
file:close()
end

local function processInputData(data)
local tableIndex = #res.data

if tableIndex == 0 then
-- trim off HTTP header
local headerDelimeter = "\r\n\r\n"
local headerSize = data:find(headerDelimeter) + headerDelimeter:len()
data = string.sub(data, headerSize)
end

table.insert(res.data, data);
res.receivedBytes = res.receivedBytes + data:len()

if res.callbackBytes ~= -1 and res.receivedBytes >= res.callbackBytes then
flushStreamTcpData()
res.callback(true, res.callbackBytes, "tcp_stream.out")
res.callbackBytes = -1
end
end

function res.qtproxy.readyRead()
while true do
local data = res.socket:read(81920)
if data == '' or type(data) ~= "string" then break end
processInputData(data)
end
end

res.qtproxy.disconnected = function()
if res.receivedBytes < res.callbackBytes then
flushStreamTcpData()
res.callback(false, res.receivedBytes, "tcp_stream.out")
end
end

qt.connect(res.socket, "disconnected()", res.qtproxy, "disconnected()")

res.qtproxy.connected = function() print("HMI connected to stream") end
qt.connect(res.socket, "connected()", res.qtproxy, "connected()")

qt.connect(res.socket, "readyRead()", res.qtproxy, "readyRead()")
res.socket:connect(host, port, config.connectionTimeout)

return res
end

--- Construct instance of Connection type
-- @tparam string pipe Path to pipe of data
-- @tparam number bytes Number of bytes to receive before calling callback
-- @tparam function func Callback when stream ends or number of bytes are received
-- @treturn Connection Constructed instance
function Stream.PipeConnection(pipe, bytes, func)
local res =
{
callback = func,
callbackBytes = bytes,
receivedBytes = 0,
}
local pipeContentFileName = "pipe_stream.out"
local command = "head -c " .. tostring(bytes) .. " " .. pipe .. " > " .. pipeContentFileName
if config.remoteConnection.enabled then
ATF.remoteUtils.app:ExecuteCommand(command)
local _, isExists = ATF.remoteUtils.file:IsFileExists(".", pipeContentFileName)
if isExists then
local isSuccess, path = ATF.remoteUtils.file:GetFile(".", pipeContentFileName)
if isSuccess then
ATF.remoteUtils.file:DeleteFile(".", pipeContentFileName)
local file = io.open(path, "rb")
res.receivedBytes = file:seek("end")
file:close()
pipeContentFileName = path
else
pipeContentFileName = ""
end
else
pipeContentFileName = ""
end
else
os.execute(command)
local file = io.open(pipeContentFileName, "rb")
res.receivedBytes = file:seek("end")
file:close()
end
local success = res.receivedBytes >= res.callbackBytes
res.callback(success, res.receivedBytes, pipeContentFileName)
return res
end

return Stream
Loading

0 comments on commit 08354ae

Please sign in to comment.