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
ddec7e75
Commit
ddec7e75
authored
Jan 29, 2024
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/ci-unit-test' into integration_2024_w04
parents
6e4787a5
67421002
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
324 additions
and
146 deletions
+324
-146
ci-scripts/cls_containerize.py
ci-scripts/cls_containerize.py
+89
-7
ci-scripts/docker/Dockerfile.unittest.ubuntu20
ci-scripts/docker/Dockerfile.unittest.ubuntu20
+35
-0
ci-scripts/main.py
ci-scripts/main.py
+153
-137
ci-scripts/xml_class_list.yml
ci-scripts/xml_class_list.yml
+1
-0
ci-scripts/xml_files/container_build_run_tests.xml
ci-scripts/xml_files/container_build_run_tests.xml
+40
-0
common/utils/ds/byte_array.c
common/utils/ds/byte_array.c
+1
-2
common/utils/minimal_stub.c
common/utils/minimal_stub.c
+3
-0
doc/TESTBenches.md
doc/TESTBenches.md
+2
-0
No files found.
ci-scripts/cls_containerize.py
View file @
ddec7e75
...
@@ -424,14 +424,13 @@ class Containerize():
...
@@ -424,14 +424,13 @@ class Containerize():
# Let's remove any previous run artifacts if still there
# Let's remove any previous run artifacts if still there
cmd
.
run
(
f"
{
self
.
cli
}
image prune --force"
)
cmd
.
run
(
f"
{
self
.
cli
}
image prune --force"
)
if
forceBaseImageBuild
:
cmd
.
run
(
f"
{
self
.
cli
}
image rm
{
baseImage
}
:
{
baseTag
}
"
)
for
image
,
pattern
,
name
,
option
in
imageNames
:
for
image
,
pattern
,
name
,
option
in
imageNames
:
cmd
.
run
(
f"
{
self
.
cli
}
image rm
{
name
}
:
{
imageTag
}
"
)
cmd
.
run
(
f"
{
self
.
cli
}
image rm
{
name
}
:
{
imageTag
}
"
)
# Build the base image only on Push Events (not on Merge Requests)
# Build the base image only on Push Events (not on Merge Requests)
# On when the base image docker file is being modified.
# On when the base image docker file is being modified.
if
forceBaseImageBuild
:
if
forceBaseImageBuild
:
cmd
.
run
(
f"
{
self
.
cli
}
image rm
{
baseImage
}
:
{
baseTag
}
"
)
cmd
.
run
(
f"
{
self
.
cli
}
build
{
self
.
cliBuildOptions
}
--target
{
baseImage
}
--tag
{
baseImage
}
:
{
baseTag
}
--file docker/Dockerfile.base
{
self
.
dockerfileprefix
}
. &> cmake_targets/log/ran-base.log"
,
timeout
=
1600
)
cmd
.
run
(
f"
{
self
.
cli
}
build
{
self
.
cliBuildOptions
}
--target
{
baseImage
}
--tag
{
baseImage
}
:
{
baseTag
}
--file docker/Dockerfile.base
{
self
.
dockerfileprefix
}
. &> cmake_targets/log/ran-base.log"
,
timeout
=
1600
)
# First verify if the base image was properly created.
# First verify if the base image was properly created.
ret
=
cmd
.
run
(
f"
{
self
.
cli
}
image inspect --format=
\'
Size = {{{{.Size}}}} bytes
\'
{
baseImage
}
:
{
baseTag
}
"
)
ret
=
cmd
.
run
(
f"
{
self
.
cli
}
image inspect --format=
\'
Size = {{{{.Size}}}} bytes
\'
{
baseImage
}
:
{
baseTag
}
"
)
...
@@ -445,7 +444,7 @@ class Containerize():
...
@@ -445,7 +444,7 @@ class Containerize():
logging
.
error
(
'
\u001B
[1m Building OAI Images Failed
\u001B
[0m'
)
logging
.
error
(
'
\u001B
[1m Building OAI Images Failed
\u001B
[0m'
)
HTML
.
CreateHtmlTestRow
(
self
.
imageKind
,
'KO'
,
CONST
.
ALL_PROCESSES_OK
)
HTML
.
CreateHtmlTestRow
(
self
.
imageKind
,
'KO'
,
CONST
.
ALL_PROCESSES_OK
)
HTML
.
CreateHtmlTabFooter
(
False
)
HTML
.
CreateHtmlTabFooter
(
False
)
sys
.
exit
(
1
)
return
False
else
:
else
:
result
=
re
.
search
(
'Size *= *(?P<size>[0-9\-]+) *bytes'
,
cmd
.
getBefore
())
result
=
re
.
search
(
'Size *= *(?P<size>[0-9\-]+) *bytes'
,
cmd
.
getBefore
())
if
result
is
not
None
:
if
result
is
not
None
:
...
@@ -506,10 +505,11 @@ class Containerize():
...
@@ -506,10 +505,11 @@ class Containerize():
cmd
.
run
(
f"
{
self
.
cli
}
image prune --force"
)
cmd
.
run
(
f"
{
self
.
cli
}
image prune --force"
)
# Remove all intermediate build images and clean up
# Remove all intermediate build images and clean up
if
self
.
ranAllowMerge
and
forceBaseImageBuild
:
cmd
.
run
(
f"
{
self
.
cli
}
image rm
{
baseImage
}
:
{
baseTag
}
"
)
cmd
.
run
(
f"
{
self
.
cli
}
image rm ran-build:
{
imageTag
}
ran-build-asan:
{
imageTag
}
"
)
cmd
.
run
(
f"
{
self
.
cli
}
image rm ran-build:
{
imageTag
}
ran-build-asan:
{
imageTag
}
"
)
cmd
.
run
(
f"
{
self
.
cli
}
volume prune --force"
)
cmd
.
run
(
f"
{
self
.
cli
}
volume prune --force"
)
# Remove any cached artifacts: we don't use the cache for now, prevent
# out of diskspace problem
cmd
.
run
(
f"
{
self
.
cli
}
buildx prune --force"
)
# create a zip with all logs
# create a zip with all logs
build_log_name
=
f'build_log_
{
self
.
testCase_id
}
'
build_log_name
=
f'build_log_
{
self
.
testCase_id
}
'
...
@@ -523,12 +523,13 @@ class Containerize():
...
@@ -523,12 +523,13 @@ class Containerize():
logging
.
info
(
'
\u001B
[1m Building OAI Image(s) Pass
\u001B
[0m'
)
logging
.
info
(
'
\u001B
[1m Building OAI Image(s) Pass
\u001B
[0m'
)
HTML
.
CreateHtmlTestRow
(
self
.
imageKind
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
HTML
.
CreateHtmlTestRow
(
self
.
imageKind
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
HTML
.
CreateHtmlNextTabHeaderTestRow
(
collectInfo
,
allImagesSize
)
HTML
.
CreateHtmlNextTabHeaderTestRow
(
collectInfo
,
allImagesSize
)
return
True
else
:
else
:
logging
.
error
(
'
\u001B
[1m Building OAI Images Failed
\u001B
[0m'
)
logging
.
error
(
'
\u001B
[1m Building OAI Images Failed
\u001B
[0m'
)
HTML
.
CreateHtmlTestRow
(
self
.
imageKind
,
'KO'
,
CONST
.
ALL_PROCESSES_OK
)
HTML
.
CreateHtmlTestRow
(
self
.
imageKind
,
'KO'
,
CONST
.
ALL_PROCESSES_OK
)
HTML
.
CreateHtmlNextTabHeaderTestRow
(
collectInfo
,
allImagesSize
)
HTML
.
CreateHtmlNextTabHeaderTestRow
(
collectInfo
,
allImagesSize
)
HTML
.
CreateHtmlTabFooter
(
False
)
HTML
.
CreateHtmlTabFooter
(
False
)
sys
.
exit
(
1
)
return
False
def
BuildProxy
(
self
,
HTML
):
def
BuildProxy
(
self
,
HTML
):
if
self
.
ranRepository
==
''
or
self
.
ranBranch
==
''
or
self
.
ranCommitID
==
''
:
if
self
.
ranRepository
==
''
or
self
.
ranBranch
==
''
or
self
.
ranCommitID
==
''
:
...
@@ -611,7 +612,7 @@ class Containerize():
...
@@ -611,7 +612,7 @@ class Containerize():
mySSH
.
close
()
mySSH
.
close
()
HTML
.
CreateHtmlTestRow
(
'commit '
+
tag
,
'KO'
,
CONST
.
ALL_PROCESSES_OK
)
HTML
.
CreateHtmlTestRow
(
'commit '
+
tag
,
'KO'
,
CONST
.
ALL_PROCESSES_OK
)
HTML
.
CreateHtmlTabFooter
(
False
)
HTML
.
CreateHtmlTabFooter
(
False
)
sys
.
exit
(
1
)
return
False
else
:
else
:
logging
.
debug
(
'L2sim proxy image for tag '
+
tag
+
' already exists, skipping build'
)
logging
.
debug
(
'L2sim proxy image for tag '
+
tag
+
' already exists, skipping build'
)
...
@@ -673,6 +674,87 @@ class Containerize():
...
@@ -673,6 +674,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/docker/Dockerfile.unittest.ubuntu20
0 → 100644
View file @
ddec7e75
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface BUILD service
# Valid for Ubuntu 20.04
#
#---------------------------------------------------------------------
FROM ran-base:develop as ran-tests
RUN rm -Rf /oai-ran
WORKDIR /oai-ran
COPY . .
WORKDIR /oai-ran/build
RUN cmake -GNinja -DENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Debug .. && ninja tests
ci-scripts/main.py
View file @
ddec7e75
This diff is collapsed.
Click to expand it.
ci-scripts/xml_class_list.yml
View file @
ddec7e75
...
@@ -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
...
...
ci-scripts/xml_files/container_build_run_tests.xml
0 → 100644
View file @
ddec7e75
<!--
Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The OpenAirInterface Software Alliance licenses this file to You under
the OAI Public License, Version 1.1 (the "License"); you may not use this file
except in compliance with the License.
You may obtain a copy of the License at
http://www.openairinterface.org/?page_id=698
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For more information about the OpenAirInterface (OAI) Software Alliance:
contact@openairinterface.org
-->
<testCaseList>
<htmlTabRef>
build-run-test-tab
</htmlTabRef>
<htmlTabName>
Build and Run Unit Tests
</htmlTabName>
<htmlTabIcon>
wrench
</htmlTabIcon>
<TestCaseRequestedList>
030201
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
<testCase
id=
"030201"
>
<class>
Build_Run_Tests
</class>
<desc>
Build and Run UnitTests
</desc>
<kind>
all
</kind>
<eNB_instance>
0
</eNB_instance>
<eNB_serverId>
0
</eNB_serverId>
</testCase>
</testCaseList>
common/utils/ds/byte_array.c
View file @
ddec7e75
...
@@ -21,7 +21,6 @@
...
@@ -21,7 +21,6 @@
#include "byte_array.h"
#include "byte_array.h"
#include "common/utils/assertions.h"
#include <assert.h>
#include <assert.h>
#include <string.h>
#include <string.h>
...
@@ -29,7 +28,7 @@ byte_array_t copy_byte_array(byte_array_t src)
...
@@ -29,7 +28,7 @@ byte_array_t copy_byte_array(byte_array_t src)
{
{
byte_array_t
dst
=
{
0
};
byte_array_t
dst
=
{
0
};
dst
.
buf
=
malloc
(
src
.
len
);
dst
.
buf
=
malloc
(
src
.
len
);
AssertFatal
(
dst
.
buf
!=
NULL
,
"Memory exhausted"
);
assert
(
dst
.
buf
!=
NULL
&&
"Memory exhausted"
);
memcpy
(
dst
.
buf
,
src
.
buf
,
src
.
len
);
memcpy
(
dst
.
buf
,
src
.
buf
,
src
.
len
);
dst
.
len
=
src
.
len
;
dst
.
len
=
src
.
len
;
return
dst
;
return
dst
;
...
...
common/utils/minimal_stub.c
View file @
ddec7e75
...
@@ -4,6 +4,9 @@
...
@@ -4,6 +4,9 @@
int
T_stdout
;
int
T_stdout
;
#endif
#endif
struct
configmodule_interface_s
;
struct
configmodule_interface_s
*
uniqCfg
=
NULL
;
void
exit_function
(
const
char
*
file
,
const
char
*
function
,
const
int
line
,
const
char
*
s
,
const
int
assert
)
void
exit_function
(
const
char
*
file
,
const
char
*
function
,
const
int
line
,
const
char
*
s
,
const
int
assert
)
{
{
if
(
assert
)
{
if
(
assert
)
{
...
...
doc/TESTBenches.md
View file @
ddec7e75
...
@@ -109,6 +109,7 @@ information on how the images are built.
...
@@ -109,6 +109,7 @@ information on how the images are built.
-
build image from
`Dockerfile.clang.rhel9`
(compilation only, artifacts not used currently)
-
build image from
`Dockerfile.clang.rhel9`
(compilation only, artifacts not used currently)
-
[
RAN-Ubuntu18-Image-Builder
](
https://jenkins-oai.eurecom.fr/job/RAN-Ubuntu18-Image-Builder/
)
-
[
RAN-Ubuntu18-Image-Builder
](
https://jenkins-oai.eurecom.fr/job/RAN-Ubuntu18-Image-Builder/
)
~BUILD-ONLY ~4G-LTE ~5G-NR
~BUILD-ONLY ~4G-LTE ~5G-NR
-
run formatting check from
`ci-scripts/docker/Dockerfile.formatting.bionic`
-
obelix: Ubuntu 20 image build using docker (Note: builds U20 images while pipeline is named U18!)
-
obelix: Ubuntu 20 image build using docker (Note: builds U20 images while pipeline is named U18!)
-
base image from
`Dockerfile.base.ubuntu20`
-
base image from
`Dockerfile.base.ubuntu20`
-
build image from
`Dockerfile.build.ubuntu20`
, followed by
-
build image from
`Dockerfile.build.ubuntu20`
, followed by
...
@@ -118,6 +119,7 @@ information on how the images are built.
...
@@ -118,6 +119,7 @@ information on how the images are built.
-
target image from
`Dockerfile.nrUE.ubuntu20`
-
target image from
`Dockerfile.nrUE.ubuntu20`
-
target image from
`Dockerfile.lteUE.ubuntu20`
-
target image from
`Dockerfile.lteUE.ubuntu20`
-
target image from
`Dockerfile.lteRU.ubuntu20`
-
target image from
`Dockerfile.lteRU.ubuntu20`
-
build unit tests from
`ci-scripts/docker/Dockerfile.unittest.ubuntu20`
, and run them
#### Image Test pipelines
#### Image Test pipelines
...
...
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