Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
FlockLab 1 - deprecated
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
TEC
P
Public
FlockLab
FlockLab 1 - deprecated
Commits
5da58fb4
Commit
5da58fb4
authored
May 07, 2019
by
Reto Da Forno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
<os> tag is now optional
parent
868c871f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
42 deletions
+29
-42
server/webserver/testmanagement/check_schedulability.py
server/webserver/testmanagement/check_schedulability.py
+4
-1
server/webserver/testmanagement/testconfig_validator.py
server/webserver/testmanagement/testconfig_validator.py
+5
-21
server/webserver/user/include/libflocklab.php
server/webserver/user/include/libflocklab.php
+19
-19
server/webserver/user/xml/flocklab.xsd
server/webserver/user/xml/flocklab.xsd
+1
-1
No files found.
server/webserver/testmanagement/check_schedulability.py
View file @
5da58fb4
...
...
@@ -431,7 +431,10 @@ def modifyConfig(tree,ns,userId,testStart,testEnd,config,cursor):
else
:
platform
=
ret
[
0
]
# same for the os
os
=
imageconf
[
0
].
xpath
(
'd:os'
,
namespaces
=
ns
)[
0
].
text
if
imageconf
[
0
].
xpath
(
'd:os'
,
namespaces
=
ns
):
os
=
imageconf
[
0
].
xpath
(
'd:os'
,
namespaces
=
ns
)[
0
].
text
else
:
os
=
'other'
# os tag is optional and deprecated
sql
=
"SELECT serv_operatingsystems_key FROM tbl_serv_operatingsystems WHERE (LOWER(name) = LOWER('%s'))"
%
os
cursor
.
execute
(
sql
)
ret
=
cursor
.
fetchone
()
...
...
server/webserver/testmanagement/testconfig_validator.py
View file @
5da58fb4
...
...
@@ -503,7 +503,10 @@ def main(argv):
errcnt
=
errcnt
+
1
else
:
# Get os and platform and put it into dictionary for later use:
opersys
=
imageconf
[
0
].
xpath
(
'd:os'
,
namespaces
=
ns
)[
0
].
text
if
imageconf
[
0
].
xpath
(
'd:os'
,
namespaces
=
ns
):
opersys
=
imageconf
[
0
].
xpath
(
'd:os'
,
namespaces
=
ns
)[
0
].
text
else
:
opersys
=
'other'
platform
=
imageconf
[
0
].
xpath
(
'd:platform'
,
namespaces
=
ns
)[
0
].
text
try
:
core
=
int
(
imageconf
[
0
].
xpath
(
'd:core'
,
namespaces
=
ns
)[
0
].
text
)
...
...
@@ -634,12 +637,11 @@ def main(argv):
errcnt
=
errcnt
+
1
#===========================================================================
# If there are still no errors, do additional test on the remaining elements
:
# If there are still no errors, do additional test on the remaining elements
#===========================================================================
if
errcnt
==
0
:
# serialConf additional validation --------------------------------------
# * observer ids need to have a targetConf associated and must be unique
# * check baudrate depending on the operating system
# * check port depending on platform
# Check observer ids:
...
...
@@ -652,25 +654,7 @@ def main(argv):
if
not
quiet
:
print
(
"<b>Element serialConf</b>: Some observer IDs have been used but do not have a targetConf element associated with them."
)
errcnt
=
errcnt
+
1
# Check baudrate (if specified) against operatingsystem for target:
srconfs
=
tree
.
xpath
(
'//d:serialConf'
,
namespaces
=
ns
)
for
srconf
in
srconfs
:
obsids
=
srconf
.
xpath
(
'd:obsIds'
,
namespaces
=
ns
)[
0
].
text
.
split
()
baudrate
=
srconf
.
xpath
(
'd:baudrate'
,
namespaces
=
ns
)
if
baudrate
:
baudrate
=
int
(
srconf
.
xpath
(
'd:baudrate'
,
namespaces
=
ns
)[
0
].
text
)
baudrate_line
=
srconf
.
xpath
(
'd:baudrate'
,
namespaces
=
ns
)[
0
].
sourceline
for
obsid
in
obsids
:
if
obsid
in
obsiddict
:
opersys
=
next
(
iter
(
obsiddict
[
obsid
].
values
()))[
0
]
else
:
opersys
=
None
if
(
opersys
==
'contiki'
)
and
(
baudrate
not
in
(
19200
,
38400
,
57600
,
115200
)):
if
not
quiet
:
print
((
"<b>Line %d</b>: element baudrate: For operating system %s, a baudrate of %d is not valid."
%
(
baudrate_line
,
opersys
,
baudrate
)))
errcnt
=
errcnt
+
1
# gpioTracingConf additional validation ---------------------------------------
# * observer ids need to have a targetConf associated and must be unique
# * Every (pin, edge) combination can only be used once.
...
...
server/webserver/user/include/libflocklab.php
View file @
5da58fb4
...
...
@@ -312,7 +312,7 @@ function get_teststatus($testid) {
# image validation
#
# validate_image
# @param $image: assoc array('name','description','
os','platform',
'data')
# @param $image: assoc array('name','description','
platform',
'data')
# @param &$errors: array where errors are added
#
##############################################################################
...
...
@@ -320,13 +320,12 @@ function get_teststatus($testid) {
function
validate_image
(
$image
,
&
$errors
)
{
global
$CONFIG
;
$validate_image_errors
=
array
();
foreach
(
Array
(
'name'
,
'
os'
,
'
platform'
)
as
$field
)
foreach
(
Array
(
'name'
,
'platform'
)
as
$field
)
if
(
!
isset
(
$image
[
$field
])
||
strlen
(
$image
[
$field
])
==
0
)
array_push
(
$validate_image_errors
,
"Missing mandatory field <i>"
.
$field
.
"</i>"
);
// Get the file and check if it is a valid image
$imagefile
=
tempnam
(
sys_get_temp_dir
(),
'flocklab'
);
file_put_contents
(
$imagefile
,
$image
[
'data'
]);
$os_list
=
get_available_os
();
$platform_list
=
get_available_platforms
();
$cmd
=
"cd "
.
$CONFIG
[
'tests'
][
'testmanagementfolder'
]
.
"; python "
.
$CONFIG
[
'targetimage'
][
'imagevalidator'
]
.
" --image="
.
$imagefile
.
" --platform="
.
$platform_list
[
$image
[
'platform'
]][
0
][
'name'
]
.
" --core="
.
$image
[
'core'
];
exec
(
$cmd
,
$output
,
$ret
);
...
...
@@ -344,14 +343,12 @@ function validate_image($image, &$errors) {
# image validation
#
# check_image_duplicate
# @param $image: assoc array('name','description','
os','
platform','core','data')
# @param $image: assoc array('name','description','platform','core','data')
# @return: false if no duplicate were found, else the id of the duplicate
#
##############################################################################
*/
function
check_image_duplicate
(
$image
)
{
// check arguments
(
$image
[
'os'
]
!=
''
)
or
flocklab_die
(
"invalid argument for check_image_duplicate"
);
// check hash
$duplicate
=
false
;
$db
=
db_connect
();
...
...
@@ -360,8 +357,7 @@ function check_image_duplicate($image) {
FROM `tbl_serv_targetimages`
WHERE `owner_fk`='
.
$_SESSION
[
'serv_users_key'
]
.
'
AND `binary` IS NOT NULL
AND `binary_hash_sha1`="'
.
$hash
.
'"
AND `operatingsystems_fk`='
.
mysqli_real_escape_string
(
$db
,
$image
[
'os'
])
.
'
AND `binary_hash_sha1`="'
.
$hash
.
'"
AND `platforms_fk`='
.
mysqli_real_escape_string
(
$db
,
$image
[
'platform'
])
.
'
AND `core`='
.
mysqli_real_escape_string
(
$db
,
$image
[
'core'
]);
$res
=
mysqli_query
(
$db
,
$sql
)
or
flocklab_die
(
'Cannot compare to other images because: '
.
mysqli_error
(
$db
));
...
...
@@ -1007,18 +1003,22 @@ function update_add_test($xml_config, &$errors, $existing_test_id = NULL, $abort
}
else
{
$im_cpy
=
Array
();
$im_cpy
[
'data'
]
=
base64_decode
(
$im
->
data
);
$im_cpy
[
'embeddedImageId'
]
=
$eId
;
$im_cpy
[
'name'
]
=
$im
->
name
;
$im_cpy
[
'description'
]
=
$im
->
description
;
$im_cpy
[
'used'
]
=
in_array
(
$eId
,
$used_embeddedImages
);
$im_cpy
[
'data'
]
=
base64_decode
(
$im
->
data
);
$im_cpy
[
'embeddedImageId'
]
=
$eId
;
$im_cpy
[
'name'
]
=
$im
->
name
;
$im_cpy
[
'description'
]
=
$im
->
description
;
$im_cpy
[
'used'
]
=
in_array
(
$eId
,
$used_embeddedImages
);
foreach
(
$available_platforms
as
$key
=>
$platform
)
if
(
strcasecmp
(
$platform
[
0
][
'name'
],
trim
(
$im
->
platform
))
==
0
)
$im_cpy
[
'platform'
]
=
$key
;
foreach
(
$available_os
as
$key
=>
$os
)
if
(
strcasecmp
(
$os
,
trim
(
$im
->
os
))
==
0
)
$im_cpy
[
'os'
]
=
$key
;
$im_cpy
[
'core'
]
=
isset
(
$im
->
core
)
?
$im
->
core
:
0
;
if
(
strcasecmp
(
$platform
[
0
][
'name'
],
trim
(
$im
->
platform
))
==
0
)
$im_cpy
[
'platform'
]
=
$key
;
$im_os
=
isset
(
$im
->
os
)
?
trim
(
$im
->
os
)
:
'other'
;
foreach
(
$available_os
as
$key
=>
$os
)
{
if
(
strcasecmp
(
$os
,
$im_os
)
==
0
)
{
$im_cpy
[
'os'
]
=
$key
;
break
;
}
}
$im_cpy
[
'core'
]
=
isset
(
$im
->
core
)
?
$im
->
core
:
0
;
$embeddedImages
[
$eId
]
=
$im_cpy
;
}
}
...
...
server/webserver/user/xml/flocklab.xsd
View file @
5da58fb4
...
...
@@ -159,7 +159,7 @@
</xs:simpleType>
</xs:element>
<xs:element
name=
"platform"
type=
"platformType"
/>
<xs:element
name=
"os"
type=
"osType"
/>
<xs:element
name=
"os"
type=
"osType"
minOccurs=
"0"
maxOccurs=
"1"
/>
<xs:element
name=
"data"
type=
"xs:base64Binary"
/>
<xs:element
name=
"core"
type=
"xs:integer"
minOccurs=
"0"
maxOccurs=
"1"
/>
</xs:all>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment