From e4950dca630a6321bbb3b8da1fb3c70a8e31ffc4 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 25 Nov 2020 15:02:07 -0500 Subject: [PATCH] Update src/lib/core/tests to auto-test-driver generation --- src/lib/core/tests/BUILD.gn | 10 +---- src/lib/core/tests/TestCHIPCallback.cpp | 3 -- src/lib/core/tests/TestCHIPCallbackDriver.cpp | 35 --------------- src/lib/core/tests/TestCHIPErrorStr.cpp | 2 - src/lib/core/tests/TestCHIPErrorStrDriver.cpp | 35 --------------- src/lib/core/tests/TestCHIPTLV.cpp | 2 - src/lib/core/tests/TestCHIPTLVDriver.cpp | 45 ------------------- src/lib/core/tests/TestCore.h | 38 ---------------- src/lib/core/tests/TestReferenceCounted.cpp | 2 - .../core/tests/TestReferenceCountedDriver.cpp | 35 --------------- 10 files changed, 1 insertion(+), 206 deletions(-) delete mode 100644 src/lib/core/tests/TestCHIPCallbackDriver.cpp delete mode 100644 src/lib/core/tests/TestCHIPErrorStrDriver.cpp delete mode 100644 src/lib/core/tests/TestCHIPTLVDriver.cpp delete mode 100644 src/lib/core/tests/TestCore.h delete mode 100644 src/lib/core/tests/TestReferenceCountedDriver.cpp diff --git a/src/lib/core/tests/BUILD.gn b/src/lib/core/tests/BUILD.gn index 2686af32916138..92b13a2a0259e1 100644 --- a/src/lib/core/tests/BUILD.gn +++ b/src/lib/core/tests/BUILD.gn @@ -20,11 +20,10 @@ import("${chip_root}/build/chip/chip_test_suite.gni") chip_test_suite("tests") { output_name = "libCoreTests" - sources = [ + test_sources = [ "TestCHIPCallback.cpp", "TestCHIPErrorStr.cpp", "TestCHIPTLV.cpp", - "TestCore.h", "TestReferenceCounted.cpp", ] @@ -34,11 +33,4 @@ chip_test_suite("tests") { "${chip_root}/src/lib/core", "${nlunit_test_root}:nlunit-test", ] - - tests = [ - "TestCHIPErrorStr", - "TestReferenceCounted", - "TestCHIPTLV", - "TestCHIPCallback", - ] } diff --git a/src/lib/core/tests/TestCHIPCallback.cpp b/src/lib/core/tests/TestCHIPCallback.cpp index a8c8df63e640cc..2df07b5c0b3ea5 100644 --- a/src/lib/core/tests/TestCHIPCallback.cpp +++ b/src/lib/core/tests/TestCHIPCallback.cpp @@ -21,9 +21,6 @@ * This file implements a test for CHIP Callback * */ - -#include "TestCore.h" - #include #include #include diff --git a/src/lib/core/tests/TestCHIPCallbackDriver.cpp b/src/lib/core/tests/TestCHIPCallbackDriver.cpp deleted file mode 100644 index 090556f26dae1b..00000000000000 --- a/src/lib/core/tests/TestCHIPCallbackDriver.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * - * 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. - */ - -/** - * @file - * This file implements a standalone/native program executable - * test driver for the CHIP core library Callback classes - * - */ - -#include "TestCore.h" - -#include - -int main() -{ - // Generate machine-readable, comma-separated value (CSV) output. - nlTestSetOutputStyle(OUTPUT_CSV); - - return (TestCHIPCallback()); -} diff --git a/src/lib/core/tests/TestCHIPErrorStr.cpp b/src/lib/core/tests/TestCHIPErrorStr.cpp index ae5a2272bed4cd..773cddcc3c4c02 100644 --- a/src/lib/core/tests/TestCHIPErrorStr.cpp +++ b/src/lib/core/tests/TestCHIPErrorStr.cpp @@ -32,8 +32,6 @@ #define __STDC_LIMIT_MACROS #endif -#include "TestCore.h" - #include #include #include diff --git a/src/lib/core/tests/TestCHIPErrorStrDriver.cpp b/src/lib/core/tests/TestCHIPErrorStrDriver.cpp deleted file mode 100644 index 1139acdd9048ce..00000000000000 --- a/src/lib/core/tests/TestCHIPErrorStrDriver.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * - * 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. - */ - -/** - * @file - * This file implements a standalone/native program executable - * test driver for the CHIP core library error string unit tests. - * - */ - -#include "TestCore.h" - -#include - -int main() -{ - // Generate machine-readable, comma-separated value (CSV) output. - nlTestSetOutputStyle(OUTPUT_CSV); - - return (TestCHIPErrorStr()); -} diff --git a/src/lib/core/tests/TestCHIPTLV.cpp b/src/lib/core/tests/TestCHIPTLV.cpp index 671d0fb735e2f5..a57b6b802065b9 100644 --- a/src/lib/core/tests/TestCHIPTLV.cpp +++ b/src/lib/core/tests/TestCHIPTLV.cpp @@ -23,8 +23,6 @@ * */ -#include "TestCore.h" - #include #include diff --git a/src/lib/core/tests/TestCHIPTLVDriver.cpp b/src/lib/core/tests/TestCHIPTLVDriver.cpp deleted file mode 100644 index 67a5d74a23fa62..00000000000000 --- a/src/lib/core/tests/TestCHIPTLVDriver.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * - * 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. - */ - -/** - * @file - * This file implements a standalone/native program executable - * test driver for the CHIP TLV unit tests. - * - */ - -#include "TestCore.h" - -#include - -#if CHIP_SYSTEM_CONFIG_USE_LWIP -#include -#endif // CHIP_SYSTEM_CONFIG_USE_LWIP - -#include - -int main() -{ -#if CHIP_SYSTEM_CONFIG_USE_LWIP - tcpip_init(NULL, NULL); -#endif // CHIP_SYSTEM_CONFIG_USE_LWIP - - // Generate machine-readable, comma-separated value (CSV) output. - nlTestSetOutputStyle(OUTPUT_CSV); - - return (TestCHIPTLV()); -} diff --git a/src/lib/core/tests/TestCore.h b/src/lib/core/tests/TestCore.h deleted file mode 100644 index ea5e13da25528c..00000000000000 --- a/src/lib/core/tests/TestCore.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * - * 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. - */ - -/** - * @file - * This file declares test entry points for CHIP core library - * unit tests. - * - */ - -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -int TestCHIPCallback(void); -int TestCHIPErrorStr(void); -int TestCHIPTLV(void); -int TestReferenceCounted(void); - -#ifdef __cplusplus -} -#endif diff --git a/src/lib/core/tests/TestReferenceCounted.cpp b/src/lib/core/tests/TestReferenceCounted.cpp index 77a9af59cc5f8e..8f71770272a657 100644 --- a/src/lib/core/tests/TestReferenceCounted.cpp +++ b/src/lib/core/tests/TestReferenceCounted.cpp @@ -23,8 +23,6 @@ * */ -#include "TestCore.h" - #include #include #include diff --git a/src/lib/core/tests/TestReferenceCountedDriver.cpp b/src/lib/core/tests/TestReferenceCountedDriver.cpp deleted file mode 100644 index 57dd578e97f052..00000000000000 --- a/src/lib/core/tests/TestReferenceCountedDriver.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * - * 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. - */ - -/** - * @file - * This file implements a standalone/native program executable - * test driver for the CHIP core library reference counted object tests. - * - */ - -#include "TestCore.h" - -#include - -int main() -{ - // Generate machine-readable, comma-separated value (CSV) output. - nlTestSetOutputStyle(OUTPUT_CSV); - - return (TestReferenceCounted()); -}