From fea3fd49becbcf1d8296c02c7b39b2493ab3514c Mon Sep 17 00:00:00 2001 From: Seppo Takalo Date: Wed, 30 Oct 2019 14:23:12 +0200 Subject: [PATCH] Add empty unittest to generate zero baseline for untested files. --- UNITTESTS/empty_baseline/empty_baseline.cpp | 39 ++++++++++++++++++++ UNITTESTS/empty_baseline/unittest.cmake | 23 ++++++++++++ features/device_key/source/DeviceKey.cpp | 12 +++--- features/storage/filesystem/FileSystem.h | 2 +- features/storage/kvstore/kv_map/KVMap.cpp | 6 +-- features/storage/kvstore/kv_map/KVMap.h | 6 +-- features/storage/kvstore/tdbstore/TDBStore.h | 6 +-- 7 files changed, 77 insertions(+), 17 deletions(-) create mode 100644 UNITTESTS/empty_baseline/empty_baseline.cpp create mode 100644 UNITTESTS/empty_baseline/unittest.cmake diff --git a/UNITTESTS/empty_baseline/empty_baseline.cpp b/UNITTESTS/empty_baseline/empty_baseline.cpp new file mode 100644 index 0000000000..a44075c7da --- /dev/null +++ b/UNITTESTS/empty_baseline/empty_baseline.cpp @@ -0,0 +1,39 @@ +/* Copyright (c) 2019 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + * + * 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. + */ + +#include "gtest/gtest.h" + +/* + * Purpose of this test is just to be empty baseline + * that does nothing, but includes all source files + * in the build. + * Do not add any tests here + */ + +class EmptyBaseline : public testing::Test { + virtual void SetUp() + { + } + + virtual void TearDown() + { + } +}; + +TEST_F(EmptyBaseline, constructor) +{ + EXPECT_TRUE(true); +} diff --git a/UNITTESTS/empty_baseline/unittest.cmake b/UNITTESTS/empty_baseline/unittest.cmake new file mode 100644 index 0000000000..505f91705a --- /dev/null +++ b/UNITTESTS/empty_baseline/unittest.cmake @@ -0,0 +1,23 @@ + +#################### +# UNIT TESTS +#################### + +set(unittest-includes ${unittest-includes} + . + .. + ../features/mbedtls/mbed-crypto/inc/mbedtls/ + ../features/mbedtls/platform/inc/ + ../features/frameworks/mbed-trace/mbed-trace/ +) + +set(unittest-sources + ../features/device_key/source/DeviceKey.cpp +) + +set(unittest-test-sources + empty_baseline/empty_baseline.cpp +) + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMBED_CONF_PLATFORM_CTHUNK_COUNT_MAX=10 -DDEVICE_ANALOGIN -DDEVICE_ANALOGOUT -DDEVICE_CAN -DDEVICE_CRC -DDEVICE_ETHERNET -DDEVICE_FLASH -DDEVICE_I2C -DDEVICE_I2CSLAVE -DDEVICE_I2C_ASYNCH -DDEVICE_INTERRUPTIN -DDEVICE_LPTICKER -DDEVICE_PORTIN -DDEVICE_PORTINOUT -DDEVICE_PORTOUT -DDEVICE_PWMOUT -DDEVICE_QSPI -DDEVICE_SERIAL -DDEVICE_SERIAL_ASYNCH -DDEVICE_SERIAL_FC -DDEVICE_SPI -DDEVICE_SPISLAVE -DDEVICE_SPI_ASYNCH -DDEVICE_FLASH -DCOMPONENT_FLASHIAP") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMBED_CONF_PLATFORM_CTHUNK_COUNT_MAX=10 -DDEVICE_ANALOGIN -DDEVICE_ANALOGOUT -DDEVICE_CAN -DDEVICE_CRC -DDEVICE_ETHERNET -DDEVICE_FLASH -DDEVICE_I2C -DDEVICE_I2CSLAVE -DDEVICE_I2C_ASYNCH -DDEVICE_INTERRUPTIN -DDEVICE_LPTICKER -DDEVICE_PORTIN -DDEVICE_PORTINOUT -DDEVICE_PORTOUT -DDEVICE_PWMOUT -DDEVICE_QSPI -DDEVICE_SERIAL -DDEVICE_SERIAL_ASYNCH -DDEVICE_SERIAL_FC -DDEVICE_SPI -DDEVICE_SPISLAVE -DDEVICE_SPI_ASYNCH -DDEVICE_FLASH -DCOMPONENT_FLASHIAP") \ No newline at end of file diff --git a/features/device_key/source/DeviceKey.cpp b/features/device_key/source/DeviceKey.cpp index 05e69e8d1b..d8e4eb1fda 100644 --- a/features/device_key/source/DeviceKey.cpp +++ b/features/device_key/source/DeviceKey.cpp @@ -20,18 +20,16 @@ #include "mbedtls/config.h" #include "mbedtls/cmac.h" #include "mbedtls/platform.h" -#include "KVStore.h" -#include "TDBStore.h" -#include "KVMap.h" -#include "kv_config.h" +#include "features/storage/kvstore/include/KVStore.h" +#include "features/storage/kvstore/tdbstore/TDBStore.h" +#include "features/storage/kvstore/kv_map/KVMap.h" +#include "features/storage/kvstore/conf/kv_config.h" #include "mbed_wait_api.h" -#include "stdlib.h" +#include #include "platform/mbed_error.h" #include #include "entropy.h" -#include "platform_mbed.h" #include "mbed_trace.h" -#include "ssl_internal.h" #define TRACE_GROUP "DEVKEY" diff --git a/features/storage/filesystem/FileSystem.h b/features/storage/filesystem/FileSystem.h index 1b90b7ec77..7096810c45 100644 --- a/features/storage/filesystem/FileSystem.h +++ b/features/storage/filesystem/FileSystem.h @@ -23,7 +23,7 @@ #include "platform/FileHandle.h" #include "platform/DirHandle.h" #include "platform/FileSystemLike.h" -#include "BlockDevice.h" +#include "features/storage/blockdevice/BlockDevice.h" namespace mbed { /** \addtogroup file system */ diff --git a/features/storage/kvstore/kv_map/KVMap.cpp b/features/storage/kvstore/kv_map/KVMap.cpp index 45ce0daa4d..a9dcb48980 100644 --- a/features/storage/kvstore/kv_map/KVMap.cpp +++ b/features/storage/kvstore/kv_map/KVMap.cpp @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "KVStore.h" -#include "KVMap.h" -#include "kv_config.h" +#include "features/storage/kvstore/include/KVStore.h" +#include "features/storage/kvstore/kv_map/KVMap.h" +#include "features/storage/kvstore/conf/kv_config.h" #include #include "string.h" #include "mbed_error.h" diff --git a/features/storage/kvstore/kv_map/KVMap.h b/features/storage/kvstore/kv_map/KVMap.h index 14acbe152c..d45731ee3c 100644 --- a/features/storage/kvstore/kv_map/KVMap.h +++ b/features/storage/kvstore/kv_map/KVMap.h @@ -16,11 +16,11 @@ #ifndef _KV_MAP #define _KV_MAP -#include "KVStore.h" +#include "features/storage/kvstore/include/KVStore.h" #include "platform/PlatformMutex.h" #include "platform/SingletonPtr.h" -#include "BlockDevice.h" -#include "FileSystem.h" +#include "features/storage/blockdevice/BlockDevice.h" +#include "features/storage/filesystem/FileSystem.h" namespace mbed { diff --git a/features/storage/kvstore/tdbstore/TDBStore.h b/features/storage/kvstore/tdbstore/TDBStore.h index 727ad7c7eb..e2a40d6ee7 100644 --- a/features/storage/kvstore/tdbstore/TDBStore.h +++ b/features/storage/kvstore/tdbstore/TDBStore.h @@ -19,9 +19,9 @@ #include #include -#include "KVStore.h" -#include "BlockDevice.h" -#include "BufferedBlockDevice.h" +#include "features/storage/kvstore/include/KVStore.h" +#include "features/storage/blockdevice/BlockDevice.h" +#include "features/storage/blockdevice/BufferedBlockDevice.h" #include "PlatformMutex.h" namespace mbed {