Skip to content

Restructure storage blockdevice directory #13273

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 5 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 0 deletions .astyleignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@
^TESTS/mbed_hal/trng/pithy
^tools
^UNITTESTS
^storage/blockdevice/tests/UNITTESTS
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it's possible to match all UNITTESTS in mbed-os

2 changes: 1 addition & 1 deletion UNITTESTS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ set(unittest-includes-base
"${PROJECT_SOURCE_DIR}/../features"
"${PROJECT_SOURCE_DIR}/../features/netsocket"
"${PROJECT_SOURCE_DIR}/../platform"
"${PROJECT_SOURCE_DIR}/../storage"
"${PROJECT_SOURCE_DIR}/../storage/blockdevice/include"
"${PROJECT_SOURCE_DIR}/../drivers"
"${PROJECT_SOURCE_DIR}/../hal"
"${PROJECT_SOURCE_DIR}/../events"
Expand Down
17 changes: 0 additions & 17 deletions UNITTESTS/empty_baseline/unittest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ set(unittest-includes ${unittest-includes}
)

set(unittest-sources
../features/device_key/source/DeviceKey.cpp
../storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.cpp
../storage/blockdevice/COMPONENT_I2CEE/I2CEEBlockDevice.cpp
../storage/blockdevice/COMPONENT_DATAFLASH/DataFlashBlockDevice.cpp
../storage/blockdevice/COMPONENT_FLASHIAP/FlashIAPBlockDevice.cpp
../storage/blockdevice/COMPONENT_SD/SDBlockDevice.cpp
../storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.cpp
../storage/filesystem/Dir.cpp
../storage/filesystem/FileSystem.cpp
../storage/filesystem/File.cpp
Expand All @@ -30,16 +23,6 @@ set(unittest-sources
../storage/kvstore/conf/kv_config.cpp
../storage/kvstore/filesystemstore/FileSystemStore.cpp
../storage/system_storage/SystemStorage.cpp
../storage/blockdevice/ChainingBlockDevice.cpp
../storage/blockdevice/ReadOnlyBlockDevice.cpp
../storage/blockdevice/SlicingBlockDevice.cpp
../storage/blockdevice/MBRBlockDevice.cpp
../storage/blockdevice/HeapBlockDevice.cpp
../storage/blockdevice/FlashSimBlockDevice.cpp
../storage/blockdevice/ObservingBlockDevice.cpp
../storage/blockdevice/ProfilingBlockDevice.cpp
../storage/blockdevice/BufferedBlockDevice.cpp
../storage/blockdevice/ExhaustibleBlockDevice.cpp
)

set(unittest-test-sources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#include "gtest/gtest.h"
#include "storage/blockdevice/HeapBlockDevice.h"
#include "blockdevice/HeapBlockDevice.h"
#include "storage/kvstore/filesystemstore/FileSystemStore.h"
#include "storage/filesystem/littlefs/LittleFileSystem.h"
#include "mbed_error.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set(unittest-includes ${unittest-includes}
)

set(unittest-sources
../storage/blockdevice/HeapBlockDevice.cpp
../storage/blockdevice/source/HeapBlockDevice.cpp
../storage/kvstore/filesystemstore/FileSystemStore.cpp
../storage/filesystem/littlefs/LittleFileSystem.cpp
../storage/filesystem/Dir.cpp
Expand Down
4 changes: 2 additions & 2 deletions UNITTESTS/moduletests/storage/kvstore/TDBStore/moduletest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

#include "gtest/gtest.h"
#include "storage/blockdevice/HeapBlockDevice.h"
#include "storage/blockdevice/FlashSimBlockDevice.h"
#include "blockdevice/HeapBlockDevice.h"
#include "blockdevice/FlashSimBlockDevice.h"
#include "storage/kvstore/tdbstore/TDBStore.h"
#include <stdlib.h>

Expand Down
6 changes: 3 additions & 3 deletions UNITTESTS/moduletests/storage/kvstore/TDBStore/unittest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ set(unittest-includes ${unittest-includes}
)

set(unittest-sources
../storage/blockdevice/FlashSimBlockDevice.cpp
../storage/blockdevice/HeapBlockDevice.cpp
../storage/blockdevice/BufferedBlockDevice.cpp
../storage/blockdevice/source/FlashSimBlockDevice.cpp
../storage/blockdevice/source/HeapBlockDevice.cpp
../storage/blockdevice/source/BufferedBlockDevice.cpp
../storage/kvstore/tdbstore/TDBStore.cpp
../features/frameworks/mbed-trace/source/mbed_trace.c
stubs/mbed_atomic_stub.c
Expand Down
20 changes: 0 additions & 20 deletions UNITTESTS/storage/blockdevice/ChainingBlockDevice/unittest.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion UNITTESTS/stubs/BlockDevice_mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include "storage/blockdevice/BlockDevice.h"
#include "blockdevice/BlockDevice.h"

class BlockDeviceMock : public BlockDevice {
public:
Expand Down
2 changes: 1 addition & 1 deletion UNITTESTS/stubs/EmulatedSD.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef EMULATEDSD_H
#define EMULATEDSD_H

#include "storage/blockdevice/BlockDevice.h"
#include "blockdevice/BlockDevice.h"

class EmulatedSD_Private;

Expand Down
2 changes: 1 addition & 1 deletion drivers/internal/SFDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <cstddef>
#include <cstdint>
#include "storage/blockdevice/BlockDevice.h"
#include "blockdevice/BlockDevice.h"
#include "platform/Callback.h"

namespace mbed {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "platform/PlatformMutex.h"
#include "PinNames.h"
#include "storage/blockdevice/BlockDevice.h"
#include "blockdevice/BlockDevice.h"
#include "drivers/SPI.h"
#include "drivers/DigitalOut.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#if DEVICE_FLASH

#include "FlashIAP.h"
#include "storage/blockdevice/BlockDevice.h"
#include "blockdevice/BlockDevice.h"
#include "platform/mbed_toolchain.h"

/** BlockDevice using the FlashIAP API
Expand Down
2 changes: 1 addition & 1 deletion storage/blockdevice/COMPONENT_I2CEE/I2CEEBlockDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef MBED_I2CEEPROM_BLOCK_DEVICE_H
#define MBED_I2CEEPROM_BLOCK_DEVICE_H

#include "storage/blockdevice/BlockDevice.h"
#include "blockdevice/BlockDevice.h"
#include "drivers/I2C.h"

/** BlockDevice for I2C based flash device such as
Expand Down
2 changes: 1 addition & 1 deletion storage/blockdevice/COMPONENT_QSPIF/QSPIFBlockDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "drivers/QSPI.h"
#include "drivers/internal/SFDP.h"
#include "storage/blockdevice/BlockDevice.h"
#include "blockdevice/BlockDevice.h"
#include "platform/Callback.h"

#ifndef MBED_CONF_QSPIF_QSPI_IO0
Expand Down
2 changes: 1 addition & 1 deletion storage/blockdevice/COMPONENT_SD/SDBlockDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/* If the target has no SPI support, then SD Card is not supported. */
#if DEVICE_SPI

#include "storage/blockdevice/BlockDevice.h"
#include "blockdevice/BlockDevice.h"
#include "drivers/SPI.h"
#include "drivers/Timer.h"
#include "drivers/MbedCRC.h"
Expand Down
2 changes: 1 addition & 1 deletion storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "drivers/SPI.h"
#include "drivers/DigitalOut.h"
#include "drivers/internal/SFDP.h"
#include "storage/blockdevice/BlockDevice.h"
#include "blockdevice/BlockDevice.h"

#ifndef MBED_CONF_SPIF_DRIVER_SPI_MOSI
#define MBED_CONF_SPIF_DRIVER_SPI_MOSI NC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "BufferedBlockDevice.h"
#include "blockdevice/BufferedBlockDevice.h"
#include "platform/mbed_assert.h"
#include "platform/mbed_atomic.h"
#include <algorithm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "ChainingBlockDevice.h"
#include "blockdevice/ChainingBlockDevice.h"
#include "platform/mbed_atomic.h"
#include "platform/mbed_assert.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "ExhaustibleBlockDevice.h"
#include "blockdevice/ExhaustibleBlockDevice.h"
#include "platform/mbed_atomic.h"
#include "platform/mbed_assert.h"

Expand Down Expand Up @@ -209,4 +209,3 @@ const char *ExhaustibleBlockDevice::get_type() const
}

} // namespace mbed

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "FlashSimBlockDevice.h"
#include "blockdevice/FlashSimBlockDevice.h"
#include "platform/mbed_assert.h"
#include "platform/mbed_atomic.h"
#include <algorithm>
Expand Down Expand Up @@ -230,4 +230,3 @@ const char *FlashSimBlockDevice::get_type() const
}

} // namespace mbed

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "HeapBlockDevice.h"
#include "blockdevice/HeapBlockDevice.h"
#include "platform/mbed_atomic.h"
#include <stdlib.h>
#include <string.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "MBRBlockDevice.h"
#include "blockdevice/MBRBlockDevice.h"
#include "platform/mbed_atomic.h"
#include "platform/mbed_toolchain.h"
#include "platform/mbed_assert.h"
Expand Down Expand Up @@ -453,4 +453,3 @@ const char *MBRBlockDevice::get_type() const
}

} // namespace mbed

Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
* SOFTWARE.
*/

