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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
OpenXG
OpenXG-RAN
Commits
d0578d77
Commit
d0578d77
authored
Apr 07, 2021
by
Raphael Defosseux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CI] cppcheck analysis in the python framework
Signed-off-by:
Raphael Defosseux
<
raphael.defosseux@eurecom.fr
>
parent
2cfc1a6c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
334 additions
and
6 deletions
+334
-6
ci-scripts/args_parse.py
ci-scripts/args_parse.py
+10
-1
ci-scripts/cls_static_code_analysis.py
ci-scripts/cls_static_code_analysis.py
+192
-0
ci-scripts/html.py
ci-scripts/html.py
+85
-0
ci-scripts/main.py
ci-scripts/main.py
+9
-5
ci-scripts/xml_class_list.yml
ci-scripts/xml_class_list.yml
+1
-0
ci-scripts/xml_files/cppcheck.xml
ci-scripts/xml_files/cppcheck.xml
+37
-0
No files found.
ci-scripts/args_parse.py
View file @
d0578d77
...
...
@@ -41,7 +41,7 @@ import constants as CONST
#-----------------------------------------------------------
def
ArgsParse
(
argvs
,
CiTestObj
,
RAN
,
HTML
,
EPC
,
ldpc
,
CONTAINERS
,
HELP
):
def
ArgsParse
(
argvs
,
CiTestObj
,
RAN
,
HTML
,
EPC
,
ldpc
,
CONTAINERS
,
HELP
,
SCA
):
py_param_file_present
=
False
...
...
@@ -80,6 +80,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP):
HTML
.
ranRepository
=
matchReg
.
group
(
1
)
ldpc
.
ranRepository
=
matchReg
.
group
(
1
)
CONTAINERS
.
ranRepository
=
matchReg
.
group
(
1
)
SCA
.
ranRepository
=
matchReg
.
group
(
1
)
elif
re
.
match
(
'^\-\-eNB_AllowMerge=(.+)$|^\-\-ranAllowMerge=(.+)$'
,
myArgv
,
re
.
IGNORECASE
):
if
re
.
match
(
'^\-\-eNB_AllowMerge=(.+)$'
,
myArgv
,
re
.
IGNORECASE
):
matchReg
=
re
.
match
(
'^\-\-eNB_AllowMerge=(.+)$'
,
myArgv
,
re
.
IGNORECASE
)
...
...
@@ -92,6 +93,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP):
RAN
.
ranAllowMerge
=
True
HTML
.
ranAllowMerge
=
True
CONTAINERS
.
ranAllowMerge
=
True
SCA
.
ranAllowMerge
=
True
elif
re
.
match
(
'^\-\-eNBBranch=(.+)$|^\-\-ranBranch=(.+)$'
,
myArgv
,
re
.
IGNORECASE
):
if
re
.
match
(
'^\-\-eNBBranch=(.+)$'
,
myArgv
,
re
.
IGNORECASE
):
matchReg
=
re
.
match
(
'^\-\-eNBBranch=(.+)$'
,
myArgv
,
re
.
IGNORECASE
)
...
...
@@ -102,6 +104,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP):
HTML
.
ranBranch
=
matchReg
.
group
(
1
)
ldpc
.
ranBranch
=
matchReg
.
group
(
1
)
CONTAINERS
.
ranBranch
=
matchReg
.
group
(
1
)
SCA
.
ranBranch
=
matchReg
.
group
(
1
)
elif
re
.
match
(
'^\-\-eNBCommitID=(.*)$|^\-\-ranCommitID=(.*)$'
,
myArgv
,
re
.
IGNORECASE
):
if
re
.
match
(
'^\-\-eNBCommitID=(.*)$'
,
myArgv
,
re
.
IGNORECASE
):
matchReg
=
re
.
match
(
'^\-\-eNBCommitID=(.*)$'
,
myArgv
,
re
.
IGNORECASE
)
...
...
@@ -112,6 +115,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP):
HTML
.
ranCommitID
=
matchReg
.
group
(
1
)
ldpc
.
ranCommitID
=
matchReg
.
group
(
1
)
CONTAINERS
.
ranCommitID
=
matchReg
.
group
(
1
)
SCA
.
ranCommitID
=
matchReg
.
group
(
1
)
elif
re
.
match
(
'^\-\-eNBTargetBranch=(.*)$|^\-\-ranTargetBranch=(.*)$'
,
myArgv
,
re
.
IGNORECASE
):
if
re
.
match
(
'^\-\-eNBTargetBranch=(.*)$'
,
myArgv
,
re
.
IGNORECASE
):
matchReg
=
re
.
match
(
'^\-\-eNBTargetBranch=(.*)$'
,
myArgv
,
re
.
IGNORECASE
)
...
...
@@ -122,12 +126,14 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP):
HTML
.
ranTargetBranch
=
matchReg
.
group
(
1
)
ldpc
.
ranTargetBranch
=
matchReg
.
group
(
1
)
CONTAINERS
.
ranTargetBranch
=
matchReg
.
group
(
1
)
SCA
.
ranTargetBranch
=
matchReg
.
group
(
1
)
elif
re
.
match
(
'^\-\-eNBIPAddress=(.+)$|^\-\-eNB[1-2]IPAddress=(.+)$'
,
myArgv
,
re
.
IGNORECASE
):
if
re
.
match
(
'^\-\-eNBIPAddress=(.+)$'
,
myArgv
,
re
.
IGNORECASE
):
matchReg
=
re
.
match
(
'^\-\-eNBIPAddress=(.+)$'
,
myArgv
,
re
.
IGNORECASE
)
RAN
.
eNBIPAddress
=
matchReg
.
group
(
1
)
ldpc
.
eNBIpAddr
=
matchReg
.
group
(
1
)
CONTAINERS
.
eNBIPAddress
=
matchReg
.
group
(
1
)
SCA
.
eNBIPAddress
=
matchReg
.
group
(
1
)
elif
re
.
match
(
'^\-\-eNB1IPAddress=(.+)$'
,
myArgv
,
re
.
IGNORECASE
):
matchReg
=
re
.
match
(
'^\-\-eNB1IPAddress=(.+)$'
,
myArgv
,
re
.
IGNORECASE
)
RAN
.
eNB1IPAddress
=
matchReg
.
group
(
1
)
...
...
@@ -142,6 +148,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP):
RAN
.
eNBUserName
=
matchReg
.
group
(
1
)
ldpc
.
eNBUserName
=
matchReg
.
group
(
1
)
CONTAINERS
.
eNBUserName
=
matchReg
.
group
(
1
)
SCA
.
eNBUserName
=
matchReg
.
group
(
1
)
elif
re
.
match
(
'^\-\-eNB1UserName=(.+)$'
,
myArgv
,
re
.
IGNORECASE
):
matchReg
=
re
.
match
(
'^\-\-eNB1UserName=(.+)$'
,
myArgv
,
re
.
IGNORECASE
)
RAN
.
eNB1UserName
=
matchReg
.
group
(
1
)
...
...
@@ -156,6 +163,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP):
RAN
.
eNBPassword
=
matchReg
.
group
(
1
)
ldpc
.
eNBPassWord
=
matchReg
.
group
(
1
)
CONTAINERS
.
eNBPassword
=
matchReg
.
group
(
1
)
SCA
.
eNBPassword
=
matchReg
.
group
(
1
)
elif
re
.
match
(
'^\-\-eNB1Password=(.+)$'
,
myArgv
,
re
.
IGNORECASE
):
matchReg
=
re
.
match
(
'^\-\-eNB1Password=(.+)$'
,
myArgv
,
re
.
IGNORECASE
)
RAN
.
eNB1Password
=
matchReg
.
group
(
1
)
...
...
@@ -170,6 +178,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP):
RAN
.
eNBSourceCodePath
=
matchReg
.
group
(
1
)
ldpc
.
eNBSourceCodePath
=
matchReg
.
group
(
1
)
CONTAINERS
.
eNBSourceCodePath
=
matchReg
.
group
(
1
)
SCA
.
eNBSourceCodePath
=
matchReg
.
group
(
1
)
elif
re
.
match
(
'^\-\-eNB1SourceCodePath=(.+)$'
,
myArgv
,
re
.
IGNORECASE
):
matchReg
=
re
.
match
(
'^\-\-eNB1SourceCodePath=(.+)$'
,
myArgv
,
re
.
IGNORECASE
)
RAN
.
eNB1SourceCodePath
=
matchReg
.
group
(
1
)
...
...
ci-scripts/cls_static_code_analysis.py
0 → 100644
View file @
d0578d77
#/*
# * 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
# */
#---------------------------------------------------------------------
# Python for CI of OAI-eNB + COTS-UE
#
# Required Python Version
# Python 3.x
#
# Required Python Package
# pexpect
#---------------------------------------------------------------------
#-----------------------------------------------------------
# Import
#-----------------------------------------------------------
import
sys
# arg
import
re
# reg
import
logging
import
os
import
time
#-----------------------------------------------------------
# OAI Testing modules
#-----------------------------------------------------------
import
sshconnection
as
SSH
import
helpreadme
as
HELP
import
constants
as
CONST
#-----------------------------------------------------------
# Class Declaration
#-----------------------------------------------------------
class
CppCheckResults
():
def
__init__
(
self
):
self
.
variants
=
[
'xenial'
,
'bionic'
]
self
.
versions
=
[
''
,
''
]
self
.
nbErrors
=
[
0
,
0
]
self
.
nbWarnings
=
[
0
,
0
]
self
.
nbNullPtrs
=
[
0
,
0
]
self
.
nbMemLeaks
=
[
0
,
0
]
self
.
nbUninitVars
=
[
0
,
0
]
self
.
nbInvalidPrintf
=
[
0
,
0
]
self
.
nbModuloAlways
=
[
0
,
0
]
self
.
nbTooManyBitsShift
=
[
0
,
0
]
self
.
nbIntegerOverflow
=
[
0
,
0
]
self
.
nbWrongScanfArg
=
[
0
,
0
]
self
.
nbPtrAddNotNull
=
[
0
,
0
]
self
.
nbOppoInnerCondition
=
[
0
,
0
]
class
StaticCodeAnalysis
():
def
__init__
(
self
):
self
.
ranRepository
=
''
self
.
ranBranch
=
''
self
.
ranAllowMerge
=
False
self
.
ranCommitID
=
''
self
.
ranTargetBranch
=
''
self
.
eNBIPAddress
=
''
self
.
eNBUserName
=
''
self
.
eNBPassword
=
''
self
.
eNBSourceCodePath
=
''
def
CppCheckAnalysis
(
self
,
HTML
):
# if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '':
# HELP.GenericHelp(CONST.Version)
# sys.exit('Insufficient Parameter')
# lIpAddr = self.eNBIPAddress
# lUserName = self.eNBUserName
# lPassWord = self.eNBPassword
# lSourcePath = self.eNBSourceCodePath
#
# if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '':
# HELP.GenericHelp(CONST.Version)
# sys.exit('Insufficient Parameter')
# logging.debug('Building on server: ' + lIpAddr)
# mySSH = SSH.SSHConnection()
# mySSH.open(lIpAddr, lUserName, lPassWord)
#
# self.testCase_id = HTML.testCase_id
#
# # on RedHat/CentOS .git extension is mandatory
# result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository)
# if result is not None:
# full_ran_repo_name = self.ranRepository
# else:
# full_ran_repo_name = self.ranRepository + '.git'
# mySSH.command('mkdir -p ' + lSourcePath, '\$', 5)
# mySSH.command('cd ' + lSourcePath, '\$', 5)
# mySSH.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + full_ran_repo_name + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600)
# # Raphael: here add a check if git clone or git fetch went smoothly
# mySSH.command('git config user.email "jenkins@openairinterface.org"', '\$', 5)
# mySSH.command('git config user.name "OAI Jenkins"', '\$', 5)
#
# mySSH.command('echo ' + lPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30)
# mySSH.command('mkdir -p cmake_targets/log', '\$', 5)
# # if the commit ID is provided use it to point to it
# if self.ranCommitID != '':
# mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 5)
#
# mySSH.command('docker image rm oai-cppcheck:bionic oai-cppcheck:xenial || true', '\$', 60)
# mySSH.command('docker build --tag oai-cppcheck:xenial --file ci-scripts/docker/Dockerfile.cppcheck.xenial . > cmake_targets/log/cppcheck-xenial.txt 2>&1', '\$', 600)
# mySSH.command('sed -e "s@xenial@bionic@" ci-scripts/docker/Dockerfile.cppcheck.xenial > ci-scripts/docker/Dockerfile.cppcheck.bionic', '\$', 6)
# mySSH.command('docker build --tag oai-cppcheck:bionic --file ci-scripts/docker/Dockerfile.cppcheck.bionic . > cmake_targets/log/cppcheck-bionic.txt 2>&1', '\$', 600)
# mySSH.command('docker image rm oai-cppcheck:bionic oai-cppcheck:xenial || true', '\$', 60)
#
# # Analyzing the logs
# mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5)
# mySSH.command('mkdir -p build_log_' + self.testCase_id, '\$', 5)
# mySSH.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5)
# mySSH.close()
#
# mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/build_log_' + self.testCase_id + '/*', '.')
CCR
=
CppCheckResults
()
vId
=
0
for
variant
in
CCR
.
variants
:
if
(
os
.
path
.
isfile
(
'./cppcheck-'
+
variant
+
'.txt'
)):
xmlStart
=
False
with
open
(
'./cppcheck-'
+
variant
+
'.txt'
,
'r'
)
as
logfile
:
for
line
in
logfile
:
ret
=
re
.
search
(
'Unpacking cppcheck \((?P<version>[0-9\.]+)'
,
str
(
line
))
if
ret
is
not
None
:
CCR
.
versions
[
vId
]
=
ret
.
group
(
'version'
)
if
re
.
search
(
'RUN cat cmake_targets/log/cppcheck.xml'
,
str
(
line
))
is
not
None
:
xmlStart
=
True
if
xmlStart
:
if
re
.
search
(
'severity="error"'
,
str
(
line
))
is
not
None
:
CCR
.
nbErrors
[
vId
]
+=
1
if
re
.
search
(
'severity="warning"'
,
str
(
line
))
is
not
None
:
CCR
.
nbWarnings
[
vId
]
+=
1
if
re
.
search
(
'id="memleak"'
,
str
(
line
))
is
not
None
:
CCR
.
nbMemLeaks
[
vId
]
+=
1
if
re
.
search
(
'id="nullPointer"'
,
str
(
line
))
is
not
None
:
CCR
.
nbNullPtrs
[
vId
]
+=
1
if
re
.
search
(
'id="uninitvar"'
,
str
(
line
))
is
not
None
:
CCR
.
nbUninitVars
[
vId
]
+=
1
if
re
.
search
(
'id="invalidPrintfArgType_sint"|id="invalidPrintfArgType_uint"'
,
str
(
line
))
is
not
None
:
CCR
.
nbInvalidPrintf
[
vId
]
+=
1
if
re
.
search
(
'id="moduloAlwaysTrueFalse"'
,
str
(
line
))
is
not
None
:
CCR
.
nbModuloAlways
[
vId
]
+=
1
if
re
.
search
(
'id="shiftTooManyBitsSigned"'
,
str
(
line
))
is
not
None
:
CCR
.
nbTooManyBitsShift
[
vId
]
+=
1
if
re
.
search
(
'id="integerOverflow"'
,
str
(
line
))
is
not
None
:
CCR
.
nbIntegerOverflow
[
vId
]
+=
1
if
re
.
search
(
'id="wrongPrintfScanfArgNum"|id="invalidScanfArgType_int"'
,
str
(
line
))
is
not
None
:
CCR
.
nbWrongScanfArg
[
vId
]
+=
1
if
re
.
search
(
'id="pointerAdditionResultNotNull"'
,
str
(
line
))
is
not
None
:
CCR
.
nbPtrAddNotNull
[
vId
]
+=
1
if
re
.
search
(
'id="oppositeInnerCondition"'
,
str
(
line
))
is
not
None
:
CCR
.
nbOppoInnerCondition
[
vId
]
+=
1
logging
.
debug
(
'======== Variant '
+
variant
+
' - '
+
CCR
.
versions
[
vId
]
+
' ========'
)
logging
.
debug
(
' '
+
str
(
CCR
.
nbErrors
[
vId
])
+
' errors'
)
logging
.
debug
(
' '
+
str
(
CCR
.
nbWarnings
[
vId
])
+
' warnings'
)
logging
.
debug
(
' -- Details --'
)
logging
.
debug
(
' Memory leak: '
+
str
(
CCR
.
nbMemLeaks
[
vId
]))
logging
.
debug
(
' Possible null pointer deference: '
+
str
(
CCR
.
nbNullPtrs
[
vId
]))
logging
.
debug
(
' Uninitialized variable: '
+
str
(
CCR
.
nbUninitVars
[
vId
]))
logging
.
debug
(
' Undefined behaviour shifting: '
+
str
(
CCR
.
nbTooManyBitsShift
[
vId
]))
logging
.
debug
(
' Signed integer overflow: '
+
str
(
CCR
.
nbIntegerOverflow
[
vId
]))
logging
.
debug
(
''
)
logging
.
debug
(
' Printf formatting issue: '
+
str
(
CCR
.
nbInvalidPrintf
[
vId
]))
logging
.
debug
(
' Modulo result is predetermined: '
+
str
(
CCR
.
nbModuloAlways
[
vId
]))
logging
.
debug
(
' Opposite Condition -> dead code: '
+
str
(
CCR
.
nbOppoInnerCondition
[
vId
]))
logging
.
debug
(
' Wrong Scanf Nb Args: '
+
str
(
CCR
.
nbWrongScanfArg
[
vId
]))
logging
.
debug
(
''
)
vId
+=
1
HTML
.
CreateHtmlTestRow
(
'N/A'
,
'OK'
,
CONST
.
ALL_PROCESSES_OK
)
HTML
.
CreateHtmlTestRowCppCheckResults
(
CCR
)
logging
.
info
(
'
\u001B
[1m Static Code Analysis Pass
\u001B
[0m'
)
return
0
ci-scripts/html.py
View file @
d0578d77
...
...
@@ -479,3 +479,88 @@ class HTMLManagement():
self
.
htmlFile
.
write
(
' </tr>
\n
'
)
self
.
htmlFile
.
close
()
def
CreateHtmlTestRowCppCheckResults
(
self
,
CCR
):
if
(
self
.
htmlFooterCreated
or
(
not
self
.
htmlHeaderCreated
)):
return
self
.
htmlFile
=
open
(
'test_results.html'
,
'a'
)
vId
=
0
for
version
in
CCR
.
versions
:
self
.
htmlFile
.
write
(
' <tr bgcolor = "#F0F0F0" >
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan='
+
str
(
5
+
self
.
htmlUEConnected
)
+
'><b> Results for cppcheck v '
+
version
+
' </b></td>
\n
'
)
self
.
htmlFile
.
write
(
' </tr>
\n
'
)
self
.
htmlFile
.
write
(
' <tr>
\n
'
)
self
.
htmlFile
.
write
(
' <td></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan=2 bgcolor = "lightcyan" ><b> NB ERRORS</b></td>
\n
'
)
if
CCR
.
nbErrors
[
vId
]
==
0
:
myColor
=
'lightgreen'
elif
CCR
.
nbErrors
[
vId
]
<
20
:
myColor
=
'orange'
else
:
myColor
=
'lightcoral'
self
.
htmlFile
.
write
(
' <td colspan='
+
str
(
2
+
self
.
htmlUEConnected
)
+
' bgcolor = "'
+
myColor
+
'"><b>'
+
str
(
CCR
.
nbErrors
[
vId
])
+
'</b></td>
\n
'
)
self
.
htmlFile
.
write
(
' </tr>
\n
'
)
self
.
htmlFile
.
write
(
' <tr>
\n
'
)
self
.
htmlFile
.
write
(
' <td></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan=2 bgcolor = "lightcyan" ><b> NB WARNINGS</b></td>
\n
'
)
if
CCR
.
nbWarnings
[
vId
]
==
0
:
myColor
=
'lightgreen'
elif
CCR
.
nbWarnings
[
vId
]
<
20
:
myColor
=
'orange'
else
:
myColor
=
'lightcoral'
self
.
htmlFile
.
write
(
' <td colspan='
+
str
(
2
+
self
.
htmlUEConnected
)
+
' bgcolor = "'
+
myColor
+
'"><b>'
+
str
(
CCR
.
nbWarnings
[
vId
])
+
'</b></td>
\n
'
)
self
.
htmlFile
.
write
(
' </tr>
\n
'
)
self
.
htmlFile
.
write
(
' <tr bgcolor = "#F0F0F0" >
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan='
+
str
(
5
+
self
.
htmlUEConnected
)
+
'> ----------------- </td>
\n
'
)
self
.
htmlFile
.
write
(
' </tr>
\n
'
)
self
.
htmlFile
.
write
(
' <tr>
\n
'
)
self
.
htmlFile
.
write
(
' <td></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan=2 bgcolor = "lightcyan" ><b> Memory leak</b></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan='
+
str
(
2
+
self
.
htmlUEConnected
)
+
'>'
+
str
(
CCR
.
nbMemLeaks
[
vId
])
+
'</td>
\n
'
)
self
.
htmlFile
.
write
(
' </tr>
\n
'
)
self
.
htmlFile
.
write
(
' <tr>
\n
'
)
self
.
htmlFile
.
write
(
' <td></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan=2 bgcolor = "lightcyan" ><b> Possible null pointer deference</b></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan='
+
str
(
2
+
self
.
htmlUEConnected
)
+
'>'
+
str
(
CCR
.
nbNullPtrs
[
vId
])
+
'</td>
\n
'
)
self
.
htmlFile
.
write
(
' </tr>
\n
'
)
self
.
htmlFile
.
write
(
' <tr>
\n
'
)
self
.
htmlFile
.
write
(
' <td></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan=2 bgcolor = "lightcyan" ><b> Uninitialized variable</b></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan='
+
str
(
2
+
self
.
htmlUEConnected
)
+
'>'
+
str
(
CCR
.
nbUninitVars
[
vId
])
+
'</td>
\n
'
)
self
.
htmlFile
.
write
(
' </tr>
\n
'
)
self
.
htmlFile
.
write
(
' <tr>
\n
'
)
self
.
htmlFile
.
write
(
' <td></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan=2 bgcolor = "lightcyan" ><b> Undefined behaviour shifting</b></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan='
+
str
(
2
+
self
.
htmlUEConnected
)
+
'>'
+
str
(
CCR
.
nbTooManyBitsShift
[
vId
])
+
'</td>
\n
'
)
self
.
htmlFile
.
write
(
' </tr>
\n
'
)
self
.
htmlFile
.
write
(
' <tr>
\n
'
)
self
.
htmlFile
.
write
(
' <td></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan=2 bgcolor = "lightcyan" ><b> Signed integer overflow</b></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan='
+
str
(
2
+
self
.
htmlUEConnected
)
+
'>'
+
str
(
CCR
.
nbIntegerOverflow
[
vId
])
+
'</td>
\n
'
)
self
.
htmlFile
.
write
(
' </tr>
\n
'
)
self
.
htmlFile
.
write
(
' <tr bgcolor = "#F0F0F0" >
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan='
+
str
(
5
+
self
.
htmlUEConnected
)
+
'> </td>
\n
'
)
self
.
htmlFile
.
write
(
' </tr>
\n
'
)
self
.
htmlFile
.
write
(
' <tr>
\n
'
)
self
.
htmlFile
.
write
(
' <td></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan=2 bgcolor = "lightcyan" ><b> Printf formatting issues</b></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan='
+
str
(
2
+
self
.
htmlUEConnected
)
+
'>'
+
str
(
CCR
.
nbInvalidPrintf
[
vId
])
+
'</td>
\n
'
)
self
.
htmlFile
.
write
(
' </tr>
\n
'
)
self
.
htmlFile
.
write
(
' <tr>
\n
'
)
self
.
htmlFile
.
write
(
' <td></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan=2 bgcolor = "lightcyan" ><b> Modulo result is predetermined</b></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan='
+
str
(
2
+
self
.
htmlUEConnected
)
+
'>'
+
str
(
CCR
.
nbModuloAlways
[
vId
])
+
'</td>
\n
'
)
self
.
htmlFile
.
write
(
' </tr>
\n
'
)
self
.
htmlFile
.
write
(
' <tr>
\n
'
)
self
.
htmlFile
.
write
(
' <td></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan=2 bgcolor = "lightcyan" ><b> Opposite Condition -> dead code</b></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan='
+
str
(
2
+
self
.
htmlUEConnected
)
+
'>'
+
str
(
CCR
.
nbOppoInnerCondition
[
vId
])
+
'</td>
\n
'
)
self
.
htmlFile
.
write
(
' </tr>
\n
'
)
self
.
htmlFile
.
write
(
' <tr>
\n
'
)
self
.
htmlFile
.
write
(
' <td></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan=2 bgcolor = "lightcyan" ><b> Wrong Scanf Nb Args</b></td>
\n
'
)
self
.
htmlFile
.
write
(
' <td colspan='
+
str
(
2
+
self
.
htmlUEConnected
)
+
'>'
+
str
(
CCR
.
nbWrongScanfArg
[
vId
])
+
'</td>
\n
'
)
self
.
htmlFile
.
write
(
' </tr>
\n
'
)
vId
+=
1
self
.
htmlFile
.
close
()
ci-scripts/main.py
View file @
d0578d77
...
...
@@ -42,6 +42,7 @@ import cls_oaicitest #main class for OAI CI test framework
import
cls_physim
#class PhySim for physical simulators build and test
import
cls_cots_ue
#class CotsUe for Airplane mode control
import
cls_containerize
#class Containerize for all container-based operations on RAN/UE objects
import
cls_static_code_analysis
#class for static code analysis
import
sshconnection
...
...
@@ -378,6 +379,7 @@ EPC = epc.EPCManagement()
RAN
=
ran
.
RANManagement
()
HTML
=
html
.
HTMLManagement
()
CONTAINERS
=
cls_containerize
.
Containerize
()
SCA
=
cls_static_code_analysis
.
StaticCodeAnalysis
()
ldpc
=
cls_physim
.
PhySim
()
#create an instance for LDPC test using GPU or CPU build
...
...
@@ -388,7 +390,7 @@ ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU b
#-----------------------------------------------------------
import
args_parse
py_param_file_present
,
py_params
,
mode
=
args_parse
.
ArgsParse
(
sys
.
argv
,
CiTestObj
,
RAN
,
HTML
,
EPC
,
ldpc
,
CONTAINERS
,
HELP
)
py_param_file_present
,
py_params
,
mode
=
args_parse
.
ArgsParse
(
sys
.
argv
,
CiTestObj
,
RAN
,
HTML
,
EPC
,
ldpc
,
CONTAINERS
,
HELP
,
SCA
)
...
...
@@ -741,6 +743,8 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re
CONTAINERS
.
DeployObject
(
HTML
,
EPC
)
elif
action
==
'Undeploy_Object'
:
CONTAINERS
.
UndeployObject
(
HTML
,
RAN
)
elif
action
==
'Cppcheck_Analysis'
:
SCA
.
CppCheckAnalysis
(
HTML
)
else
:
sys
.
exit
(
'Invalid class (action) from xml'
)
if
not
RAN
.
prematureExit
:
...
...
ci-scripts/xml_class_list.yml
View file @
d0578d77
...
...
@@ -37,3 +37,4 @@
-
Build_Image
-
Deploy_Object
-
Undeploy_Object
-
Cppcheck_Analysis
ci-scripts/xml_files/cppcheck.xml
0 → 100644
View file @
d0578d77
<!--
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-tab
</htmlTabRef>
<htmlTabName>
CPPCHECK Analysis
</htmlTabName>
<htmlTabIcon>
wrench
</htmlTabIcon>
<TestCaseRequestedList>
000001
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
<testCase
id=
"000001"
>
<class>
Cppcheck_Analysis
</class>
<desc>
Static Code Analysis with cppcheck
</desc>
</testCase>
</testCaseList>
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