Skip to content

Commit

Permalink
[CI] Add a test for successful OTA transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
carol-apple committed May 14, 2022
1 parent 9f755f9 commit 10676df
Show file tree
Hide file tree
Showing 21 changed files with 1,190 additions and 45 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/darwin-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ jobs:
--target darwin-x64-chip-tool-darwin-${BUILD_VARIANT} \
--target darwin-x64-all-clusters-${BUILD_VARIANT} \
--target darwin-x64-lock-${BUILD_VARIANT} \
--target darwin-x64-ota-provider-${BUILD_VARIANT} \
--target darwin-x64-ota-requestor-${BUILD_VARIANT} \
--target darwin-x64-tv-app-${BUILD_VARIANT} \
build \
--copy-artifacts-to objdir-clone \
Expand All @@ -104,6 +106,8 @@ jobs:
--iterations 1 \
--all-clusters-app ./out/darwin-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \
--lock-app ./out/darwin-x64-lock-${BUILD_VARIANT}/chip-lock-app \
--ota-provider-app ./out/darwin-x64-lock-${BUILD_VARIANT}/chip-ota-provider-app \
--ota-requestor-app ./out/darwin-x64-lock-${BUILD_VARIANT}/chip-ota-requestor-app \
--tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
"
- name: Uploading core files
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ concurrency:
jobs:
test_suites_linux:
name: Test Suites - Linux
timeout-minutes: 120
timeout-minutes: 130

strategy:
matrix:
Expand Down Expand Up @@ -76,13 +76,15 @@ jobs:
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
- name: Build Apps
timeout-minutes: 30
timeout-minutes: 40
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target linux-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT} \
--target linux-x64-all-clusters-${BUILD_VARIANT} \
--target linux-x64-lock-${BUILD_VARIANT} \
--target linux-x64-ota-provider-${BUILD_VARIANT} \
--target linux-x64-ota-requestor-${BUILD_VARIANT} \
--target linux-x64-tv-app-${BUILD_VARIANT} \
build \
--copy-artifacts-to objdir-clone \
Expand All @@ -97,6 +99,8 @@ jobs:
--iterations 1 \
--all-clusters-app ./out/linux-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \
--lock-app ./out/linux-x64-lock-${BUILD_VARIANT}/chip-lock-app \
--ota-provider-app ./out/linux-x64-ota-provider-${BUILD_VARIANT}/chip-ota-provider-app \
--ota-requestor-app ./out/linux-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \
--tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
"
- name: Uploading core files
Expand All @@ -117,7 +121,7 @@ jobs:
retention-days: 5
test_suites_darwin:
name: Test Suites - Darwin
timeout-minutes: 120
timeout-minutes: 130

strategy:
matrix:
Expand Down Expand Up @@ -172,13 +176,15 @@ jobs:
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
- name: Build Apps
timeout-minutes: 30
timeout-minutes: 40
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target darwin-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT} \
--target darwin-x64-all-clusters-${BUILD_VARIANT} \
--target darwin-x64-lock-${BUILD_VARIANT} \
--target darwin-x64-ota-provider-${BUILD_VARIANT} \
--target darwin-x64-ota-requestor-${BUILD_VARIANT} \
--target darwin-x64-tv-app-${BUILD_VARIANT} \
build \
--copy-artifacts-to objdir-clone \
Expand All @@ -194,6 +200,8 @@ jobs:
--iterations 1 \
--all-clusters-app ./out/darwin-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \
--lock-app ./out/darwin-x64-lock-${BUILD_VARIANT}/chip-lock-app \
--ota-provider-app ./out/darwin-x64-ota-provider-${BUILD_VARIANT}/chip-ota-provider-app \
--ota-requestor-app ./out/darwin-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \
--tv-app ./out/darwin-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
"
- name: Uploading core files
Expand Down
2 changes: 2 additions & 0 deletions scripts/tests/chiptest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def AllTests(chip_tool: str):
target = TestTarget.TV
elif name.startswith('DL_'):
target = TestTarget.LOCK
elif name.startswith('OTA_'):
target = TestTarget.OTA
else:
target = TestTarget.ALL_CLUSTERS

Expand Down
13 changes: 12 additions & 1 deletion scripts/tests/chiptest/accessories.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def killAll(self):
def start(self, name, args):
accessory = self.__accessories[name]
if accessory:
# The args param comes directly from the sys.argv[1:] of Start.py and should contain a list of strings in
# The args param comes directly from the sys.argv[2:] of Start.py and should contain a list of strings in
# key-value pair, e.g. [option1, value1, option2, value2, ...]
options = self.__createCommandLineOptions(args)
return accessory.start(options)
Expand Down Expand Up @@ -104,6 +104,14 @@ def waitForOperationalAdvertisement(self, name):
return accessory.waitForOperationalAdvertisement()
return False

