Skip to content
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

Replace nl-unit-test with pigweed for protocols/secure_channel #33499

Merged
merged 36 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3887949
secure channel tests to pigweed
jlatusek May 15, 2024
ea09c42
Remove nlunit tests dependency
jlatusek May 15, 2024
72b3dc0
Update conversion to pigweed
jlatusek May 16, 2024
b1a4672
Relocate class
jlatusek May 16, 2024
3891599
Revert old implementation
jlatusek May 16, 2024
500b043
Restore
jlatusek May 16, 2024
5b7cf03
Move definition of TEST_F_FROM_FIXTURE to UnitTest
jlatusek May 16, 2024
add058f
Fix test error
jlatusek May 16, 2024
5f6fd69
Add missing deps
jlatusek May 17, 2024
71e6c72
Revert order change
jlatusek May 17, 2024
99cf0c1
Restyle
jlatusek May 17, 2024
192aa02
Revert
jlatusek May 17, 2024
df67710
Add missing header
jlatusek May 17, 2024
dffd725
Add UnitTestPigweedUtils
jlatusek May 17, 2024
568ab49
IoT SDK update tests list
jlatusek May 17, 2024
d7d571b
Remove unused define
jlatusek May 17, 2024
ef5c20a
Change target type
jlatusek May 17, 2024
467ae6c
license
jlatusek May 21, 2024
0448aac
Assert
jlatusek May 21, 2024
cb4269a
rollback
jlatusek May 21, 2024
31dec0e
cleanup
jlatusek May 21, 2024
4e1be2d
Change function to method
jlatusek May 21, 2024
9cced42
Restyle
jlatusek May 21, 2024
00f8f73
Fix dependency between tests
jlatusek May 23, 2024
a60168a
Merge branch 'tests-order-fix' into protocol-pigweed
jlatusek May 24, 2024
e9ee418
Merge branch 'master' of https://github.com/project-chip/connectedhom…
jlatusek May 24, 2024
71bc5b7
Fix merge
jlatusek May 24, 2024
fb3758f
Fix
jlatusek May 24, 2024
7f203fc
Review fix
jlatusek May 27, 2024
d5eb6fb
Merge remote-tracking branch 'upstream/master' into protocol-pigweed
jlatusek May 27, 2024
1e5d972
Fix typo
jlatusek May 27, 2024
db32be7
Merge remote-tracking branch 'upstream/master' into protocol-pigweed
jlatusek May 29, 2024
8f8a2c1
Fix review issues
jlatusek Jun 3, 2024
3a5ece4
Merge branch 'master' of https://github.com/project-chip/connectedhom…
jlatusek Jun 3, 2024
fda317b
Fix review issues
jlatusek Jun 3, 2024
c474580
Merge branch 'master' into protocol-pigweed
jlatusek Jun 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ if (chip_build_tests) {
"${chip_root}/src/lib/format/tests",
"${chip_root}/src/lib/support/tests",
"${chip_root}/src/protocols/secure_channel/tests",
"${chip_root}/src/protocols/secure_channel/tests:tests_nltest",
"${chip_root}/src/system/tests",
"${chip_root}/src/transport/tests",
]
Expand Down
9 changes: 9 additions & 0 deletions src/lib/support/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ import("//build_overrides/pigweed.gni")

import("${chip_root}/build/chip/chip_test_suite.gni")

pw_source_set("pw-test-macros") {
output_dir = "${root_out_dir}/lib"
public_deps = [
"$dir_pw_log:impl",
"$dir_pw_unit_test",
]
sources = [ "ExtraPwTestMacros.h" ]
}

chip_test_suite("tests") {
output_name = "libSupportTests"

Expand Down
56 changes: 56 additions & 0 deletions src/lib/support/tests/ExtraPwTestMacros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
*
* Copyright (c) 2024 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once

/*
* Run Fixture's class function as a test.
* It is used to execute test cases that need to use private members of a particular class.
* Unlike the pigweed macro `FRIEND_TEST`, this approach allows you to define the entire
* test_fixture class as a friend, rather than having to define each testcase as a friend.
*
* @param test_fixture - the fixture class.
*
* @param test_name - the name of the test function.
*
* Example:
* class Foo // class to be tested
* {
* friend class TestCtx;
* private:
* bool privateFunction();
* };
*
* class TestCtx: public ::testing::Test
* {
* public:
* void testFunction();
* };
*
* TEST_F_FROM_FIXTURE(TestCtx, testFunction)
* {
* Foo foo;
* EXPECT_TRUE(foo.privateFunction());
* }
*
*/
#define TEST_F_FROM_FIXTURE(test_fixture, test_name) \
TEST_F(test_fixture, test_name) \
{ \
test_name(); \
} \
void test_fixture::test_name()
38 changes: 9 additions & 29 deletions src/protocols/secure_channel/tests/BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,39 +1,15 @@
import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/nlunit_test.gni")
import("${chip_root}/build/chip/chip_test_suite.gni")
import("${chip_root}/src/app/icd/icd.gni")

chip_test_suite("tests") {
output_name = "libSecureChannelTests"

test_sources = [
"TestCASESession.cpp",
"TestCheckInCounter.cpp",
"TestCheckinMsg.cpp",
]

sources = [ "CheckIn_Message_test_vectors.h" ]

cflags = [ "-Wconversion" ]
public_deps = [
"${chip_root}/src/app/icd/server:icd-server-config",
"${chip_root}/src/credentials/tests:cert_test_vectors",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/lib/support:test_utils",
"${chip_root}/src/lib/support:testing",
"${chip_root}/src/protocols/secure_channel",
"${chip_root}/src/protocols/secure_channel:check-in-counter",
"${dir_pw_unit_test}",
]
}

chip_test_suite_using_nltest("tests_nltest") {
# Renamed ouput during the transition away from nltest
output_name = "libSecureChannelTestsNL"

test_sources = [
"TestCASESession.cpp",
"TestDefaultSessionResumptionStorage.cpp",
"TestPASESession.cpp",
"TestPairingSession.cpp",
Expand All @@ -44,22 +20,26 @@ chip_test_suite_using_nltest("tests_nltest") {
# "TestMessageCounterManager.cpp",
]

sources = [ "CheckIn_Message_test_vectors.h" ]

cflags = [ "-Wconversion" ]
public_deps = [
"${chip_root}/src/app/icd/server:icd-server-config",
"${chip_root}/src/credentials/tests:cert_test_vectors",
"${chip_root}/src/crypto/tests:tests.lib",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/lib/support:test_utils",
"${chip_root}/src/lib/support:testing",
"${chip_root}/src/lib/support:testing_nlunit",
"${chip_root}/src/lib/support/tests:pw-test-macros",
"${chip_root}/src/messaging/tests:helpers",
"${chip_root}/src/protocols",
"${chip_root}/src/protocols/secure_channel",
"${chip_root}/src/protocols/secure_channel:check-in-counter",
"${chip_root}/src/transport/raw/tests:helpers",
"${nlunit_test_root}:nlunit-test",
"${dir_pw_unit_test}",
]

cflags = [ "-Wconversion" ]

if (chip_enable_icd_server) {
public_deps += [ "${chip_root}/src/app/icd/server:configuration-data" ]
}
Expand Down
Loading
Loading