Skip to content
Snippets Groups Projects
Commit d1115ed0 authored by Amin Ben Romdhane's avatar Amin Ben Romdhane
Browse files

Align with new code-analysis docker image

parent 6c64e11d
No related branches found
No related tags found
1 merge request!5Align with new code-analysis docker image
Pipeline #216450 passed
variables:
SOURCE_FOLDER: "src"
include: include:
- project: 'iopsys/gitlab-ci-pipeline' - project: 'iopsys/gitlab-ci-pipeline'
file: '/static-code-analysis.yml' file: '/static-code-analysis.yml'
ref: '0.32' ref: '1.2'
stages: stages:
- static_code_analysis - static_code_analysis
variables:
DEBUG: 'TRUE'
SOURCE_FOLDER: "./src"
FLAWFINDER_OPTIONS: "-m 4 --error-level=5"
CPPCHECK_OPTIONS: "--enable=all --error-exitcode=1"
COMPILE: "./gitlab-ci/compile.sh"
#!/bin/bash #!/bin/bash
echo "Install dependencies for functional test"
pwd
source ./gitlab-ci/shared.sh source ./gitlab-ci/shared.sh
install_bbfd # install bbfdm
install_bbfdm
exec_cmd_verbose make -C ./src
...@@ -11,18 +11,9 @@ function exec_cmd() ...@@ -11,18 +11,9 @@ function exec_cmd()
fi fi
} }
function exec_cmd_verbose() function install_bbfdm()
{ {
echo "executing $@" [ -d "/opt/dev/bbfdm" ] && return 0
if ! $@; then
echo "Failed to execute $@"
exit 1
fi
}
function install_bbfd()
{
[ -d "/opt/dev/bbfdm" ] && rm -rf /opt/dev/bbfdm
if [ -n "${BBFDM_BRANCH}" ]; then if [ -n "${BBFDM_BRANCH}" ]; then
exec_cmd git clone -b ${BBFDM_BRANCH} https://dev.iopsys.eu/bbf/bbfdm.git /opt/dev/bbfdm exec_cmd git clone -b ${BBFDM_BRANCH} https://dev.iopsys.eu/bbf/bbfdm.git /opt/dev/bbfdm
...@@ -33,5 +24,4 @@ function install_bbfd() ...@@ -33,5 +24,4 @@ function install_bbfd()
cd /opt/dev/bbfdm cd /opt/dev/bbfdm
./gitlab-ci/install-dependencies.sh install ./gitlab-ci/install-dependencies.sh install
./gitlab-ci/setup.sh install ./gitlab-ci/setup.sh install
cd -
} }
...@@ -33,10 +33,11 @@ static int browsePacketCaptureResultInst(struct dmctx *dmctx, DMNODE *parent_nod ...@@ -33,10 +33,11 @@ static int browsePacketCaptureResultInst(struct dmctx *dmctx, DMNODE *parent_nod
static void stop_packetcapture_diagnostics(void) static void stop_packetcapture_diagnostics(void)
{ {
char cmd[256] = {0}; char output[256] = {0}, cmd[256] = {0};
snprintf(cmd, sizeof(cmd), "sh %s '{\"proto\":\"both_proto\",\"cancel\":\"1\"}'", PACKET_CAPTURE_DIAGNOSTIC_PATH); snprintf(cmd, sizeof(cmd), "sh %s '{\"proto\":\"both_proto\",\"cancel\":\"1\"}'", PACKET_CAPTURE_DIAGNOSTIC_PATH);
system(cmd);
run_cmd(cmd, output, sizeof(output));
} }
/************************************************************* /*************************************************************
...@@ -90,14 +91,14 @@ int operate_Device_packetCapture(char *refparam, struct dmctx *ctx, void *data, ...@@ -90,14 +91,14 @@ int operate_Device_packetCapture(char *refparam, struct dmctx *ctx, void *data,
if (format[0] != '\0' && bbfdm_validate_string(ctx, format, -1, -1, allowed_format, NULL)) if (format[0] != '\0' && bbfdm_validate_string(ctx, format, -1, -1, allowed_format, NULL))
return USP_FAULT_INVALID_ARGUMENT; return USP_FAULT_INVALID_ARGUMENT;
char *duration = dmjson_get_value((json_object *)value, 1, "Duration"); const char *duration = dmjson_get_value((json_object *)value, 1, "Duration");
if (duration[0] != '\0') { if (duration[0] != '\0') {
if (bbfdm_validate_unsignedInt(ctx, duration, RANGE_ARGS{{"1", NULL}}, 1)) if (bbfdm_validate_unsignedInt(ctx, duration, RANGE_ARGS{{"1", NULL}}, 1))
return USP_FAULT_INVALID_ARGUMENT; return USP_FAULT_INVALID_ARGUMENT;
} else } else
duration = "1"; duration = "1";
char *pack_count = dmjson_get_value((json_object *)value, 1, "PacketCount"); const char *pack_count = dmjson_get_value((json_object *)value, 1, "PacketCount");
if (pack_count[0] != '\0') { if (pack_count[0] != '\0') {
if (bbfdm_validate_unsignedInt(ctx, pack_count, RANGE_ARGS{{0, NULL}}, 1)) if (bbfdm_validate_unsignedInt(ctx, pack_count, RANGE_ARGS{{0, NULL}}, 1))
return USP_FAULT_INVALID_ARGUMENT; return USP_FAULT_INVALID_ARGUMENT;
...@@ -354,7 +355,7 @@ static int set_PacketCapture_Username(char *refparam, struct dmctx *ctx, void *d ...@@ -354,7 +355,7 @@ static int set_PacketCapture_Username(char *refparam, struct dmctx *ctx, void *d
static int get_PacketCapture_Password(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) static int get_PacketCapture_Password(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{ {
*value = ""; *value = dmstrdup("");
return 0; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment