Skip to content

Commit

Permalink
Address code review comments
Browse files Browse the repository at this point in the history
- Revert time bumps
- Add a main function to all the newly added python scripts
- Add documentation on WaitForMessage API
  • Loading branch information
carol-apple committed May 17, 2022
1 parent 5937207 commit 340a702
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 20 deletions.
8 changes: 4 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: 130
timeout-minutes: 120

strategy:
matrix:
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
- name: Build Apps
timeout-minutes: 40
timeout-minutes: 30
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
retention-days: 5
test_suites_darwin:
name: Test Suites - Darwin
timeout-minutes: 130
timeout-minutes: 120

strategy:
matrix:
Expand Down Expand Up @@ -176,7 +176,7 @@ jobs:
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
- name: Build Apps
timeout-minutes: 40
timeout-minutes: 30
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
Expand Down
2 changes: 2 additions & 0 deletions src/app/tests/suites/commands/delay/DelayCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class DelayCommands
const chip::app::Clusters::DelayCommands::Commands::WaitForCommissionableAdvertisement::Type & value);
CHIP_ERROR WaitForOperationalAdvertisement(
const char * identity, const chip::app::Clusters::DelayCommands::Commands::WaitForOperationalAdvertisement::Type & value);
// Wait for any message specified by value.message for the application specified by value.registerKey
// If the message is never seen, a timeout would occur
CHIP_ERROR WaitForMessage(const char * identity,
const chip::app::Clusters::DelayCommands::Commands::WaitForMessage::Type & value);

Expand Down
10 changes: 8 additions & 2 deletions src/app/tests/suites/commands/delay/scripts/WaitForMessage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@
if sys.platform == 'linux':
IP = '10.10.10.5'

with xmlrpc.client.ServerProxy('http://' + IP + ':' + str(PORT) + '/', allow_none=True) as proxy:
proxy.waitForMessage(sys.argv[1], sys.argv[2:])

def main():
with xmlrpc.client.ServerProxy('http://' + IP + ':' + str(PORT) + '/', allow_none=True) as proxy:
proxy.waitForMessage(sys.argv[1], sys.argv[2:])


if __name__ == "__main__":
main()
10 changes: 8 additions & 2 deletions src/app/tests/suites/commands/system/scripts/CompareFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@
file1 = sys.argv[1]
file2 = sys.argv[2]

if filecmp.cmp(file1, file2, shallow=False) is False:
raise Exception('Files %s and %s do not match' % (file1, file2))

def main():
if filecmp.cmp(file1, file2, shallow=False) is False:
raise Exception('Files %s and %s do not match' % (file1, file2))


if __name__ == "__main__":
main()
30 changes: 18 additions & 12 deletions src/app/tests/suites/commands/system/scripts/CreateOtaImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,21 @@
rawImageFilePath = sys.argv[2]
rawImageContent = ' '.join(sys.argv[3:])

# Write the raw image content
with open(rawImageFilePath, 'w') as rawFile:
rawFile.write(rawImageContent)

# Add an OTA header to the raw file
otaImageTool = DEFAULT_CHIP_ROOT + '/src/app/ota_image_tool.py'
cmd = [otaImageTool, 'create', '-v', '0xDEAD', '-p', '0xBEEF', '-vn', '2',
'-vs', "2.0", '-da', 'sha256', rawImageFilePath, otaImageFilePath]
s = subprocess.Popen(cmd)
s.wait()
if s.returncode != 0:
raise Exception('Cannot create OTA image file')

def main():
# Write the raw image content
with open(rawImageFilePath, 'w') as rawFile:
rawFile.write(rawImageContent)

# Add an OTA header to the raw file
otaImageTool = DEFAULT_CHIP_ROOT + '/src/app/ota_image_tool.py'
cmd = [otaImageTool, 'create', '-v', '0xDEAD', '-p', '0xBEEF', '-vn', '2',
'-vs', "2.0", '-da', 'sha256', rawImageFilePath, otaImageFilePath]
s = subprocess.Popen(cmd)
s.wait()
if s.returncode != 0:
raise Exception('Cannot create OTA image file')


if __name__ == "__main__":
main()

0 comments on commit 340a702

Please sign in to comment.