Skip to content

Commit

Permalink
Updated the PR latests comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarkov committed Jul 3, 2021
1 parent 3dc3e78 commit 3e51072
Show file tree
Hide file tree
Showing 36 changed files with 256 additions and 267 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ jobs:
timeout-minutes: 10
run: |
ifconfig -a
scripts/tests/test_suites.sh
scripts/tests/test_suites.sh
- name: Run TV Tests
timeout-minutes: 10
run: |
ifconfig -a
scripts/tests/test_suites.sh -a tv -i 20
- name: Uploading core files
uses: actions/upload-artifact@v2
if: ${{ failure() }}
Expand Down Expand Up @@ -164,6 +169,10 @@ jobs:
timeout-minutes: 15
run: |
scripts/tests/test_suites.sh
- name: Run TV Tests
timeout-minutes: 10
run: |
scripts/tests/test_suites.sh -a tv -i 20
- name: Uploading core files
uses: actions/upload-artifact@v2
if: ${{ failure() }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2600,7 +2600,7 @@

// Array of EmberAfCommandMetadata structs.
#define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask
#define EMBER_AF_GENERATED_COMMAND_COUNT (201)
#define EMBER_AF_GENERATED_COMMAND_COUNT (200)
#define GENERATED_COMMANDS \
{ \
\
Expand Down Expand Up @@ -2826,7 +2826,6 @@
{ 0x0506, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MediaSkipBackward */ \
{ 0x0506, 0x09, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* MediaSkipBackwardResponse */ \
{ 0x0506, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MediaSkipSeek */ \
{ 0x0506, 0x0A, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* MediaSkipSeekResponse */ \
\
/* Endpoint: 1, Cluster: Media Input (server) */ \
{ 0x0507, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SelectInput */ \
Expand Down
22 changes: 11 additions & 11 deletions examples/chip-tool/templates/tests-commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@

#include "TestCommand.h"

{{>test_cluster tests="TargetNavigatorCluster, AudioOutputCluster, ApplicationLauncherCluster, KeypadInputCluster, AccountLoginCluster, ApplicationBasicCluster, MediaPlaybackCluster, TvChannelCluster, LowPowerCluster, MediaInputCluster, TestCluster, Test_TC_OO_1_1, Test_TC_OO_2_1, Test_TC_OO_2_2, Test_TC_DM_1_1, Test_TC_DM_3_1"}}
{{>test_cluster tests="TV_TargetNavigatorCluster, TV_AudioOutputCluster, TV_ApplicationLauncherCluster, TV_KeypadInputCluster, TV_AccountLoginCluster, TV_ApplicationBasicCluster, TV_MediaPlaybackCluster, TV_TvChannelCluster, TV_LowPowerCluster, TV_MediaInputCluster, TestCluster, Test_TC_OO_1_1, Test_TC_OO_2_1, Test_TC_OO_2_2, Test_TC_DM_1_1, Test_TC_DM_3_1"}}

void registerCommandsTests(Commands & commands)
{
const char * clusterName = "Tests";

commands_list clusterCommands = {
make_unique<TargetNavigatorCluster>(),
make_unique<AudioOutputCluster>(),
make_unique<ApplicationLauncherCluster>(),
make_unique<KeypadInputCluster>(),
make_unique<AccountLoginCluster>(),
make_unique<ApplicationBasicCluster>(),
make_unique<MediaPlaybackCluster>(),
make_unique<TvChannelCluster>(),
make_unique<LowPowerCluster>(),
make_unique<MediaInputCluster>(),
make_unique<TV_TargetNavigatorCluster>(),
make_unique<TV_AudioOutputCluster>(),
make_unique<TV_ApplicationLauncherCluster>(),
make_unique<TV_KeypadInputCluster>(),
make_unique<TV_AccountLoginCluster>(),
make_unique<TV_ApplicationBasicCluster>(),
make_unique<TV_MediaPlaybackCluster>(),
make_unique<TV_TvChannelCluster>(),
make_unique<TV_LowPowerCluster>(),
make_unique<TV_MediaInputCluster>(),
make_unique<TestCluster>(),
make_unique<Test_TC_OO_1_1>(),
make_unique<Test_TC_OO_2_1>(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

#include "ApplicationLauncherManager.h"
#include <app/Command.h>
#include <app/clusters/application-launcher-server/application-launcher-server.h>
#include <app/common/gen/attribute-id.h>
#include <app/common/gen/attribute-type.h>
#include <app/common/gen/cluster-id.h>
#include <app/common/gen/command-id.h>

#include <app/util/af.h>
#include <app/util/basic-types.h>

Expand All @@ -45,10 +45,10 @@ vector<uint16_t> ApplicationLauncherManager::proxyGetApplicationList()
return applications;
}

EmberAfApplicationLauncherResponse applicationLauncherClusterLaunchApp(EmberAfApplicationLauncherApp application, std::string data)
ApplicationLauncherResponse applicationLauncherClusterLaunchApp(EmberAfApplicationLauncherApp application, std::string data)
{
// TODO: Insert your code
EmberAfApplicationLauncherResponse response;
ApplicationLauncherResponse response;
char testData[] = "data";
response.data = (uint8_t *) testData;
response.status = EMBER_ZCL_APPLICATION_LAUNCHER_STATUS_SUCCESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,32 @@ CHIP_ERROR MediaPlaybackManager::Init()
return err;
}

EmberAfMediaPlaybackStatus MediaPlaybackManager::proxyMediaPlaybackRequest(EmberAfMediaPlaybackRequest mediaPlaybackRequest,
EmberAfMediaPlaybackStatus MediaPlaybackManager::proxyMediaPlaybackRequest(MediaPlaybackRequest mediaPlaybackRequest,
uint64_t deltaPositionMilliseconds)
{
switch (mediaPlaybackRequest)
{
case EMBER_ZCL_MEDIA_PLAYBACK_REQUEST_PLAY:
case MEDIA_PLAYBACK_REQUEST_PLAY:
// TODO: Insert code here
case EMBER_ZCL_MEDIA_PLAYBACK_REQUEST_PAUSE:
case MEDIA_PLAYBACK_REQUEST_PAUSE:
// TODO: Insert code here
case EMBER_ZCL_MEDIA_PLAYBACK_REQUEST_STOP:
case MEDIA_PLAYBACK_REQUEST_STOP:
// TODO: Insert code here
case EMBER_ZCL_MEDIA_PLAYBACK_REQUEST_START_OVER:
case MEDIA_PLAYBACK_REQUEST_START_OVER:
// TODO: Insert code here
case EMBER_ZCL_MEDIA_PLAYBACK_REQUEST_PREVIOUS:
case MEDIA_PLAYBACK_REQUEST_PREVIOUS:
// TODO: Insert code here
case EMBER_ZCL_MEDIA_PLAYBACK_REQUEST_NEXT:
case MEDIA_PLAYBACK_REQUEST_NEXT:
// TODO: Insert code here
case EMBER_ZCL_MEDIA_PLAYBACK_REQUEST_REWIND:
case MEDIA_PLAYBACK_REQUEST_REWIND:
// TODO: Insert code here
case EMBER_ZCL_MEDIA_PLAYBACK_REQUEST_FAST_FORWARD:
case MEDIA_PLAYBACK_REQUEST_FAST_FORWARD:
// TODO: Insert code here
case EMBER_ZCL_MEDIA_PLAYBACK_REQUEST_SKIP_FORWARD:
case MEDIA_PLAYBACK_REQUEST_SKIP_FORWARD:
// TODO: Insert code here
case EMBER_ZCL_MEDIA_PLAYBACK_REQUEST_SKIP_BACKWARD:
case MEDIA_PLAYBACK_REQUEST_SKIP_BACKWARD:
// TODO: Insert code here
case EMBER_ZCL_MEDIA_PLAYBACK_REQUEST_SEEK:
case MEDIA_PLAYBACK_REQUEST_SEEK:
return EMBER_ZCL_MEDIA_PLAYBACK_STATUS_SUCCESS;
break;
default: {
Expand All @@ -72,7 +72,7 @@ EmberAfMediaPlaybackStatus MediaPlaybackManager::proxyMediaPlaybackRequest(Ember
}
}

EmberAfMediaPlaybackStatus mediaPlaybackClusterSendMediaPlaybackRequest(EmberAfMediaPlaybackRequest mediaPlaybackRequest,
EmberAfMediaPlaybackStatus mediaPlaybackClusterSendMediaPlaybackRequest(MediaPlaybackRequest mediaPlaybackRequest,
uint64_t deltaPositionMilliseconds)
{
return MediaPlaybackManager().proxyMediaPlaybackRequest(mediaPlaybackRequest, deltaPositionMilliseconds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,18 @@

#pragma once

#include <app/clusters/media-playback-server/media-playback-server.h>
#include <app/common/gen/enums.h>
#include <app/util/af-types.h>

#include <core/CHIPError.h>

enum MediaPlaybackRequest
{
Play,
Pause,
Stop,
StartOver,
Previous,
Next,
Rewind,
FastForward,
SkipForward,
SkipBackward,
Seek
};

class MediaPlaybackManager
{
public:
CHIP_ERROR Init();
void storeNewPlaybackState(chip::EndpointId endpoint, uint8_t newPlaybackState);
EmberAfMediaPlaybackStatus proxyMediaPlaybackRequest(EmberAfMediaPlaybackRequest mediaPlaybackRequest,
EmberAfMediaPlaybackStatus proxyMediaPlaybackRequest(MediaPlaybackRequest mediaPlaybackRequest,
uint64_t deltaPositionMilliseconds);

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "TargetNavigatorManager.h"
#include <app/Command.h>
#include <app/clusters/target-navigator-server/target-navigator-server.h>
#include <app/common/gen/attribute-id.h>
#include <app/common/gen/attribute-type.h>
#include <app/common/gen/cluster-id.h>
Expand Down Expand Up @@ -58,10 +59,10 @@ std::vector<EmberAfNavigateTargetTargetInfo> TargetNavigatorManager::proxyGetTar
return targets;
}

EmberAfTargetNavigatorResponse targetNavigatorClusterNavigateTarget(uint8_t target, std::string data)
TargetNavigatorResponse targetNavigatorClusterNavigateTarget(uint8_t target, std::string data)
{
// TODO: Insert code here
EmberAfTargetNavigatorResponse response;
TargetNavigatorResponse response;
char testData[] = "data response";
response.data = (uint8_t *) testData;
response.status = EMBER_ZCL_APPLICATION_LAUNCHER_STATUS_SUCCESS;
Expand Down
3 changes: 1 addition & 2 deletions examples/tv-app/tv-common/gen/endpoint_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@

// Array of EmberAfCommandMetadata structs.
#define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask
#define EMBER_AF_GENERATED_COMMAND_COUNT (117)
#define EMBER_AF_GENERATED_COMMAND_COUNT (116)
#define GENERATED_COMMANDS \
{ \
\
Expand Down Expand Up @@ -1997,7 +1997,6 @@
{ 0x0506, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MediaSkipBackward */ \
{ 0x0506, 0x09, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* MediaSkipBackwardResponse */ \
{ 0x0506, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MediaSkipSeek */ \
{ 0x0506, 0x0A, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* MediaSkipSeekResponse */ \
\
/* Endpoint: 3, Cluster: Content Launcher (server) */ \
{ 0x050A, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* LaunchContent */ \
Expand Down
48 changes: 31 additions & 17 deletions scripts/tests/test_suites.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,31 @@

set -e

declare -a test_array=("Test_3_1_1"
"Test_3_2_1"
"Test_3_2_2"
"Test_10_1_1"
"TestCluster")
declare -i iterations=20
declare -i background_pid=0

# read shell arguments
# - a for application
# - i for number of iterations you want to have
while getopts a:i: flag; do
case "${flag}" in
a) application=${OPTARG} ;;
i) iterations=${OPTARG} ;;
esac
done

echo "Running tests for application: $application, with iterations set to: $iterations"

if [[ $application == "tv" ]]; then
declare -a test_array="($(find src/app/tests/suites -type f -name "TV_*.yaml" -exec basename {} .yaml \;))"
cp examples/tv-app/linux/include/endpoint-configuration/chip_tv_config.ini /tmp/chip_tv_config.ini
# in case there's no application argument
# always default to all-cluters app
else
application="all-clusters"
declare -a test_array="($(find src/app/tests/suites -type f -name "Test*.yaml" -exec basename {} .yaml \;))"
fi

cleanup() {
if [[ $background_pid != 0 ]]; then
# In case we died on a failure before we cleaned up our background task.
Expand All @@ -34,12 +51,9 @@ cleanup() {
}
trap cleanup EXIT

if [[ -n $1 ]]; then
iterations=$1
if [[ $iterations == 0 ]]; then
echo "Invalid iteration count: '$1'"
exit 1
fi
if [[ $iterations == 0 ]]; then
echo "Invalid iteration count: '$1'"
exit 1
fi

echo "Found tests:"
Expand All @@ -59,7 +73,7 @@ for j in "${iter_array[@]}"; do
echo " * Starting cluster server"
rm -rf /tmp/chip_tool_config.ini
# This part is a little complicated. We want to
# 1) Start chip-all-clusters-app in the background
# 1) Start chip-app in the background
# 2) Pipe its output through tee so we can wait until it's ready for a
# PASE handshake.
# 3) Save its pid off so we can kill it.
Expand All @@ -76,14 +90,14 @@ for j in "${iter_array[@]}"; do

# Clear out our temp files so we don't accidentally do a stale
# read from them before we write to them.
rm -rf /tmp/all-clusters-log
touch /tmp/all-clusters-log
rm -rf /tmp/$application-log
touch /tmp/$application-log
rm -rf /tmp/pid
(
stdbuf -o0 out/debug/standalone/chip-all-clusters-app &
stdbuf -o0 out/debug/standalone/chip-$application-app &
echo $! >&3
) 3>/tmp/pid | tee /tmp/all-clusters-log &
while ! grep -q "Server Listening" /tmp/all-clusters-log; do
) 3>/tmp/pid | tee /tmp/$application-log &
while ! grep -q "Server Listening" /tmp/$application-log; do
:
done
# Now read $background_pid from /tmp/pid; presumably it's
Expand Down
Loading

0 comments on commit 3e51072

Please sign in to comment.