Skip to content

Commit

Permalink
Merge pull request #147 from smartdevicelink/release/5.0.0
Browse files Browse the repository at this point in the history
Release 5.0.0
  • Loading branch information
Jack-Byrne authored Oct 19, 2018
2 parents 314b470 + c7022ed commit c69fa29
Show file tree
Hide file tree
Showing 38 changed files with 2,869 additions and 773 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
path = modules/json4lua
url = https://github.com/CustomSDL/json4lua
branch = master
[submodule "modules/luamq"]
path = modules/luamq
url = https://github.com/dboltovskyi/luamq
branch = master
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,23 @@ SOURCES= src/lua_interpreter.cc \
src/qdatetime.cc \
src/timers.cc

all: interp modules/libxml.so
all: interp modules/libxml.so modules/libmq.so modules/libluaopenssl.so

interp: $(PROJECT).mk $(SOURCES)
make -f $<
rm -f moc_*.cpp
rm -f moc_*.cpp moc_*.h .qmake.stash

modules/libxml.so: src/lua_xml.cc
$(CXX) $(CXXFLAGS) -shared -std=c++11 $< -o modules/libxml.so -g -I/usr/include/libxml2 -llua5.2 -lxml2 -fPIC

modules/libmq.so:
cd ./modules/luamq/; make
cp -f ./modules/luamq/src/mq.so ./modules/libmq.so
rm -f ./modules/luamq/src/mq.so ./modules/luamq/src/lua-mq.o

modules/libluaopenssl.so: src/lua_openssl.cc
$(CXX) $(CXXFLAGS) -shared -std=c++11 $< -o modules/libluaopenssl.so -g -I/usr/include/openssl -llua5.2 -lssl -lcrypto -fPIC

clean:
rm -f $(PROJECT).mk
rm -f *.o moc_*.cpp *.aux *.log *.so *.a
Expand Down
38 changes: 21 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# Automated Test Framework (ATF)

## Dependencies:
Library | License
------------------ | -------------
**Lua libs** |
liblua5.2 | MIT
json4lua | MIT
lua-stdlib | MIT
lua-lpeg |
**Qt libs** |
Qt5.3 WebSockets | LGPL 2.1
Qt5.3 Network | LGPL 2.1
Qt5.3 Core | LGPL 2.1
Qt5.3 Test | LGPL 2.1
**Other libs** |
lpthread | LGPL
libxml2 | MIT
ldoc | MIT/X11
Library | License
---------------------- | -------------
**Lua libs** |
liblua5.2 | MIT
json4lua | MIT
lua-stdlib | MIT
lua-lpeg |
**Qt libs** |
Qt5.3 WebSockets | LGPL 2.1
Qt5.3 Network | LGPL 2.1
Qt5.3 Core | LGPL 2.1
Qt5.3 Test | LGPL 2.1
**Other libs** |
lpthread | LGPL
OpenSSL (ssl, crypto) | OpenSSL License
libxml2 | MIT
ldoc | MIT/X11

