Skip to content

Fix network and util ut #8229

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 2 commits into from
Sep 25, 2018
Merged

Conversation

mirelachirica
Copy link
Contributor

Description

Fix for cellular network and cellular util unit tests.

Pull request type

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

@@ -1048,7 +1047,7 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_operator_params)
EXPECT_TRUE(NSAPI_ERROR_OK == cn.get_operator_params(format, ops));
EXPECT_TRUE(format == 0);
EXPECT_TRUE(strcmp(ops.op_long, "12345") == 0);
EXPECT_TRUE(strlen(ops.op_short) == 0);
EXPECT_EQ(strlen(ops.op_short), 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesnt make sense but in my env it was failing EXPECT_TRUE style but not when using EXPECT_EQ.

Choose a reason for hiding this comment

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

strlen expects NULL terminated value, so check that code is doing it.
Some compilers auto assing to \0 and some don't so your failing case is actually a bug in the code
Don't fix unit test but the actual code.

Copy link
Contributor Author

@mirelachirica mirelachirica Sep 24, 2018

Choose a reason for hiding this comment

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

Added initialisation in constructor for the char arrays of operator_t. Problem solved.

@0xc0170 0xc0170 requested a review from a team September 24, 2018 10:35
Copy link

@AnttiKauppila AnttiKauppila left a comment

Choose a reason for hiding this comment

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

Check that read_string is putting trailing '\0' for buffer in all cases (seems that it is partially working now

@mirelachirica mirelachirica force-pushed the fix_network_and_util_ut branch from a8fce77 to 30da9c1 Compare September 24, 2018 12:17
@0xc0170
Copy link
Contributor

0xc0170 commented Sep 24, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Sep 24, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Sep 24, 2018

@mbed-ci
Copy link

mbed-ci commented Sep 25, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 25, 2018

/morph test

@mbed-ci
Copy link

mbed-ci commented Sep 25, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Sep 25, 2018

/morph test

@mbed-ci
Copy link

mbed-ci commented Sep 25, 2018

@cmonr cmonr merged commit 3bec1b7 into ARMmbed:master Sep 25, 2018
@cmonr cmonr removed the needs: CI label Sep 25, 2018
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.

7 participants