#include "ObservingBlockDevice.h"
#include "ReadOnlyBlockDevice.h"
#include "blockdevice/ObservingBlockDevice.h"
#include "blockdevice/ReadOnlyBlockDevice.h"

namespace mbed {

Expand Down Expand Up @@ -121,4 +121,3 @@ const char *ObservingBlockDevice::get_type() const
}

} // namespace mbed

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "ProfilingBlockDevice.h"
#include "blockdevice/ProfilingBlockDevice.h"
#include "stddef.h"

namespace mbed {
Expand Down Expand Up @@ -131,4 +131,3 @@ const char *ProfilingBlockDevice::get_type() const
}

} // namespace mbed

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/** \addtogroup storage */
/** @{*/

#include "ReadOnlyBlockDevice.h"
#include "blockdevice/ReadOnlyBlockDevice.h"
#include "platform/mbed_error.h"

namespace mbed {
Expand Down Expand Up @@ -111,5 +111,3 @@ const char *ReadOnlyBlockDevice::get_type() const
} // namespace mbed

/** @}*/


Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "SlicingBlockDevice.h"
#include "blockdevice/SlicingBlockDevice.h"
#include "platform/mbed_assert.h"
#include "stddef.h"
#include <stdio.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,3 @@ int main()
{
return !Harness::run(specification);
}

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Use `mbed test` again:
```
mbed test -m K64F -t ARM -n mbed-os-features-storage-tests-blockdevice-general_block_device --run -v
```

