Commit 6071beb4 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'fix-warnings' into 'develop'

Fixing compilation warnings and enhance CI scripts

See merge request oai/cn5g/oai-cn5g-amf!26
parents 415a6342 b3571957
......@@ -36,6 +36,7 @@ source $THIS_SCRIPT_PATH/build_helper.fb_folly
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_cpprestsdk_from_git() {
echo "Starting to install cpprestsdk"
if [ $1 -eq 0 ]; then
read -p "Do you want to install C++ REST SDK ? <y/N> " prompt
OPTION="-y"
......@@ -73,6 +74,7 @@ install_cpprestsdk_from_git() {
$SUDO ldconfig -v
popd
fi
echo "cpprestsdk installation complete"
return 0
}
......@@ -80,6 +82,7 @@ install_cpprestsdk_from_git() {
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_fmt() {
echo "Starting to install fmt"
if [ $1 -eq 0 ]; then
read -p "Do you want to install open-source formatting library for C++ ? <y/N> " prompt
OPTION=""
......@@ -108,6 +111,7 @@ install_fmt() {
cd /tmp
rm -rf /tmp/fmt*
fi
echo "fmt installation complete"
return 0
}
......@@ -115,6 +119,7 @@ install_fmt() {
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_spdlog_from_git() {
echo "Starting to install spdlog"
if [ $1 -eq 0 ]; then
read -p "Do you want to install spdlog ? <y/N> " prompt
OPTION=""
......@@ -147,6 +152,7 @@ install_spdlog_from_git() {
sed -i '/#define SPDLOG_ENABLE_SYSLOG/s/^\/\///g' include/spdlog/tweakme.h
popd
fi
echo "spdlog installation complete"
return 0
}
......@@ -154,6 +160,7 @@ install_spdlog_from_git() {
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_pistache_from_git() {
echo "Starting to install pistache"
if [ $1 -eq 0 ]; then
read -p "Do you want to install Pistache ? <y/N> " prompt
OPTION="-y"
......@@ -196,6 +203,7 @@ install_pistache_from_git() {
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
echo "pistache installation complete"
return 0
}
......@@ -203,6 +211,7 @@ install_pistache_from_git() {
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_nlohmann_from_git() {
echo "Starting to install Nlohmann Json"
if [ $1 -eq 0 ]; then
read -p "Do you want to install Nlohmann Json ? <y/N> " prompt
OPTION=""
......@@ -241,6 +250,7 @@ install_nlohmann_from_git() {
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
echo "Nlohmann Json installation complete"
return 0
}
......@@ -380,6 +390,7 @@ check_install_amf_deps(){
echo "Install distro libs"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
echo "distro libs installation complete"
install_cpprestsdk_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
......
......@@ -31,6 +31,7 @@ source $THIS_SCRIPT_PATH/build_helper
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_fb_folly_from_source(){
echo "Starting to install folly"
if [ $1 -eq 0 ]; then
OPTION=""
read -p "Do you want to install FaceBook folly (github)? <y/N> " prompt
......@@ -49,7 +50,9 @@ install_fb_folly_from_source(){
then
if [[ "$OS_BASEDISTRO" == "fedora" ]]; then
$SUDO $INSTALLER install $OPTION \
gcc-c++ \
$CMAKE \
make \
boost-devel \
libevent-devel \
double-conversion-devel \
......@@ -136,6 +139,6 @@ install_fb_folly_from_source(){
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
echo_success "End of folly installation"
echo_success "folly installation complete"
return 0
}
......@@ -375,7 +375,7 @@ class HtmlReport():
def buildSummaryFooter(self):
self.file.write(' </table>\n')
self.file.write(' <br>\n')
if self.nb_warnings > 0:
if len(self.warning_rows) > 0:
self.file.write(' <h3>Compilation Warnings Details</h3>\n')
self.file.write(' <button data-toggle="collapse" data-target="#oai-compilation-details">Details for Compilation Errors and Warnings </button>\n')
self.file.write(' <div id="oai-compilation-details" class="collapse">\n')
......@@ -471,6 +471,8 @@ class HtmlReport():
pistache_build_status = False
json_build_start = False
json_build_status = False
cpprest_build_start = False
cpprest_build_status = False
base_image = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile:
for line in logfile:
......@@ -487,33 +489,43 @@ class HtmlReport():
result = re.search('AMF deps installation successful', line)
if result is not None:
status = True
result = re.search('Install fmt from source', line)
result = re.search('distro libs installation complete', line)
if result is not None:
package_install = True
fmt_build_start = True
result = re.search('Installing: /usr/local/lib/pkgconfig/fmt.pc', line)
result = re.search('Starting to install cpprestsdk', line)
if result is not None:
cpprest_build_start = True
result = re.search('cpprestsdk installation complete', line)
if result is not None and cpprest_build_start:
cpprest_build_status = True
result = re.search('Starting to install fmt', line)
if result is not None:
fmt_build_start = True
result = re.search('fmt installation complete', line)
if result is not None and fmt_build_start:
fmt_build_status = True
result = re.search('Cloning into \'folly\'', line)
result = re.search('Starting to install folly', line)
if result is not None:
folly_build_start = True
result = re.search('Installing: /usr/local/lib/libfollybenchmark.a', line)
if result is not None:
result = re.search('folly installation complete', line)
if result is not None and folly_build_start:
folly_build_status = True
result = re.search('Install spdlog from', line)
result = re.search('Starting to install spdlog', line)
if result is not None:
spdlog_build_start = True
result = re.search('Install Pistache from', line)
if result is not None:
result = re.search('spdlog installation complete', line)
if result is not None and spdlog_build_start:
spdlog_build_status = True
pistache_build_start = True
result = re.search('Installing: /usr/local/lib/libpistache.a', line)
result = re.search('Starting to install pistache', line)
if result is not None:
pistache_build_start = True
result = re.search('pistache installation complete', line)
if result is not None and pistache_build_start:
pistache_build_status = True
result = re.search('Install Nlohmann Json', line)
result = re.search('Starting to install Nlohmann Json', line)
if result is not None:
json_build_status = True
result = re.search('Installing: /usr/local/lib/cmake/nlohmann_json/nlohmann_jsonTargets.cmake', line)
result = re.search('Nlohmann Json installation complete', line)
if result is not None:
json_build_status = True
logfile.close()
......@@ -533,6 +545,12 @@ class HtmlReport():
cell_msg += ' ** Packages Installation: OK\n'
else:
cell_msg += ' ** Packages Installation: KO\n'
if base_image:
cell_msg += ' ** cpprestsdk Installation: N/A\n'
elif cpprest_build_status:
cell_msg += ' ** cpprestsdk Installation: OK\n'
else:
cell_msg += ' ** cpprestsdk Installation: KO\n'
if base_image:
cell_msg += ' ** fmt Installation: N/A\n'
elif fmt_build_status:
......@@ -668,6 +686,11 @@ class HtmlReport():
linenumber = re.sub(':[0-9]*:',"", linenumber)
error_warning_status = re.sub(':',"", wordsList[1])
error_warning_msg = re.sub('^.*' + error_warning_status + ':', '', correctLine)
if nb_warnings == 0 and variant == 'docker':
self.warning_rows += '<tr><td colspan="4" align = "center" bgcolor = "LightGray"><b>Ubuntu 18</b></td></tr>\n'
if nb_warnings == 0 and variant == 'podman':
self.warning_rows += '<tr><td colspan="4" align = "center" bgcolor = "LightGray"><b>RHEL 8</b></td></tr>\n'
nb_warnings += 1
self.warning_rows += '<tr><td>' + filename + '</td><td>' + linenumber + '</td><td>' + error_warning_status + '</td><td>' + error_warning_msg + '</td></tr>\n'
logfile.close()
......
......@@ -59,15 +59,6 @@ RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.pr
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
# cpprest package install
RUN git clone https://github.com/Microsoft/cpprestsdk.git
RUN cd cpprestsdk && \
git submodule update --init && \
mkdir build && cd build && \
cmake3 -G Ninja .. -DCMAKE_BUILD_TYPE=Release && \
ninja install && \
ldconfig -v
# Copying source code
WORKDIR /openair-amf/
COPY . /openair-amf
......
......@@ -47,7 +47,7 @@ class ABBA {
private:
uint8_t _iei;
uint8_t _length;
uint8_t _value[255];
uint8_t _value[256];
};
} // namespace nas
......
......@@ -79,9 +79,9 @@ static const long asn_VAL_7_Ngap_optional = 0;
static const long asn_VAL_8_Ngap_id_UL_NGU_UP_TNLInformation = 139;
static const long asn_VAL_8_Ngap_reject = 0;
static const long asn_VAL_8_Ngap_mandatory = 2;
static const long asn_VAL_9_Ngap_id_AdditionalUL_NGU_UP_TNLInformation = 126;
static const long asn_VAL_9_Ngap_reject = 0;
static const long asn_VAL_9_Ngap_optional = 0;
// static const long asn_VAL_9_Ngap_id_AdditionalUL_NGU_UP_TNLInformation = 126;
// static const long asn_VAL_9_Ngap_reject = 0;
// static const long asn_VAL_9_Ngap_optional = 0;
static const long asn_VAL_10_Ngap_id_DataForwardingNotPossible = 127;
static const long asn_VAL_10_Ngap_reject = 0;
static const long asn_VAL_10_Ngap_optional = 0;
......@@ -1146,7 +1146,7 @@ asn_enc_rval_t CHOICE_encode_aper(
return elm->type->op->aper_encoder(
elm->type, elm->encoding_constraints.per_constraints, memb_ptr, po);
} else {
} else if (ct) {
asn_enc_rval_t rval;
if (specs->ext_start == -1) ASN__ENCODE_FAILED;
if (aper_put_nsnnwn(po, ct->range_bits, present - specs->ext_start))
......@@ -1156,6 +1156,8 @@ asn_enc_rval_t CHOICE_encode_aper(
ASN__ENCODE_FAILED;
rval.encoded = 0;
ASN__ENCODED_OK(rval);
} else {
ASN__ENCODE_FAILED;
}
}
......
......@@ -122,6 +122,7 @@ void UEContextReleaseCompleteMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
//------------------------------------------------------------------------------
uint32_t UEContextReleaseCompleteMsg::getRanUeNgapId() const {
if (ranUeNgapId) return ranUeNgapId->getRanUeNgapId();
return (uint32_t) 0;
}
//------------------------------------------------------------------------------
......
......@@ -164,7 +164,8 @@ int balloc(bstring b, int olen) {
#if defined(BSTRLIB_TEST_CANARY)
if (len > b->slen + 1) {
memchr(b->data + b->slen + 1, 'X', len - (b->slen + 1));
if ((memchr(b->data + b->slen + 1, 'X', len - (b->slen + 1))) == NULL)
return BSTR_ERR;
}
#endif
}
......@@ -218,7 +219,8 @@ bstring bfromcstr(const char* str) {
b = (bstring) bstr__alloc(sizeof(struct tagbstring));
if (NULL == b) return NULL;
b->slen = (int) j;
if (NULL == (b->data = (unsigned char*) bstr__alloc(b->mlen = i))) {
b->data = (unsigned char*) bstr__alloc(b->mlen = i);
if (b->data == NULL) {
bstr__free(b);
return NULL;
}
......@@ -1588,7 +1590,8 @@ int binsertblk(
/* Aliasing case */
if (((size_t)((unsigned char*) blk + len)) >= ((size_t) b->data) &&
((size_t) blk) < ((size_t)(b->data + b->mlen))) {
if (NULL == (aux = (unsigned char*) bstr__alloc(len))) return BSTR_ERR;
aux = (unsigned char*) bstr__alloc(len);
if (aux == NULL) return BSTR_ERR;
bstr__memcpy(aux, blk, len);
}
......@@ -2133,6 +2136,9 @@ int bsreadlna(bstring r, struct bStream* s, char terminator) {
int i, l, ret, rlo;
char* b;
struct tagbstring x;
x.mlen = 0;
x.slen = 0;
x.data = NULL;
if (s == NULL || s->buff == NULL || r == NULL || r->mlen <= 0 ||
r->slen < 0 || r->mlen < r->slen)
......@@ -2201,6 +2207,9 @@ int bsreadlnsa(bstring r, struct bStream* s, const_bstring term) {
unsigned char* b;
struct tagbstring x;
struct charField cf;
x.mlen = 0;
x.slen = 0;
x.data = NULL;
if (s == NULL || s->buff == NULL || r == NULL || term == NULL ||
term->data == NULL || r->mlen <= 0 || r->slen < 0 || r->mlen < r->slen)
......@@ -2470,7 +2479,10 @@ bstring bjoinblk(const struct bstrList* bl, const void* blk, int len) {
* NULL is returned, otherwise a bstring with the correct result is returned.
*/
bstring bjoin(const struct bstrList* bl, const_bstring sep) {
if (sep != NULL && (sep->slen < 0 || sep->data == NULL)) return NULL;
if (sep == NULL)
return NULL;
else if (sep->slen < 0 || sep->data == NULL)
return NULL;
return bjoinblk(bl, sep->data, sep->slen);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment