Skip to content

Commit

Permalink
[Group] Add multicast listening on linux (#12342)
Browse files Browse the repository at this point in the history
* Add multicast listening on linux
  • Loading branch information
jepenven-silabs authored and pull[bot] committed Jan 27, 2022
1 parent 986de8e commit 4353368
Show file tree
Hide file tree
Showing 19 changed files with 199 additions and 149 deletions.
67 changes: 44 additions & 23 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ on:
workflow_dispatch:

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }}
group:
${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name ==
'pull_request' && github.event.number) || (github.event_name ==
'workflow_dispatch' && github.run_number) || github.sha }}
cancel-in-progress: true

jobs:
Expand All @@ -29,9 +32,9 @@ jobs:
timeout-minutes: 60

strategy:
matrix:
build_variant: [no-ble-tsan]
chip_tool: ["", -same-event-loop]
matrix:
build_variant: [no-ble-tsan]
chip_tool: ["", -same-event-loop]
env:
BUILD_VARIANT: ${{matrix.build_variant}}
CHIP_TOOL_VARIANT: ${{matrix.chip_tool}}
Expand All @@ -50,7 +53,9 @@ jobs:
uses: actions/checkout@v2
with:
submodules: true
- name: Try to ensure the directories for core dumping exist and we can write them.
- name:
Try to ensure the directories for core dumping exist and we
can write them.
run: |
mkdir /tmp/cores || true
sysctl -w kernel.core_pattern=/tmp/cores/core.%u.%p.%t || true
Expand All @@ -62,17 +67,19 @@ jobs:
uses: actions/upload-artifact@v2
if: ${{ always() }} && ${{ !env.ACT }}
with:
name: bootstrap-logs-linux-${{ matrix.type }}-${{ matrix.eventloop }}
name:
bootstrap-logs-linux-${{ matrix.type }}-${{
matrix.eventloop }}
path: |
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
- name: Build Apps
timeout-minutes: 20
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target linux-x64-chip-tool-${BUILD_VARIANT}${CHIP_TOOL_VARIANT} \
--target linux-x64-all-clusters-${BUILD_VARIANT} \
--target linux-x64-all-clusters-${BUILD_VARIANT}-test-group \
--target linux-x64-tv-app-${BUILD_VARIANT} \
build \
--copy-artifacts-to objdir-clone \
Expand All @@ -85,22 +92,26 @@ jobs:
--chip-tool ./out/linux-x64-chip-tool-${BUILD_VARIANT}${CHIP_TOOL_VARIANT}/chip-tool \
run \
--iterations 1 \
--all-clusters-app ./out/linux-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \
--all-clusters-app ./out/linux-x64-all-clusters-${BUILD_VARIANT}-test-group/chip-all-clusters-app \
--tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
"
- name: Uploading core files
uses: actions/upload-artifact@v2
if: ${{ failure() }} && ${{ !env.ACT }}
with:
name: crash-core-linux-${{ matrix.type }}-${{ matrix.eventloop }}
name:
crash-core-linux-${{ matrix.type }}-${{ matrix.eventloop
}}
path: /tmp/cores/
# Cores are big; don't hold on to them too long.
retention-days: 5
- name: Uploading objdir for debugging
uses: actions/upload-artifact@v2
if: ${{ failure() }} && ${{ !env.ACT }}
with:
name: crash-objdir-linux-${{ matrix.type }}-${{ matrix.eventloop }}
name:
crash-objdir-linux-${{ matrix.type }}-${{ matrix.eventloop
}}
path: objdir-clone/
# objdirs are big; don't hold on to them too long.
retention-days: 5
Expand All @@ -109,9 +120,9 @@ jobs:
timeout-minutes: 60

