-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
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
Please review travis failures |
/morph build |
Build : SUCCESSBuild number : 1174 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 851 |
Test : SUCCESSBuild number : 979 |
There was a problem hiding this 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing test case here?
There was a problem hiding this comment.
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.
@donatieng I've added a README.md file containing the instructions to run the tests and more doc in the tests. |
@donatieng Mind doing a re-review? |
There was a problem hiding this 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
There was a problem hiding this 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 << ") " |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
/morph build |
Build : SUCCESSBuild number : 1501 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 1144 |
Test : FAILUREBuild number : 1284 |
/morph test |
Test : FAILUREBuild number : 1290 |
Had to replace a F429ZI device. Retesting. |
Test : FAILUREBuild number : 1299 |
/morph test |
Test : SUCCESSBuild number : 1303 |
Great stuff - Let's get this to master :) |
@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. |
Glad to see this progressing but from first glance this looks far from complete but hope I'm just missing something. |
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:
Migrations
NO