Skip to content

BLE: Gatt client unit tests #6086

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 6 commits into from
Mar 23, 2018
Merged

Conversation

pan-
Copy link
Member

@pan- pan- commented Feb 13, 2018

Description

Add units tests running on host for BLE. The current set of tests target the GattClient; these tests are build around gtest and gmock and solely run on a host:

  • cd features/FEATURE_BLE/tests
  • mkdir build
  • cd build
  • cmake ..
  • make
  • ./gatt-client-tests

Migrations

NO

pan- added 3 commits February 13, 2018 17:01
These tests are build around gtest and gmock and solely run on a host; cmake is
used as a build system:

- cd features/FEATURE_BLE/tests
- mkdir build
- cd build
- cmake ..
- make
- ./gatt-client-tests
@0xc0170
Copy link
Contributor

0xc0170 commented Feb 14, 2018

Please review travis failures

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 19, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Feb 19, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Feb 19, 2018

@mbed-ci
Copy link

mbed-ci commented Feb 19, 2018

Copy link
Contributor

@donatieng donatieng left a comment

Choose a reason for hiding this comment

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

Really good to add these :). Needs a README to and generally more doc (high level view describing different mocks and tests cases) at this stage.

################################

# Download and unpack googletest at configure time
configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe rename CMakeLists.txt.in to something more explicit as it's a bit confusing having CMakeLists.txt.in and a CMakeLists.txt in the same directory.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've followed instructions provided by google test. What name do you want ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Something like googletest-CMakeLists.txt.in or similar.

}
};

class TestGattClientDescriptorDiscovery : public ::testing::Test {
Copy link
Contributor

Choose a reason for hiding this comment

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

Need a bit of doc on what the purpose of that class is

EXPECT_EQ(err, BLE_ERROR_NONE);
}

typedef tuple<uint16_t, uint16_t, vector<vector<pair<uint16_t, UUID>>>> test_param_t;
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs description, maybe more explicit naming

* When the client call terminateCharacteristicDescriptorDiscovery the termination
* callback is called immediately.
*/

Copy link
Contributor

Choose a reason for hiding this comment

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

Missing test case here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, this test is present line 160. That's an edition mistake.

@pan-
Copy link
Member Author

pan- commented Feb 27, 2018

@donatieng I've added a README.md file containing the instructions to run the tests and more doc in the tests.

@cmonr
Copy link
Contributor

cmonr commented Mar 6, 2018

@donatieng Mind doing a re-review?
@paul-szczepanek-arm Ping?

Copy link
Contributor

@donatieng donatieng left a comment

Choose a reason for hiding this comment

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

Great progress there - would want @OPpuolitaival's review

Copy link
Contributor

@OPpuolitaival OPpuolitaival left a comment

Choose a reason for hiding this comment

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

Looks good

// if counter didn't wrap then send an error
if (next_attribute_handle != 0) {
// set expectation on the discovery function
//Log::info() << "expect discover_primary_service_by_service_uuid(" << connection_handle << ", " << next_attribute_handle << "," << service_filter << ") "
Copy link
Contributor

Choose a reason for hiding this comment

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

Why these log lines are commented out?

Copy link
Member Author

Choose a reason for hiding this comment

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

They can be removed; they are a residue of test developments.

Copy link
Contributor

Choose a reason for hiding this comment

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

Assuming that the log comments won't be removed.

If they still will be, then we can restart CI once that commit is in.

@cmonr
Copy link
Contributor

cmonr commented Mar 21, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Mar 21, 2018

Build : SUCCESS

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

Triggering tests

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

@mbed-ci
Copy link

mbed-ci commented Mar 21, 2018

@mbed-ci
Copy link

mbed-ci commented Mar 21, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 21, 2018

/morph test

@mbed-ci
Copy link

mbed-ci commented Mar 21, 2018

@cmonr
Copy link
Contributor

cmonr commented Mar 21, 2018

Had to replace a F429ZI device.

Retesting.
/morph test

@mbed-ci
Copy link

mbed-ci commented Mar 22, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 22, 2018

/morph test

@mbed-ci
Copy link

mbed-ci commented Mar 22, 2018

@donatieng
Copy link
Contributor

Great stuff - Let's get this to master :)
@OPpuolitaival this could be a good showcase example for unit-testing within mbed OS!

@OPpuolitaival
Copy link
Contributor

@donatieng yes this is. I just would like to see one common way to do unit testing instead that all teams create own approach. But yes google test looks much better tool than cpputest.

@cmonr cmonr merged commit 387027d into ARMmbed:master Mar 23, 2018
@sg-
Copy link
Contributor

sg- commented Mar 26, 2018

  • Are the docs in the handbook for how Mbed OS unit testing works?
  • Why is this based on CMake? Nothing in Mbed OS is based on CMake
  • Why is this part of a patch release?

Glad to see this progressing but from first glance this looks far from complete but hope I'm just missing something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants