Skip to content

Commit 9c9cddd

Browse files
authored
Merge pull request #209 from wenhui-xie/master
Add NetXDuo regression test.
2 parents 837b032 + c505fcd commit 9c9cddd

File tree

1,828 files changed

+708603
-1998
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,828 files changed

+708603
-1998
lines changed

.devcontainer/devcontainer.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"image": "ghcr.io/tiejunms/azure_rtos_docker",
3+
4+
// Add the IDs of extensions you want installed when the container is created.
5+
"extensions": [
6+
"ms-vscode.cpptools",
7+
"ms-vscode.cmake-tools"
8+
],
9+
10+
"remoteUser": "vscode",
11+
12+
"runArgs": [ "--cap-add=NET_ADMIN"]
13+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This is a basic workflow that is manually triggered
2+
3+
name: regression_test
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the master branch
7+
on:
8+
workflow_dispatch:
9+
push:
10+
branches: [ master ]
11+
pull_request:
12+
branches: [ master ]
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
NetXDuo:
17+
permissions:
18+
contents: read
19+
issues: read
20+
checks: write
21+
pull-requests: write
22+
pages: write
23+
id-token: write
24+
uses: azure-rtos/threadx/.github/workflows/regression_template.yml@master
25+
with:
26+
build_script: ./scripts/build_nxd.sh
27+
test_script: ./scripts/test_nxd.sh
28+
cmake_path: ./test/cmake/netxduo
29+
result_affix: NetXDuo
30+
skip_deploy: true
31+
Deploy:
32+
permissions:
33+
contents: read
34+
issues: read
35+
checks: write
36+
pull-requests: write
37+
pages: write
38+
id-token: write
39+
needs: [NetXDuo]
40+
uses: azure-rtos/threadx/.github/workflows/regression_template.yml@master
41+
with:
42+
skip_test: true
43+
deploy_list: "NetXDuo"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.vscode/
22
_deps/
33
build/
4+
coverage_report/
45
CMakeFiles/
56
CMakeScripts/
67
CMakeLists.txt.user
@@ -11,4 +12,5 @@ cmake_install.cmake
1112
install_manifest.txt
1213
compile_commands.json
1314
CTestTestfile.cmake
15+
.run.sh
1416

addons/azure_iot/nx_azure_iot.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ UINT status;
420420
/* Do nothing if the client is not connected. */
421421
if (client_ptr -> nxd_mqtt_client_state != NXD_MQTT_CLIENT_STATE_CONNECTED)
422422
{
423+
tx_mutex_put(client_ptr -> nxd_mqtt_client_mutex_ptr);
423424
LogError(LogLiteralArgs("MQTT NOT CONNECTED"));
424425
return(NX_AZURE_IOT_DISCONNECTED);
425426
}

