Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a3a2798

Browse files
committedMay 20, 2024·
Fixed CI check error.
1 parent 10fae47 commit a3a2798

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed
 

‎scripts/tests/run_tv_casting_test.py

+28-14
Original file line numberDiff line numberDiff line change
@@ -122,21 +122,35 @@ def handle_casting_failure(casting_state: str, log_file_paths: List[str]):
122122
def extract_value_from_string(line: str, value_name: str, casting_state: str, log_paths) -> str:
123123
"""Extract and return value from given input string.
124124
125-
The string is expected to be in the following format as it is received
126-
from the Linux tv-casting-app output:
127-
\x1b[0;34m[1715206773402] [20056:2842184] [DMG] Cluster = 0x506,\x1b[0m
128-
The substring to be extracted here is '0x506'.
129-
Or:
130-
\x1b[0;32m[1714582264602] [77989:2286038] [SVR] Discovered Commissioner #0\x1b[0m
131-
The integer value to be extracted here is '0'.
132-
Or:
133-
\x1b[0;34m[1713741926895] [7276:9521344] [DIS] Vendor ID: 65521\x1b[0m
134-
The integer value to be extracted here is '65521'.
135-
Or:
136-
\x1b[0;34m[1714583616179] [7029:2386956] [SVR] device Name: Test TV casting app\x1b[0m
137-
The substring to be extracted here is 'Test TV casting app'.
125+
Some input string examples as they are received from the Linux tv-casting-app and tv-app output:
126+
1. On 'darwin' machines:
127+
\x1b[0;34m[1715206773402] [20056:2842184] [DMG] Cluster = 0x506,\x1b[0m
128+
The substring to be extracted here is '0x506'.
129+
130+
Or:
131+
\x1b[0;32m[1714582264602] [77989:2286038] [SVR] Discovered Commissioner #0\x1b[0m
132+
The integer value to be extracted here is '0'.
133+
134+
Or:
135+
\x1b[0;34m[1713741926895] [7276:9521344] [DIS] Vendor ID: 65521\x1b[0m
136+
The integer value to be extracted here is '65521'.
137+
138+
Or:
139+
\x1b[0;34m[1714583616179] [7029:2386956] [SVR] device Name: Test TV casting app\x1b[0m
140+
The substring to be extracted here is 'Test TV casting app'.
141+
142+
2. On 'linux' machines:
143+
[1716224960.316809][6906:6906] CHIP:DMG: \t\t\t\t\tCluster = 0x506,\n
144+
[1716224958.576320][6906:6906] CHIP:SVR: Discovered Commissioner #0
145+
[1716224958.576407][6906:6906] CHIP:DIS: \tVendor ID: 65521\n
146+
[1716224959.580746][6906:6906] CHIP:SVR: \tdevice Name: Test TV casting app\n
138147
"""
139-
log_line_pattern = r'\x1b\[0;\d+m\[\d+\] \[\d+:\d+\] \[[A-Z]{1,3}\] (.+?)\x1b\[0m'
148+
log_line_pattern = ''
149+
if sys.platform == 'darwin':
150+
log_line_pattern = r'\x1b\[0;\d+m\[\d+\] \[\d+:\d+\] \[[A-Z]{1,3}\] (.+)\x1b\[0m'
151+
elif sys.platform == 'linux':
152+
log_line_pattern = r'\[\d+\.\d+\]\[\d+:\d+\] [A-Z]{1,4}:[A-Z]{1,3}: (.+)'
153+
140154
log_line_match = re.search(log_line_pattern, line)
141155

142156
if log_line_match:

0 commit comments

Comments
 (0)
Please sign in to comment.