strategy:
matrix:
build_variant: [no-ble-tsan, no-ble-asan]
chip_tool: ["", -same-event-loop]
matrix:
build_variant: [no-ble-tsan, no-ble-asan]
chip_tool: ["", -same-event-loop]
env:
BUILD_VARIANT: ${{matrix.build_variant}}
CHIP_TOOL_VARIANT: ${{matrix.chip_tool}}
Expand All @@ -127,7 +138,9 @@ jobs:
- name: Setup Environment
# coreutils for stdbuf
run: brew install openssl pkg-config coreutils
- name: Try to ensure the directories for core dumping and diagnostic log collection exist and we can write them.
- name:
Try to ensure the directories for core dumping and diagnostic
log collection exist and we can write them.
run: |
sudo chown ${USER} /cores || true
mkdir -p ~/Library/Logs/DiagnosticReports || true
Expand All @@ -147,10 +160,12 @@ jobs:
uses: actions/upload-artifact@v2
if: ${{ always() }} && ${{ !env.ACT }}
with:
name: bootstrap-logs-darwin-${{ matrix.type }}-${{ matrix.eventloop }}
name:
bootstrap-logs-darwin-${{ matrix.type }}-${{
matrix.eventloop }}
path: |
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
- name: Build Apps
timeout-minutes: 20
run: |
Expand All @@ -167,7 +182,7 @@ jobs:
./scripts/run_in_build_env.sh \
"./scripts/tests/run_test_suite.py \
--chip-tool ./out/darwin-x64-chip-tool-${BUILD_VARIANT}${CHIP_TOOL_VARIANT}/chip-tool \
--target-skip-glob 'TV*' \
--target-skip-glob '{TestGroupMessaging,TV_*}' \
run \
--iterations 1 \
--all-clusters-app ./out/darwin-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \
Expand All @@ -176,21 +191,27 @@ jobs:
uses: actions/upload-artifact@v2
if: ${{ failure() }} && ${{ !env.ACT }}
with:
name: crash-core-darwin-${{ matrix.type }}-${{ matrix.eventloop }}
name:
crash-core-darwin-${{ matrix.type }}-${{ matrix.eventloop
}}
path: /cores/
# Cores are big; don't hold on to them too long.
retention-days: 5
- name: Uploading diagnostic logs
uses: actions/upload-artifact@v2
if: ${{ failure() }} && ${{ !env.ACT }}
with:
name: crash-log-darwin-${{ matrix.type }}-${{ matrix.eventloop }}
name:
crash-log-darwin-${{ matrix.type }}-${{ matrix.eventloop
}}
path: ~/Library/Logs/DiagnosticReports/
- name: Uploading objdir for debugging
uses: actions/upload-artifact@v2
if: ${{ failure() }} && ${{ !env.ACT }}
with:
name: crash-objdir-darwin-${{ matrix.type }}-${{ matrix.eventloop }}
name:
crash-objdir-darwin-${{ matrix.type }}-${{
matrix.eventloop }}
path: objdir-clone/
# objdirs are big; don't hold on to them too long.
retention-days: 5
1 change: 1 addition & 0 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ def HostTargets():
HostBuildVariant(name="no-ble", enable_ble=False),
HostBuildVariant(name="tsan", conflicts=['asan'], use_tsan=True),
HostBuildVariant(name="asan", conflicts=['tsan'], use_asan=True),
HostBuildVariant(name="test-group", test_group=True),
HostBuildVariant(name="same-event-loop",
validator=AcceptNameWithSubstring('-chip-tool'), separate_event_loop=False),
]
Expand Down
8 changes: 6 additions & 2 deletions scripts/build/builders/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def PlatformName(self):
class HostBuilder(GnBuilder):

def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ipv4=True,
enable_ble=True, use_tsan=False, use_asan=False, separate_event_loop=True
):
enable_ble=True, use_tsan=False, use_asan=False, separate_event_loop=True,
test_group=False):
super(HostBuilder, self).__init__(
root=os.path.join(root, 'examples', app.ExamplePath()),
runner=runner)
Expand All @@ -131,6 +131,10 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ip
if not separate_event_loop:
self.extra_gn_options.append('config_use_separate_eventloop=false')

if test_group:
self.extra_gn_options.append(
'chip_enable_group_messaging_tests=true')

def GnBuildArgs(self):
if self.board == HostBoard.NATIVE:
return self.extra_gn_options
Expand Down
10 changes: 10 additions & 0 deletions src/app/server/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@
import("//build_overrides/chip.gni")
import("${chip_root}/src/app/common_flags.gni")

# Move this inside the GroupDataProvider once implemented Issue #11075
declare_args() {
#Enable Multicast listenening on HardCoded IPV6 address for Test suite
chip_enable_group_messaging_tests = false
}

config("server_config") {
defines = []

if (chip_app_use_echo) {
defines += [ "CHIP_APP_USE_ECHO" ]
}

if (chip_enable_group_messaging_tests) {
defines += [ "CHIP_ENABLE_GROUP_MESSAGING_TESTS" ]
}
}

static_library("server") {
Expand Down
10 changes: 10 additions & 0 deletions src/app/server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ CHIP_ERROR Server::Init(AppDelegate * delegate, uint16_t secureServicePort, uint
#endif
SuccessOrExit(err);

// Enable Group Listening
// TODO : Fix this once GroupDataProvider is implemented #Issue 11075
// for (iterate through all GroupDataProvider multicast Address)
// {
#ifdef CHIP_ENABLE_GROUP_MESSAGING_TESTS
err = mTransports.MulticastGroupJoinLeave(Transport::PeerAddress::Multicast(1, 1234), true);
SuccessOrExit(err);
#endif
//}

err = mSessions.Init(&DeviceLayer::SystemLayer(), &mTransports, &mMessageCounterManager);
SuccessOrExit(err);

Expand Down
3 changes: 1 addition & 2 deletions src/app/tests/TestWriteInteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ void TestWriteInteraction::TestWriteClientGroup(nlTestSuite * apSuite, void * ap

err = writeClientHandle.SendWriteRequest(groupSession);

// Write will fail until issue #11078 is completed
NL_TEST_ASSERT(apSuite, err == CHIP_ERROR_NOT_CONNECTED);
NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR);
// The internal WriteClient should be shutdown once we SendWriteRequest for group.
NL_TEST_ASSERT(apSuite, nullptr == writeClientHandle.mpWriteClient);
}
Expand Down
1 change: 0 additions & 1 deletion src/darwin/Framework/CHIP/templates/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ function getTests()
'TestIdentifyCluster',
'TestOperationalCredentialsCluster',
'TestModeSelectCluster',
'TestGroupMessaging',
];

const SoftwareDiagnostics = [
Expand Down
101 changes: 0 additions & 101 deletions src/darwin/Framework/CHIPTests/CHIPClustersTests.m

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4353368

Please sign in to comment.