def waitForMessage(self, name, message):
accessory = self.__accessories[name]
if accessory:
# The message param comes directly from the sys.argv[2:] of WaitForMessage.py and should contain a list of strings that
# comprise the entire message to wait for
return accessory.waitForMessage(' '.join(message))
return False

def __startXMLRPCServer(self):
self.server = SimpleXMLRPCServer((IP, PORT))

Expand All @@ -117,6 +125,9 @@ def __startXMLRPCServer(self):
self.server.register_function(
self.waitForOperationalAdvertisement,
'waitForOperationalAdvertisement')
self.server.register_function(
self.waitForMessage,
'waitForMessage')

self.server_thread = threading.Thread(target=self.server.serve_forever)
self.server_thread.start()
Expand Down
2 changes: 2 additions & 0 deletions scripts/tests/chiptest/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,7 @@ def PathsWithNetworkNamespaces(paths: ApplicationPaths) -> ApplicationPaths:
chip_tool='ip netns exec tool'.split() + paths.chip_tool,
all_clusters_app='ip netns exec app'.split() + paths.all_clusters_app,
lock_app='ip netns exec app'.split() + paths.lock_app,
ota_provider_app='ip netns exec app'.split() + paths.ota_provider_app,
ota_requestor_app='ip netns exec app'.split() + paths.ota_requestor_app,
tv_app='ip netns exec app'.split() + paths.tv_app,
)
11 changes: 10 additions & 1 deletion scripts/tests/chiptest/test_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def waitForOperationalAdvertisement(self):
self.process, self.outpipe)
return True

def waitForMessage(self, message):
self.__waitFor(message, self.process, self.outpipe)
return True

def kill(self):
if self.process:
self.process.kill()
Expand Down Expand Up @@ -154,17 +158,20 @@ class TestTarget(Enum):
ALL_CLUSTERS = auto()
TV = auto()
LOCK = auto()
OTA = auto()


@dataclass
class ApplicationPaths:
chip_tool: typing.List[str]
all_clusters_app: typing.List[str]
lock_app: typing.List[str]
ota_provider_app: typing.List[str]
ota_requestor_app: typing.List[str]
tv_app: typing.List[str]

def items(self):
return [self.chip_tool, self.all_clusters_app, self.lock_app, self.tv_app]
return [self.chip_tool, self.all_clusters_app, self.lock_app, self.ota_provider_app, self.ota_requestor_app, self.tv_app]


@dataclass
Expand Down Expand Up @@ -225,6 +232,8 @@ def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str):
target_app = paths.tv_app
elif self.target == TestTarget.LOCK:
target_app = paths.lock_app
elif self.target == TestTarget.OTA:
target_app = paths.ota_requestor_app
else:
raise Exception("Unknown test target - "
"don't know which application to run")
Expand Down
16 changes: 15 additions & 1 deletion scripts/tests/run_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ def cmd_list(context):
@click.option(
'--lock-app',
help='what lock app to use')
@click.option(
'--ota-provider-app',
help='what ota provider app to use')
@click.option(
'--ota-requestor-app',
help='what ota requestor app to use')
@click.option(
'--tv-app',
help='what tv app to use')
Expand All @@ -180,7 +186,7 @@ def cmd_list(context):
default="src/app/tests/suites/certification/ci-pics-values",
help='PICS file to use for test runs.')
@click.pass_context
def cmd_run(context, iterations, all_clusters_app, lock_app, tv_app, pics_file):
def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, ota_requestor_app, tv_app, pics_file):
runner = chiptest.runner.Runner()

if all_clusters_app is None:
Expand All @@ -189,6 +195,12 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, tv_app, pics_file):
if lock_app is None:
lock_app = FindBinaryPath('chip-lock-app')

if ota_provider_app is None:
ota_provider_app = FindBinaryPath('chip-ota-provider-app')

if ota_requestor_app is None:
ota_requestor_app = FindBinaryPath('chip-ota-requestor-app')

if tv_app is None:
tv_app = FindBinaryPath('chip-tv-app')

Expand All @@ -197,6 +209,8 @@ def cmd_run(context, iterations, all_clusters_app, lock_app, tv_app, pics_file):
chip_tool=[context.obj.chip_tool],
all_clusters_app=[all_clusters_app],
lock_app=[lock_app],
ota_provider_app=[ota_provider_app],
ota_requestor_app=[ota_requestor_app],
tv_app=[tv_app]
)

Expand Down
Loading

0 comments on commit 10676df

Please sign in to comment.