Skip to content

Commit 620ec71

Browse files
Addressed PR comments from @andy31415.
1 parent e46b93f commit 620ec71

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

scripts/build/build/targets.py

+1
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ def BuildHostTarget():
189189
target.AppendModifier('evse-test-event', enable_test_event_triggers=['EVSE']).OnlyIfRe('-energy-management')
190190
target.AppendModifier('enable-dnssd-tests', enable_dnssd_tests=True).OnlyIfRe('-tests')
191191
target.AppendModifier('disable-dnssd-tests', enable_dnssd_tests=False).OnlyIfRe('-tests')
192+
target.AppendModifier('chip-casting-simplified', chip_casting_simplified=True).OnlyIfRe('-tv-casting-app')
192193

193194
return target
194195

scripts/build/builders/host.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE,
313313
use_coverage=False, use_dmalloc=False, minmdns_address_policy=None,
314314
minmdns_high_verbosity=False, imgui_ui=False, crypto_library: HostCryptoLibrary = None,
315315
enable_test_event_triggers=None,
316-
enable_dnssd_tests: Optional[bool] = None
316+
enable_dnssd_tests: Optional[bool] = None,
317+
chip_casting_simplified=None
317318
):
318319
super(HostBuilder, self).__init__(
319320
root=os.path.join(root, 'examples', app.ExamplePath()),
@@ -428,6 +429,10 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE,
428429
else:
429430
self.extra_gn_options.append('chip_enable_dnssd_tests=false')
430431

432+
if chip_casting_simplified is not None:
433+
if chip_casting_simplified:
434+
self.extra_gn_options.append('chip_casting_simplified=true')
435+
431436
if self.board == HostBoard.ARM64:
432437
if not use_clang:
433438
raise Exception("Cross compile only supported using clang")

scripts/tests/run_tv_casting_test.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __exit__(self, exception_type, exception_value, traceback):
6464
self.process.wait()
6565

6666

67-
def remove_cached_files(cached_file_pattern: str) -> bool:
67+
def remove_cached_files(cached_file_pattern: str):
6868
"""Remove any cached files that match the provided pattern."""
6969

7070
cached_files = glob.glob(cached_file_pattern) # Returns a list of paths that match the pattern.
@@ -73,10 +73,8 @@ def remove_cached_files(cached_file_pattern: str) -> bool:
7373
try:
7474
os.remove(cached_file)
7575
except OSError as e:
76-
logging.error(f'Failed to remove cached file `{cached_file}` with error: `{e.strerror}`.')
77-
return False
78-
79-
return True
76+
logging.error(f'Failed to remove cached file `{cached_file}` with error: `{e.strerror}`')
77+
raise # Re-raise the OSError to propagate it up.
8078

8179

8280
def dump_temporary_logs_to_console(log_file_path: str):
@@ -351,8 +349,12 @@ def test_casting_fn(tv_app_rel_path, tv_casting_app_rel_path):
351349
if __name__ == '__main__':
352350

353351
# Start with a clean slate by removing any previously cached entries.
354-
cached_file_pattern = '/tmp/chip_*'
355-
if not remove_cached_files(cached_file_pattern):
352+
try:
353+
cached_file_pattern = '/tmp/chip_*'
354+
remove_cached_files(cached_file_pattern)
355+
except OSError as e:
356+
logging.error(
357+
f'Error while removing cached files with file pattern: {cached_file_pattern}')
356358
sys.exit(1)
357359

358360
# Test casting (discovery and commissioning) between the Linux tv-casting-app and the tv-app.

0 commit comments

Comments
 (0)