addons/azure_iot/nx_azure_iot_adu_agent.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,8 +1745,8 @@ static UINT nx_azure_iot_adu_agent_jws_split(UCHAR *jws, UINT jws_length,
17451745
UCHAR **signature, UINT *signature_length)
17461746
{
17471747

1748-
UCHAR *dot1_pointer;
1749-
UCHAR *dot2_pointer;
1748+
UCHAR *dot1_pointer = jws;
1749+
UCHAR *dot2_pointer = jws;
17501750
UINT dot_count = 0;
17511751
UINT i = 0;
17521752

samples/demo_netxduo_snmp.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,17 @@ UINT status;
453453
if (mib2_mib[i].object_set_callback)
454454
{
455455

456+
/* If the object data type is string. */
457+
if (object_data -> nx_snmp_object_data_type == NX_SNMP_ANS1_OCTET_STRING)
458+
{
459+
460+
/* Check the string length of the object value. */
461+
if (object_data -> nx_snmp_object_octet_string_size > mib2_mib[i].length)
462+
{
463+
return(NX_SNMP_ERROR_TOOBIG);
464+
}
465+
}
466+
456467
/* Yes, call the set function. */
457468
status = (mib2_mib[i].object_set_callback)(mib2_mib[i].object_value_ptr, object_data);
458469
}

samples/demo_snmp_helper.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ ULONG ipDefaultTTL = NX_IP_TIME_TO_LIVE; /* ipDefault
4646
underlying application driver, but for now simple defaults are used. */
4747
ULONG ifLastChange = 2048; /* ifLastChange:TimeTicks RO */
4848
ULONG ifInOctets = 155; /* ifInOctets:Counter RO */
49-
ULONG ifInUcastPkts = 0; /* ifInUcastPkts:Counter RO */
49+
ULONG64 ifInUcastPkts = 0; /* ifInUcastPkts:Counter RO */
5050
UCHAR ifDescr[] = "NetX Physical Interface"; /* ifDescr:OctetString RO */
5151

5252
/* Define the MIB-2 "address translation" group, assuming one address translation. */
@@ -62,31 +62,31 @@ MIB_ENTRY mib2_mib[] = {
6262

6363
/* OBJECT ID OBJECT VARIABLE GET ROUTINE/ GET_OCTET_ROUTINE SET ROUTINE LENGTH */
6464

65-
{(UCHAR *) "1.3.6.1.2.1.1.1.0", sysDescr, nx_snmp_object_string_get, NX_NULL, nx_snmp_object_string_set, 0},
66-
{(UCHAR *) "1.3.6.1.2.1.1.2.0", sysObjectID, nx_snmp_object_id_get, NX_NULL, NX_NULL, 0},
67-
{(UCHAR *) "1.3.6.1.2.1.1.3.0", &sysUpTime, nx_snmp_object_timetics_get, NX_NULL, NX_NULL, 0},
68-
{(UCHAR *) "1.3.6.1.2.1.1.4.0", sysContact, nx_snmp_object_string_get, NX_NULL, nx_snmp_object_string_set, 0},
69-
{(UCHAR *) "1.3.6.1.2.1.1.5.0", sysName, nx_snmp_object_string_get, NX_NULL, nx_snmp_object_string_set, 0},
70-
{(UCHAR *) "1.3.6.1.2.1.1.6.0", sysLocation, nx_snmp_object_string_get, NX_NULL, nx_snmp_object_string_set, 0},
71-
{(UCHAR *) "1.3.6.1.2.1.1.7.0", &sysServices, nx_snmp_object_integer_get, NX_NULL, NX_NULL, 0},
65+
{(UCHAR *) "1.3.6.1.2.1.1.1.0", sysDescr, nx_snmp_object_string_get, NX_NULL, nx_snmp_object_string_set, sizeof(sysDescr)},
66+
{(UCHAR *) "1.3.6.1.2.1.1.2.0", sysObjectID, nx_snmp_object_id_get, NX_NULL, NX_NULL, sizeof(sysObjectID)},
67+
{(UCHAR *) "1.3.6.1.2.1.1.3.0", &sysUpTime, nx_snmp_object_timetics_get, NX_NULL, NX_NULL, sizeof(sysUpTime)},
68+
{(UCHAR *) "1.3.6.1.2.1.1.4.0", sysContact, nx_snmp_object_string_get, NX_NULL, nx_snmp_object_string_set, sizeof(sysContact)},
69+
{(UCHAR *) "1.3.6.1.2.1.1.5.0", sysName, nx_snmp_object_string_get, NX_NULL, nx_snmp_object_string_set, sizeof(sysName)},
70+
{(UCHAR *) "1.3.6.1.2.1.1.6.0", sysLocation, nx_snmp_object_string_get, NX_NULL, nx_snmp_object_string_set, sizeof(sysLocation)},
71+
{(UCHAR *) "1.3.6.1.2.1.1.7.0", &sysServices, nx_snmp_object_integer_get, NX_NULL, NX_NULL, sizeof(sysServices)},
7272

73-
{(UCHAR *) "1.3.6.1.2.1.3.1.1.3.0", &atNetworkAddress, nx_snmp_object_ip_address_get, NX_NULL, nx_snmp_object_ip_address_set, 0},
73+
{(UCHAR *) "1.3.6.1.2.1.3.1.1.3.0", &atNetworkAddress, nx_snmp_object_ip_address_get, NX_NULL, nx_snmp_object_ip_address_set, sizeof(atNetworkAddress)},
7474
#ifdef FEATURE_NX_IPV6
7575
/* Either GET method should work. IPv6 addresses are handled as octet strings and accept any IPv6 address format e.g. addresses with '::'s are accepted as is. */
76-
{(UCHAR *) "1.3.6.1.2.1.3.1.1.3.1", &atIPv6NetworkAddress, nx_snmp_object_ipv6_address_get, NX_NULL, nx_snmp_object_ipv6_address_set, 0},
77-
{(UCHAR *) "1.3.6.1.2.1.3.1.1.3.2", &atIPv6NetworkAddress, NX_NULL, nx_snmp_object_octet_string_get, nx_snmp_object_octet_string_set, 0},
76+
{(UCHAR *) "1.3.6.1.2.1.3.1.1.3.1", &atIPv6NetworkAddress, nx_snmp_object_ipv6_address_get, NX_NULL, nx_snmp_object_ipv6_address_set, sizeof(atIPv6NetworkAddress)},
77+
{(UCHAR *) "1.3.6.1.2.1.3.1.1.3.2", &atIPv6NetworkAddress, NX_NULL, nx_snmp_object_octet_string_get, nx_snmp_object_octet_string_set, sizeof(atIPv6NetworkAddress)},
7878
#endif
7979

80-
{(UCHAR *) "1.3.6.1.2.1.2.2.1.2.0", ifDescr, nx_snmp_object_string_get, NX_NULL, NX_NULL, 0},
81-
{(UCHAR *) "1.3.6.1.2.1.3.1.1.2.0", &atPhysAddress, NX_NULL, nx_snmp_object_octet_string_get, nx_snmp_object_octet_string_set, 0},
82-
{(UCHAR *) "1.3.6.1.2.1.2.2.1.9.0", &ifLastChange, nx_snmp_object_timetics_get, NX_NULL, nx_snmp_object_timetics_set, 0},
83-
{(UCHAR *) "1.3.6.1.2.1.2.2.1.10.0", &ifInOctets, nx_snmp_object_counter_get, NX_NULL, nx_snmp_object_counter_set, 0},
84-
{(UCHAR *) "1.3.6.1.2.1.2.2.1.11.0", &ifInUcastPkts, nx_snmp_object_counter64_get, NX_NULL, nx_snmp_object_counter64_set, 0},
80+
{(UCHAR *) "1.3.6.1.2.1.2.2.1.2.0", ifDescr, nx_snmp_object_string_get, NX_NULL, NX_NULL, sizeof(ifDescr)},
81+
{(UCHAR *) "1.3.6.1.2.1.3.1.1.2.0", &atPhysAddress, NX_NULL, nx_snmp_object_octet_string_get, nx_snmp_object_octet_string_set, sizeof(atPhysAddress)},
82+
{(UCHAR *) "1.3.6.1.2.1.2.2.1.9.0", &ifLastChange, nx_snmp_object_timetics_get, NX_NULL, nx_snmp_object_timetics_set, sizeof(ifLastChange)},
83+
{(UCHAR *) "1.3.6.1.2.1.2.2.1.10.0", &ifInOctets, nx_snmp_object_counter_get, NX_NULL, nx_snmp_object_counter_set, sizeof(ifInOctets)},
84+
{(UCHAR *) "1.3.6.1.2.1.2.2.1.11.0", &ifInUcastPkts, nx_snmp_object_counter64_get, NX_NULL, nx_snmp_object_counter64_set, sizeof(ifInUcastPkts)},
8585

86-
{(UCHAR *) "1.3.6.1.2.1.4.1.0", &ipForwarding, nx_snmp_object_integer_get, NX_NULL, nx_snmp_object_integer_set, 0},
87-
{(UCHAR *) "1.3.6.1.2.1.4.2.0", &ipDefaultTTL, nx_snmp_object_integer_get, NX_NULL, NX_NULL, 0},
86+
{(UCHAR *) "1.3.6.1.2.1.4.1.0", &ipForwarding, nx_snmp_object_integer_get, NX_NULL, nx_snmp_object_integer_set, sizeof(ipForwarding)},
87+
{(UCHAR *) "1.3.6.1.2.1.4.2.0", &ipDefaultTTL, nx_snmp_object_integer_get, NX_NULL, NX_NULL, sizeof(ipDefaultTTL)},
8888

89-
{(UCHAR *) "1.3.6.1.7", (UCHAR *) "1.3.6.1.7", nx_snmp_object_end_of_mib, NX_NULL, NX_NULL, 0},
89+
{(UCHAR *) "1.3.6.1.7", (UCHAR *) "1.3.6.1.7", nx_snmp_object_end_of_mib, NX_NULL, NX_NULL, sizeof("1.3.6.1.7") - 1},
9090
{NX_NULL, NX_NULL, NX_NULL, NX_NULL, NX_NULL, 0}
9191

9292
};

scripts/build_nxd.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#! /bin/bash
2+
3+
$(dirname `realpath $0`)/../test/cmake/netxduo/run.sh build all

scripts/install.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
#
3+
4+
# Remove large folder
5+
rm -rf /opt/hostedtoolcache
6+
7+
# Install necessary softwares for Ubuntu.
8+
9+
sudo dpkg --add-architecture i386
10+
sudo apt-get update
11+
sudo apt-get install -y \
12+
gcc-multilib \
13+
git \
14+
g++ \
15+
python3-pip \
16+
ninja-build \
17+
unifdef \
18+
p7zip-full \
19+
tofrodos \
20+
dos2unix \
21+
gawk \
22+
libssl-dev:i386 \
23+
software-properties-common
24+
25+
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
26+
CODENAME=$(lsb_release -c | cut -f2 -d':' | sed 's/\t//')
27+
apt-add-repository "deb https://apt.kitware.com/ubuntu/ $CODENAME main"
28+
29+
python3 -m pip install --upgrade pip
30+
pip3 install gcovr==4.1
31+
pip install --upgrade cmake
32+

scripts/test_nxd.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#! /bin/bash
2+
3+
CTEST_PARALLEL_LEVEL=4 $(dirname `realpath $0`)/../test/cmake/netxduo/run.sh test all

0 commit comments

Comments
 (0)