#### Troubleshooting

Please review the [documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html) for suggestions about how to fix possible issues you may face.
Expand Down
1 change: 1 addition & 0 deletions storage/blockdevice/tests/UNITTESTS/.mbedignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#include "gtest/gtest.h"
#include "storage/blockdevice/BufferedBlockDevice.h"
#include "blockdevice/BufferedBlockDevice.h"
#include "stubs/BlockDevice_mock.h"

using ::testing::_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ set(unittest-includes ${unittest-includes}
)

set(unittest-sources
../storage/blockdevice/BufferedBlockDevice.cpp
../storage/blockdevice/source/BufferedBlockDevice.cpp
stubs/mbed_atomic_stub.c
stubs/mbed_assert_stub.cpp
)

set(unittest-test-sources
storage/blockdevice/BufferedBlockDevice/test_BufferedBlockDevice.cpp
${CMAKE_CURRENT_LIST_DIR}/test_BufferedBlockDevice.cpp
stubs/BlockDevice_mock.h
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#include "gtest/gtest.h"
#include "storage/blockdevice/ChainingBlockDevice.cpp"
#include "ChainingBlockDevice.cpp"
#include "stubs/BlockDevice_mock.h"

using ::testing::_;
Expand Down Expand Up @@ -160,4 +160,3 @@ TEST_F(ChainingBlockModuleTest, memory_overlap)

EXPECT_EQ(bd.erase((SECTORS_NUM / 2 - 2) * BLOCK_SIZE, 4 * BLOCK_SIZE), BD_ERROR_OK);
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
set(unittest-includes ${unittest-includes}
.
..
../storage/blockdevice/source
)

set(unittest-sources
../storage/blockdevice/SlicingBlockDevice.cpp
../storage/blockdevice/HeapBlockDevice.cpp
../storage/blockdevice/source/ChainingBlockDevice.cpp
../storage/blockdevice/source/HeapBlockDevice.cpp
stubs/mbed_atomic_stub.c
stubs/mbed_assert_stub.cpp
)

set(unittest-test-sources
moduletests/storage/blockdevice/SlicingBlockDevice/moduletest.cpp
${CMAKE_CURRENT_LIST_DIR}/test_ChainingBlockDevice.cpp
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#include "gtest/gtest.h"
#include "storage/blockdevice/ExhaustibleBlockDevice.h"
#include "blockdevice/ExhaustibleBlockDevice.h"
#include "stubs/BlockDevice_mock.h"

#define BLOCK_SIZE (512)
Expand Down
Loading