Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
01ea8dbd
Commit
01ea8dbd
authored
Jan 24, 2024
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CI: Add Build_Run_Tests unit testing step
parent
1a031797
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
1 deletion
+87
-1
ci-scripts/cls_containerize.py
ci-scripts/cls_containerize.py
+81
-0
ci-scripts/main.py
ci-scripts/main.py
+5
-1
ci-scripts/xml_class_list.yml
ci-scripts/xml_class_list.yml
+1
-0
No files found.
ci-scripts/cls_containerize.py
View file @
01ea8dbd
...
@@ -671,6 +671,87 @@ class Containerize():
...
@@ -671,6 +671,87 @@ class Containerize():
HTML
.
CreateHtmlTestRow
(
'commit '
+
tag
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
HTML
.
CreateHtmlTestRow
(
'commit '
+
tag
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
HTML
.
CreateHtmlNextTabHeaderTestRow
(
collectInfo
,
allImagesSize
)
HTML
.
CreateHtmlNextTabHeaderTestRow
(
collectInfo
,
allImagesSize
)
def
BuildRunTests
(
self
,
HTML
):
if
self
.
ranRepository
==
''
or
self
.
ranBranch
==
''
or
self
.
ranCommitID
==
''
:
HELP
.
GenericHelp
(
CONST
.
Version
)
sys
.
exit
(
'Insufficient Parameter'
)
if
self
.
eNB_serverId
[
self
.
eNB_instance
]
==
'0'
:
lIpAddr
=
self
.
eNBIPAddress
lUserName
=
self
.
eNBUserName
lPassWord
=
self
.
eNBPassword
lSourcePath
=
self
.
eNBSourceCodePath
elif
self
.
eNB_serverId
[
self
.
eNB_instance
]
==
'1'
:
lIpAddr
=
self
.
eNB1IPAddress
lUserName
=
self
.
eNB1UserName
lPassWord
=
self
.
eNB1Password
lSourcePath
=
self
.
eNB1SourceCodePath
elif
self
.
eNB_serverId
[
self
.
eNB_instance
]
==
'2'
:
lIpAddr
=
self
.
eNB2IPAddress
lUserName
=
self
.
eNB2UserName
lPassWord
=
self
.
eNB2Password
lSourcePath
=
self
.
eNB2SourceCodePath
if
lIpAddr
==
''
or
lUserName
==
''
or
lPassWord
==
''
or
lSourcePath
==
''
:
HELP
.
GenericHelp
(
CONST
.
Version
)
sys
.
exit
(
'Insufficient Parameter'
)
logging
.
debug
(
'Building on server: '
+
lIpAddr
)
cmd
=
cls_cmd
.
RemoteCmd
(
lIpAddr
)
cmd
.
cd
(
lSourcePath
)
ret
=
cmd
.
run
(
'hostnamectl'
)
result
=
re
.
search
(
'Ubuntu'
,
ret
.
stdout
)
host
=
result
.
group
(
0
)
if
host
!=
'Ubuntu'
:
cmd
.
close
()
raise
Exception
(
"Can build unit tests only on Ubuntu server"
)
logging
.
debug
(
'running on Ubuntu as expected'
)
if
self
.
forcedWorkspaceCleanup
:
cmd
.
run
(
f'sudo -S rm -Rf
{
lSourcePath
}
'
)
self
.
testCase_id
=
HTML
.
testCase_id
# check that ran-base image exists as we expect it
baseImage
=
'ran-base'
baseTag
=
'develop'
if
self
.
ranAllowMerge
:
if
self
.
ranTargetBranch
==
'develop'
:
cmd
.
run
(
f'git diff HEAD..origin/develop -- cmake_targets/build_oai cmake_targets/tools/build_helper docker/Dockerfile.base
{
self
.
dockerfileprefix
}
| grep --colour=never -i INDEX'
)
result
=
re
.
search
(
'index'
,
cmd
.
getBefore
())
if
result
is
not
None
:
baseTag
=
'develop'
ret
=
cmd
.
run
(
f"docker image inspect --format=
\'
Size = {{{{.Size}}}} bytes
\'
{
baseImage
}
:
{
baseTag
}
"
)
if
ret
.
returncode
!=
0
:
logging
.
error
(
f'No
{
baseImage
}
image present, cannot build tests'
)
HTML
.
CreateHtmlTestRow
(
self
.
imageKind
,
'KO'
,
CONST
.
ALL_PROCESSES_OK
)
HTML
.
CreateHtmlTabFooter
(
False
)
return
False
# build ran-unittests image
dockerfile
=
"ci-scripts/docker/Dockerfile.unittest.ubuntu20"
ret
=
cmd
.
run
(
f'docker build --progress=plain --tag ran-unittests:
{
baseTag
}
--file
{
dockerfile
}
. &>
{
lSourcePath
}
/cmake_targets/log/unittest-build.log'
)
if
ret
.
returncode
!=
0
:
logging
.
error
(
f'Cannot build unit tests'
)
HTML
.
CreateHtmlTestRow
(
"Unit test build failed"
,
'KO'
,
[
dockerfile
])
HTML
.
CreateHtmlTabFooter
(
False
)
return
False
HTML
.
CreateHtmlTestRowQueue
(
"Build unit tests"
,
'OK'
,
[
dockerfile
])
# it worked, build and execute tests, and close connection
ret
=
cmd
.
run
(
f'docker run -a STDOUT --rm ran-unittests:develop ctest --output-on-failure --no-label-summary -j$(nproc)'
)
cmd
.
run
(
f'docker rmi ran-unittests:develop'
)
build_log_name
=
f'build_log_
{
self
.
testCase_id
}
'
CopyLogsToExecutor
(
cmd
,
lSourcePath
,
build_log_name
)
cmd
.
close
()
if
ret
.
returncode
==
0
:
HTML
.
CreateHtmlTestRowQueue
(
'Unit tests succeeded'
,
'OK'
,
[
ret
.
stdout
])
HTML
.
CreateHtmlTabFooter
(
True
)
return
True
else
:
HTML
.
CreateHtmlTestRowQueue
(
'Unit tests failed (see also doc/UnitTests.md)'
,
'KO'
,
[
ret
.
stdout
])
HTML
.
CreateHtmlTabFooter
(
False
)
return
False
def
Push_Image_to_Local_Registry
(
self
,
HTML
):
def
Push_Image_to_Local_Registry
(
self
,
HTML
):
if
self
.
registrySvrId
==
'0'
:
if
self
.
registrySvrId
==
'0'
:
lIpAddr
=
self
.
eNBIPAddress
lIpAddr
=
self
.
eNBIPAddress
...
...
ci-scripts/main.py
View file @
01ea8dbd
...
@@ -102,7 +102,7 @@ def AssignParams(params_dict):
...
@@ -102,7 +102,7 @@ def AssignParams(params_dict):
def
GetParametersFromXML
(
action
):
def
GetParametersFromXML
(
action
):
if
action
==
'Build_eNB'
or
action
==
'Build_Image'
or
action
==
'Build_Proxy'
or
action
==
"Build_Cluster_Image"
:
if
action
==
'Build_eNB'
or
action
==
'Build_Image'
or
action
==
'Build_Proxy'
or
action
==
"Build_Cluster_Image"
or
action
==
"Build_Run_Tests"
:
RAN
.
Build_eNB_args
=
test
.
findtext
(
'Build_eNB_args'
)
RAN
.
Build_eNB_args
=
test
.
findtext
(
'Build_eNB_args'
)
CONTAINERS
.
imageKind
=
test
.
findtext
(
'kind'
)
CONTAINERS
.
imageKind
=
test
.
findtext
(
'kind'
)
forced_workspace_cleanup
=
test
.
findtext
(
'forced_workspace_cleanup'
)
forced_workspace_cleanup
=
test
.
findtext
(
'forced_workspace_cleanup'
)
...
@@ -833,6 +833,10 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
...
@@ -833,6 +833,10 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
success
=
CONTAINERS
.
BuildImage
(
HTML
)
success
=
CONTAINERS
.
BuildImage
(
HTML
)
if
not
success
:
if
not
success
:
RAN
.
prematureExit
=
True
RAN
.
prematureExit
=
True
elif
action
==
'Build_Run_Tests'
:
success
=
CONTAINERS
.
BuildRunTests
(
HTML
)
if
not
success
:
RAN
.
prematureExit
=
True
elif
action
==
'Build_Proxy'
:
elif
action
==
'Build_Proxy'
:
success
=
CONTAINERS
.
BuildProxy
(
HTML
)
success
=
CONTAINERS
.
BuildProxy
(
HTML
)
if
not
success
:
if
not
success
:
...
...
ci-scripts/xml_class_list.yml
View file @
01ea8dbd
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
-
IdleSleep
-
IdleSleep
-
Perform_X2_Handover
-
Perform_X2_Handover
-
Build_Image
-
Build_Image
-
Build_Run_Tests
-
Deploy_Object
-
Deploy_Object
-
Undeploy_Object
-
Undeploy_Object
-
Cppcheck_Analysis
-
Cppcheck_Analysis
...
...
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