Skip to content

Lora unittests #8233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Oct 5, 2018
Merged

Lora unittests #8233

merged 12 commits into from
Oct 5, 2018

Conversation

AnttiKauppila
Copy link

Description

LoRaWAN classes unittested and small fixes done while testing
Also failing unittests were fixed

Pull request type

[X] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Breaking change

@AnttiKauppila
Copy link
Author

@hasnainvirk @kivaisan Please review

tr_debug("state_controller: Unknown state!");
status = LORAWAN_STATUS_SERVICE_UNKNOWN;
//Because this is internal function only coding error causes this
MBED_ASSERT(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But in release profile we shouldn't return LORAWAN_STATUS_OK either. So I would keep the original code but also have the assert.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the original code here. Or just add assert at the end after the original code. As @kivaisan mentioned, release build would strip off asserts.

@@ -93,8 +93,7 @@ void LoRaMacCommand::parse_mac_commands_to_repeat()
case MOTE_MAC_LINK_CHECK_REQ: { // 0 byte payload
break;
}
default:
break;
default: {}//Cannot happen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think assert should be added here as well. Default can only happen if MAC command is missing from case list.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Assert should happen here. I am seeing a case with 1.1 where a corrupted message is mistaken as a mac command and it falls here.

@@ -1343,7 +1300,7 @@ lorawan_status_t LoRaPHY::add_channel(const channel_params_t *new_channel,
// Default channels don't accept all values
if (id < phy_params.default_channel_cnt) {
// Validate the datarate range for min: must be DR_0
if (new_channel->dr_range.fields.min > phy_params.min_tx_datarate) {
if (new_channel->dr_range.fields.min != DR_0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be something like this:
// Validate the datarate range for min: must be greater than min_tx_datarate
if (new_channel->dr_range.fields.min > phy_params.min_tx_datarate) {
dr_invalid = true;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kivaisan Actually no. This code is correct because for default channels minimum data-rate is 0 always. So if it is not DR_0, it's invalid.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

)

# defines
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMBED_CONF_LORA_PHY=\"EU868\"")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need CMAKE_C_FLAGS ? I think CMAKE_CXX_FLAGS would do. Everything is C++ code here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not harm to have those

@hasnainvirk
Copy link
Contributor

@AnttiKauppila A general comment: Perhaps we should change the title as the PR touches plenty of other modules inside Mbed OS. Plus we may want to do a little squashing here as we have progression of related commits which may go in one or two functional commits.

@AnttiKauppila
Copy link
Author

Review comments visited and fixed where needed.

@hasnainvirk
Copy link
Contributor

Looks good to me +1.

@AnttiKauppila
Copy link
Author

@hasnainvirk We need all those stubs to make the code compile. So anything which is under UNITTESTS/ folder are not touching modules in mbed-os

@AnttiKauppila
Copy link
Author

@0xc0170 This is reviewed

@AnttiKauppila
Copy link
Author

@0xc0170 @cmonr Can you trigger a build for this

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 1, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Oct 1, 2018

Build : SUCCESS

Build number : 3205
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/8233/

Triggering tests

/morph test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Oct 1, 2018

@mbed-ci
Copy link

mbed-ci commented Oct 2, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 2, 2018

One failure there caught earlier, will restart

@AnttiKauppila
Copy link
Author

@0xc0170 Has this been restarted?

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 4, 2018

Blocked on #8297, exporters are failing

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 5, 2018

/morph export-build

@mbed-ci
Copy link

mbed-ci commented Oct 5, 2018

@0xc0170 0xc0170 merged commit 943130c into ARMmbed:master Oct 5, 2018
@AnttiKauppila AnttiKauppila deleted the lora_unittests branch October 8, 2018 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants