-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OIS] Add integration tests for Open IoT SDK examples
Add network setup script to enable/disable the TAP/TUN network environment. Create TAP/TUN device and bridge interface to connect it with the ethernet network interface. Create Pytest implementation of Open IoT SDK examples integration tests. Implement lock-app and shell examples tests cases. Add test command to Open IoT SDK example script. Add integrations tests to CI workflow. Add Open IoT SDK examples testing to Vscode tasks. Signed-off-by: ATmobica <artur.tynecki@arm.com>
- Loading branch information
Showing
20 changed files
with
1,599 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Copyright (c) 2022 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# 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. | ||
# | ||
|
||
# This script executes the command given as an argument within | ||
# CHIP_ROOT in a specific network namespace. | ||
|
||
NETWORK_NAMESPACE="default" | ||
|
||
function show_usage() { | ||
cat <<EOF | ||
Usage: $0 namespace command | ||
Execute the command given as an argument in a specific network namespace. | ||
Example: | ||
scripts/run_in_ns.sh MatterNet "ip a" | ||
Use "default" as a namespace argument to use the host network namespace directly. | ||
EOF | ||
} | ||
|
||
if [[ $# -lt 2 ]]; then | ||
show_usage >&2 | ||
exit 1 | ||
fi | ||
|
||
NETWORK_NAMESPACE=$1 | ||
shift | ||
|
||
if [[ $NETWORK_NAMESPACE == "default" ]]; then | ||
"$@" | ||
else | ||
if [ ! -f /var/run/netns/"$NETWORK_NAMESPACE" ]; then | ||
echo "$NETWORK_NAMESPACE network namespace does not exist" | ||
show_usage >&2 | ||
exit 1 | ||
fi | ||
echo "Run command: $@ in $NETWORK_NAMESPACE namespace" | ||
if [ "$EUID" -ne 0 ]; then | ||
sudo env PATH="$PATH" ip netns exec "$NETWORK_NAMESPACE" "$@" | ||
else | ||
ip netns exec "$NETWORK_NAMESPACE" "$@" | ||
fi | ||
fi |
Oops, something went wrong.