PelionIoT / simple-mbed-cloud-client

Simple interface for Mbed Cloud Client - deprecated
Apache License 2.0
7 stars 21 forks source link

Detect common user errors runtime. #86

Closed korjaa closed 5 years ago

korjaa commented 5 years ago
MarceloSalazar commented 5 years ago

@korjaa thanks for the PR and sorry for the delay. Can you confirm the PR is ready to merge? Also, can you attached logs to confirm this works ok? I'll merge soon after this. Thanks!

korjaa commented 5 years ago

Hi Marcelo,

Yes, the PR should be good to merge. I also added a automatic check to verify that the account IDs match between mbed_cloud_dev_credentials.c and CLOUD_SDK_API_KEY.

I'm not aware of any issues at the moment. The only thing I'm worried is the file access that is done in the script with relative paths. This means that the SPDMC tests must be ran from a directory with the .manifest_tool.json and mbed_cloud_dev_credentials.c available in the test launch directory.

Missing manifest_tool.json gives a following error:

$ mbedhtrun --skip-flashing --skip-reset -p /dev/ttyACM0:115200 --enum-host-tests=simple-mbed-cloud-client/TESTS/host_tests -v
HOST: Inspecting './test/host_tests' for local host tests...
HOST: Inspecting 'simple-mbed-cloud-client/TESTS/host_tests' for local host tests...
HOST: Error! While loading local host test module 'simple-mbed-cloud-client/TESTS/host_tests/sdk_host_tests.py'
HOST: Cannot find "manifest_tool.json" to verify "mbed dm init..."
[1556796787.68][HTST][INF] host test executor ver. 0.0.6

Uninitialized manifest_tool.json gives a following error:

$ mbedhtrun --skip-flashing --skip-reset -p /dev/ttyACM0:115200 --enum-host-tests=simple-mbed-cloud-client/TESTS/host_tests -v
HOST: Inspecting './test/host_tests' for local host tests...
HOST: Inspecting 'simple-mbed-cloud-client/TESTS/host_tests' for local host tests...
HOST: Error! While loading local host test module 'simple-mbed-cloud-client/TESTS host_tests/sdk_host_tests.py'
HOST: Cannot detect change in manifest_tool.json (md5=de302858ac31a2d68123a18b57702777), initialize Pelion update with:
mbed dm init -d "<your company name in Pelion DM>"--model-name "<product model identifier>" -q --force
[1556796652.79][HTST][INF] host test executor ver. 0.0.6

Account ID check gives following error if mismatch in account IDs is detected ():

[1556794334.30][TEST][ERR] ERROR: "mbed_cloud_dev_credentials.c" account ID of "015f6***" does not match CLOUD_SDK_API_KEY account ID of "0166f***"
[1556794334.40][HTST][INF] host test setup() call...
[1556794334.40][HTST][INF] CALLBACKs updated
[1556794334.40][HTST][INF] host test detected: sdk_host_tests
MarceloSalazar commented 5 years ago

Thanks @korjaa I think the message when .manifest_tool.json is missing/uninitialized is good for now.