Skip to content

Commit d8e2dd5

Browse files
committed
Incorporated the review comments
1 parent 8ecce14 commit d8e2dd5

File tree

9 files changed

+21
-26
lines changed

9 files changed

+21
-26
lines changed

components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,9 +872,7 @@ uint32_t SDBlockDevice::_go_idle_state()
872872
if (R1_IDLE_STATE == response) {
873873
break;
874874
}
875-
#if defined(MBED_CONF_RTOS_PRESENT)
876875
rtos::ThisThread::sleep_for(1);
877-
#endif
878876
}
879877
return response;
880878
}

components/storage/blockdevice/COMPONENT_SD/TESTS/filesystem/parallel/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616
#if !defined(MBED_CONF_RTOS_PRESENT)
17-
#error [NOT_SUPPORTED] filesystem test cases requires RTOS to run
17+
#error [NOT_SUPPORTED] filesystem test cases require a RTOS to run
1818
#else
1919

2020
#include "mbed.h"

features/device_key/TESTS/device_key/functionality/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
#if !DEVICEKEY_ENABLED
18-
#error [NOT_SUPPORTED] DeviceKey needs to be enabled for this test
19-
#else
20-
2117
#include "DeviceKey.h"
2218
#include "mbedtls/config.h"
2319
#include "utest/utest.h"
@@ -32,6 +28,10 @@
3228
using namespace utest::v1;
3329
using namespace mbed;
3430

31+
#if !DEVICEKEY_ENABLED
32+
#error [NOT_SUPPORTED] DeviceKey needs to be enabled for this test
33+
#else
34+
3535
#define MSG_VALUE_DUMMY "0"
3636
#define MSG_VALUE_LEN 32
3737
#define MSG_KEY_LEN 32

features/storage/TESTS/blockdevice/general_block_device/main.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,9 @@ void test_random_program_read_erase()
308308
delete[] write_block;
309309
}
310310

311+
#if defined(MBED_CONF_RTOS_PRESENT)
311312
static void test_thread_job()
312313
{
313-
#if defined(MBED_CONF_RTOS_PRESENT)
314314
static int thread_num = 0;
315315
_mutex->lock();
316316
int block_num = thread_num++ % TEST_NUM_OF_THREADS;
@@ -336,12 +336,10 @@ static void test_thread_job()
336336
end:
337337
delete[] read_block;
338338
delete[] write_block;
339-
#endif
340339
}
341340

342341
void test_multi_threads()
343342
{
344-
#if defined(MBED_CONF_RTOS_PRESENT)
345343
utest_printf("\nTest Multi Threaded Erase/Program/Read Starts..\n");
346344

347345
TEST_SKIP_UNLESS_MESSAGE(block_device != NULL, "no block device found.");
@@ -395,8 +393,8 @@ void test_multi_threads()
395393

396394
delete[] bd_thread;
397395
}
398-
#endif
399396
}
397+
#endif
400398