For ATF usage:
```sudo apt-get install liblua5.2 libxml2 lua-lpeg```
Expand All @@ -30,7 +31,10 @@ $ git submodule update
```
## Compilation:
**1** Install 3d-parties developers libraries
```sudo apt-get install liblua5.2-dev libxml2-dev lua-lpeg-dev```
```
sudo apt-get install liblua5.2-dev libxml2-dev lua-lpeg-dev
sudo apt-get install openssl
```

**2** Install Qt5.3+

Expand Down
1 change: 1 addition & 0 deletions data/HMI_API.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<enum name="ButtonName">
<description>Defines the hard (physical) and soft (touchscreen) buttons available from SYNC</description>
<element name="OK"/>
<element name="PLAY_PAUSE"/>
<element name="SEEKLEFT"/>
<element name="SEEKRIGHT"/>
<element name="TUNEUP"/>
Expand Down
1 change: 1 addition & 0 deletions data/MOBILE_API.xml
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@
<enum name="ButtonName">
<description>Defines the hard (physical) and soft (touchscreen) buttons available from the module</description>
<element name="OK" />
<element name="PLAY_PAUSE" />
<element name="SEEKLEFT" />
<element name="SEEKRIGHT" />
<element name="TUNEUP" />
Expand Down
32 changes: 13 additions & 19 deletions modules/SDL.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
--- The module which is responsible for managing SDL from ATF
--
-- *Dependencies:* `os`, `sdl_logger`, `config`, `atf.util`
-- *Dependencies:* `os`, `sdl_logger`, `config`, `atf.util`, `console`
--
-- *Globals:* `sleep()`, `CopyFile()`, `CopyInterface()`, `xmlReporter`, `console`
-- *Globals:* `sleep()`, `CopyFile()`, `CopyInterface()`, `xmlReporter`
-- @module SDL
-- @copyright [Ford Motor Company](https://smartdevicelink.com/partners/ford/) and [SmartDeviceLink Consortium](https://smartdevicelink.com/consortium/)
-- @license <https://github.com/smartdevicelink/sdl_core/blob/master/LICENSE>
Expand All @@ -11,6 +11,7 @@ require('os')
local sdl_logger = require('sdl_logger')
local config = require('config')
local console = require('console')
local util = require ("atf.util")
local SDL = { }

require('atf.util')
Expand All @@ -37,13 +38,13 @@ local usedBuildOptions = {
}
}

--- Read specified parameter from CMakeCache.txt file
--- Read specified parameter from build_config.txt file
-- @tparam string paramName Parameter to read value
-- @treturn string The main result. Value read of parameter.
-- Can be nil in case parameter was not found.
-- @treturn string Type of read parameter
local function readParameterFromCMakeCacheFile(paramName)
local pathToFile = config.pathToSDL .. "/CMakeCache.txt"
local function readParameterFromBuildConfigFile(paramName)
local pathToFile = config.pathToSDL .. "/build_config.txt"
if is_file_exists(pathToFile) then
local paramValue, paramType
for line in io.lines(pathToFile) do
Expand All @@ -62,13 +63,9 @@ end
-- @tparam string sdlBuildParam SDL build parameter to read value
-- @tparam string defaultValue Default value of set option
local function setSdlBuildOption(self, optionName, sdlBuildParam, defaultValue)
local value, paramType = readParameterFromCMakeCacheFile(sdlBuildParam)
local value, paramType = readParameterFromBuildConfigFile(sdlBuildParam)
if value == nil then
value = defaultValue
local msg = "SDL build option " ..
sdlBuildParam .. " is unavailable.\nAssume that SDL was built with " ..
sdlBuildParam .. " = " .. defaultValue
print(console.setattr(msg, "cyan", 1))
else
if paramType == "UNINITIALIZED" then
value = nil
Expand Down Expand Up @@ -119,7 +116,7 @@ function SDL:StartSDL(pathToSDL, smartDeviceLinkCore, ExitOnCrash)
if result then
msg = "SDL started"
if config.storeFullSDLLogs == true then
sdl_logger.init_log(get_script_file_name())
sdl_logger.init_log(util.runner.get_script_file_name())
end
else
msg = "SDL had already started not from ATF or unexpectedly crashed"
Expand All @@ -136,19 +133,16 @@ function SDL:StopSDL()
self.autoStarted = false
local status = self:CheckStatusSDL()
if status == self.RUNNING then
local result = os.execute ('./tools/StopSDL.sh')
if result then
if config.storeFullSDLLogs == true then
sdl_logger.close()
end
return true
end
os.execute('./tools/StopSDL.sh')
else
local msg = "SDL had already stopped"
xmlReporter.AddMessage("StopSDL", {["message"] = msg})
print(console.setattr(msg, "cyan", 1))
return nil, msg
end
if config.storeFullSDLLogs == true then
sdl_logger.close()
end
sleep(1)
end

--- SDL status check
Expand Down
24 changes: 21 additions & 3 deletions modules/api_loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ local function LoadParamsInFunction(param, interface)
data["maxsize"] = tonumber(param:attr("maxsize"))
data["minvalue"] = tonumber(param:attr("minvalue"))
data["maxvalue"] = tonumber(param:attr("maxvalue"))
data["defvalue"] = tonumber(param:attr("defvalue"))
data["resultCodes"] = result_codes
return name, data
end
Expand Down Expand Up @@ -125,12 +126,28 @@ local function LoadFunction( api, dest )
end
end

local function GetAPIVersion(version_str)
local version_arr = {0,0,0}
local index = 0
for i in string.gmatch(version_str, "([^.]+)") do
version_arr[index] = i
index = index + 1
end
local version = {
majorVersion = version_arr[0],
minorVersion = version_arr[1],
patchVersion = version_arr[2]
}
return version
end

--- Load interfaces from api. Each function, enum and struct will be
-- kept inside appropriate interface
local function LoadInterfaces( api, dest )
local interfaces = api:xpath("//interface")
for _, s in ipairs(interfaces) do
name = s:attr("name")
version_str = s:attr("version")
dest.interface[name] ={}
dest.interface[name].body = s
dest.interface[name].type={}
Expand All @@ -142,6 +159,7 @@ local function LoadInterfaces( api, dest )
dest.interface[name].type['notification'].functions={}
dest.interface[name].enum={}
dest.interface[name].struct={}
dest.interface[name].version = GetAPIVersion(version_str)
end
end

Expand All @@ -151,7 +169,7 @@ end
-- @tparam string path Path to the xml file
-- @tparam string include_parent_name Parent name
-- @treturn table lua table with all xml RPCs
function apiLoader.init(path, include_parent_name)
function apiLoader.init(path, include_parent_name)
apiLoader.include_parent_name = include_parent_name
local result = {}
result.interface = { }
Expand All @@ -165,6 +183,6 @@ end

LoadFunction(_api, result)
return result
end
end

return apiLoader
return apiLoader
Loading

0 comments on commit c69fa29

Please sign in to comment.