401399
void test_erase_functionality()
402400
{

features/storage/TESTS/kvstore/filesystemstore_tests/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* limitations under the License.
1717
*/
1818
#if !defined(MBED_CONF_RTOS_PRESENT)
19-
#error [NOT_SUPPORTED] Kvstore API test cases requires RTOS to run
19+
#error [NOT_SUPPORTED] Kvstore API test cases require a RTOS to run
2020
#else
2121

2222
#include "rtos/Thread.h"

features/storage/TESTS/kvstore/general_tests_phase_1/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717
#if !defined(MBED_CONF_RTOS_PRESENT)
18-
#error [NOT_SUPPORTED] Kvstore API test cases requires RTOS to run
18+
#error [NOT_SUPPORTED] Kvstore API test cases require a RTOS to run
1919
#else
2020

2121
#include "SecureStore.h"

features/storage/TESTS/kvstore/general_tests_phase_2/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717
#if !defined(MBED_CONF_RTOS_PRESENT)
18-
#error [NOT_SUPPORTED] Kvstore API test cases requires RTOS to run
18+
#error [NOT_SUPPORTED] Kvstore API test cases require a RTOS to run
1919
#else
2020

2121
#include "SecureStore.h"

features/storage/TESTS/kvstore/static_tests/main.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ static const char num_of_keys = 3;
3838
#if defined(MBED_CONF_RTOS_PRESENT)
3939
/* Forked 3 threads plus misc, so minimum (4 * OS_STACK_SIZE) heap are required. */
4040
static const int heap_alloc_threshold_size = 4 * OS_STACK_SIZE;
41+
#else
42+
/* Bare metal does not require memory for threads, so use just minimum for test */
43+
static const int heap_alloc_threshold_size = MBED_CONF_TARGET_BOOT_STACK_SIZE;
4144
#endif
4245
static const char *keys[] = {"key1", "key2", "key3"};
4346

@@ -69,7 +72,6 @@ static void parse_default_kv()
6972
//init the blockdevice
7073
static void kvstore_init()
7174
{
72-
#if defined(MBED_CONF_RTOS_PRESENT)
7375
uint8_t *dummy = new (std::nothrow) uint8_t[heap_alloc_threshold_size];
7476
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough heap to run test");
7577
delete[] dummy;
@@ -79,7 +81,6 @@ static void kvstore_init()
7981
init_res = kv_reset(def_kv);
8082
TEST_SKIP_UNLESS_MESSAGE(init_res != MBED_ERROR_UNSUPPORTED, "Unsupported configuration. Test skipped.");
8183
TEST_ASSERT_EQUAL_ERROR_CODE(MBED_SUCCESS, init_res);
82-
#endif
8384
}
8485

8586
/*----------------set()------------------*/

features/storage/nvstore/TESTS/nvstore/functionality/main.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
#if !NVSTORE_ENABLED
18-
#error [NOT_SUPPORTED] NVSTORE needs to be enabled for this test
19-
#else
2017

2118
#include "nvstore.h"
2219
#ifdef MBED_CONF_RTOS_PRESENT
@@ -31,6 +28,10 @@
3128
#include <stdio.h>
3229
#include <algorithm>
3330

31+
#if !NVSTORE_ENABLED
32+
#error [NOT_SUPPORTED] NVSTORE needs to be enabled for this test
33+
#else
34+
3435
using namespace utest::v1;
3536

3637
static const uint16_t max_test_keys = 20;
@@ -396,6 +397,7 @@ static void nvstore_basic_functionality_test()
396397
delete[] nvstore_testing_buf_get;
397398
}
398399

400+
#ifdef MBED_CONF_RTOS_PRESENT
399401
static void thread_test_check_key(uint16_t key)
400402
{
401403
uint8_t get_buff[thr_test_max_data_size];
@@ -422,7 +424,6 @@ static void thread_test_check_key(uint16_t key)
422424

423425
}
424426

425-
#ifdef MBED_CONF_RTOS_PRESENT
426427
static void thread_test_worker()
427428
{
428429
int ret;
@@ -444,11 +445,9 @@ static void thread_test_worker()
444445
wait_ms(1);
445446
}
446447
}
447-
#endif
448448

449449
static void nvstore_multi_thread_test()
450450
{
451-
#ifdef MBED_CONF_RTOS_PRESENT
452451
int i, result;
453452
uint16_t size;
454453
uint16_t key;
@@ -562,8 +561,6 @@ static void nvstore_multi_thread_test()
562561
}
563562

564563
nvstore.reset();
565-
566-
#endif
567564
}
568565

569566

@@ -578,7 +575,6 @@ static void race_test_worker(void *buf)
578575

579576
static void nvstore_race_test()
580577
{
581-
#ifdef MBED_CONF_RTOS_PRESENT
582578
int i;
583579
uint16_t initial_buf_size;
584580
int ret;
@@ -668,8 +664,8 @@ static void nvstore_race_test()
668664
delete[] buffs[i];
669665
}
670666
delete[] get_buff;
671-
#endif
672667
}
668+
#endif
673669

674670

675671

@@ -681,8 +677,10 @@ utest::v1::status_t greentea_failure_handler(const Case *const source, const fai
681677

682678
Case cases[] = {
683679
Case("NVStore: Basic functionality", nvstore_basic_functionality_test, greentea_failure_handler),
680+
#if defined(MBED_CONF_RTOS_PRESENT)
684681
Case("NVStore: Race test", nvstore_race_test, greentea_failure_handler),
685682
Case("NVStore: Multiple thread test", nvstore_multi_thread_test, greentea_failure_handler),
683+
#endif
686684
};
687685

688686
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)

0 commit comments

Comments
 (0)