Skip to content

Commit 8ecce14

Browse files
committed
Skip Bare metal green tea test for storage related components or the components test cases which is based on RTOS
1 parent e4164be commit 8ecce14

File tree

9 files changed

+46
-12
lines changed

9 files changed

+46
-12
lines changed

components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.cpp

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

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
#if !defined(MBED_CONF_RTOS_PRESENT)
17+
#error [NOT_SUPPORTED] filesystem test cases requires RTOS to run
18+
#else
1619

1720
#include "mbed.h"
1821
#include "greentea-client/test_env.h"
@@ -207,3 +210,4 @@ int main()
207210
{
208211
return !Harness::run(specification);
209212
}
213+
#endif // !defined(MBED_CONF_RTOS_PRESENT)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
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+
1721
#include "DeviceKey.h"
1822
#include "mbedtls/config.h"
1923
#include "utest/utest.h"
@@ -28,10 +32,6 @@
2832
using namespace utest::v1;
2933
using namespace mbed;
3034

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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ void test_random_program_read_erase()
310310

311311
static void test_thread_job()
312312
{
313+
#if defined(MBED_CONF_RTOS_PRESENT)
313314
static int thread_num = 0;
314315
_mutex->lock();
315316
int block_num = thread_num++ % TEST_NUM_OF_THREADS;
@@ -335,10 +336,12 @@ static void test_thread_job()
335336
end:
336337
delete[] read_block;
337338
delete[] write_block;
339+
#endif
338340
}
339341

340342
void test_multi_threads()
341343
{
344+
#if defined(MBED_CONF_RTOS_PRESENT)
342345
utest_printf("\nTest Multi Threaded Erase/Program/Read Starts..\n");
343346

344347
TEST_SKIP_UNLESS_MESSAGE(block_device != NULL, "no block device found.");
@@ -392,7 +395,7 @@ void test_multi_threads()
392395

393396
delete[] bd_thread;
394397
}
395-
398+
#endif
396399
}
397400

398401
void test_erase_functionality()
@@ -727,7 +730,9 @@ typedef struct {
727730
template_case_t template_cases[] = {
728731
{"Testing Init block device", test_init_bd, greentea_failure_handler},
729732
{"Testing read write random blocks", test_random_program_read_erase, greentea_failure_handler},
733+
#if defined(MBED_CONF_RTOS_PRESENT)
730734
{"Testing multi threads erase program read", test_multi_threads, greentea_failure_handler},
735+
#endif
731736
{"Testing contiguous erase, write and read", test_contiguous_erase_write_read, greentea_failure_handler},
732737
{"Testing BlockDevice erase functionality", test_erase_functionality, greentea_failure_handler},
733738
{"Testing program read small data sizes", test_program_read_small_data_sizes, greentea_failure_handler},

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18+
#if !defined(MBED_CONF_RTOS_PRESENT)
19+
#error [NOT_SUPPORTED] Kvstore API test cases requires RTOS to run
20+
#else
1821

1922
#include "rtos/Thread.h"
2023
#include "mbed_trace.h"
@@ -522,3 +525,4 @@ int main()
522525
}
523526

524527
#endif // !defined(TARGET_K64F) && !defined(TARGET_ARM_FM)
528+
#endif // !defined(MBED_CONF_RTOS_PRESENT)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
#if !defined(MBED_CONF_RTOS_PRESENT)
18+
#error [NOT_SUPPORTED] Kvstore API test cases requires RTOS to run
19+
#else
1720

1821
#include "SecureStore.h"
1922
#include "TDBStore.h"
@@ -857,3 +860,4 @@ int main()
857860
}
858861

859862
#endif // !defined(TARGET_K64F) && !defined(TARGET_ARM_FM)
863+
#endif // !defined(MBED_CONF_RTOS_PRESENT)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
#if !defined(MBED_CONF_RTOS_PRESENT)
18+
#error [NOT_SUPPORTED] Kvstore API test cases requires RTOS to run
19+
#else
1720

1821
#include "SecureStore.h"
1922
#include "TDBStore.h"
@@ -860,3 +863,4 @@ int main()
860863
}
861864

862865
#endif // !defined(TARGET_K64F) && !defined(TARGET_ARM_FM)
866+
#endif // !defined(MBED_CONF_RTOS_PRESENT)

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18+
#if defined(MBED_CONF_RTOS_PRESENT)
1819
#include "Thread.h"
20+
#endif
1921
#include "mbed_error.h"
2022
#include "greentea-client/test_env.h"
2123
#include "unity/unity.h"
@@ -33,10 +35,10 @@ static size_t actual_size = 0;
3335
static const size_t buffer_size = 20;
3436
static const int num_of_threads = 3;
3537
static const char num_of_keys = 3;
36-
38+
#if defined(MBED_CONF_RTOS_PRESENT)
3739
/* Forked 3 threads plus misc, so minimum (4 * OS_STACK_SIZE) heap are required. */
3840
static const int heap_alloc_threshold_size = 4 * OS_STACK_SIZE;
39-
41+
#endif
4042
static const char *keys[] = {"key1", "key2", "key3"};
4143

4244
static int init_res = MBED_ERROR_NOT_READY;
@@ -67,6 +69,7 @@ static void parse_default_kv()
6769
//init the blockdevice
6870
static void kvstore_init()
6971
{
72+
#if defined(MBED_CONF_RTOS_PRESENT)
7073
uint8_t *dummy = new (std::nothrow) uint8_t[heap_alloc_threshold_size];
7174
TEST_SKIP_UNLESS_MESSAGE(dummy, "Not enough heap to run test");
7275
delete[] dummy;
@@ -76,6 +79,7 @@ static void kvstore_init()
7679
init_res = kv_reset(def_kv);
7780
TEST_SKIP_UNLESS_MESSAGE(init_res != MBED_ERROR_UNSUPPORTED, "Unsupported configuration. Test skipped.");
7881
TEST_ASSERT_EQUAL_ERROR_CODE(MBED_SUCCESS, init_res);
82+
#endif
7983
}
8084

8185
/*----------------set()------------------*/
@@ -144,6 +148,7 @@ static void test_thread_set(char *th_key)
144148
//get several keys multithreaded
145149
static void set_several_keys_multithreaded()
146150
{
151+
#if defined(MBED_CONF_RTOS_PRESENT)
147152
TEST_SKIP_UNLESS(!init_res);
148153
rtos::Thread kvstore_thread[num_of_threads];
149154
osStatus threadStatus;
@@ -169,6 +174,7 @@ static void set_several_keys_multithreaded()
169174
res = kv_remove(keys[i]);
170175
TEST_ASSERT_EQUAL_ERROR_CODE(MBED_SUCCESS, res);
171176
}
177+
#endif
172178
}
173179

174180
//set key "write once" and try to set it again
@@ -464,6 +470,7 @@ static void test_thread_get(const void *th_key)
464470
//get several keys multithreaded
465471
static void get_several_keys_multithreaded()
466472
{
473+
#if defined(MBED_CONF_RTOS_PRESENT)
467474
TEST_SKIP_UNLESS(!init_res);
468475
int i = 0, res = 0;
469476
rtos::Thread kvstore_thread[num_of_threads];
@@ -489,6 +496,7 @@ static void get_several_keys_multithreaded()
489496
res = kv_remove(keys[i]);
490497
TEST_ASSERT_EQUAL_ERROR_CODE(MBED_SUCCESS, res);
491498
}
499+
#endif
492500
}
493501

494502
/*----------------remove()------------------*/
@@ -924,7 +932,9 @@ Case cases[] = {
924932
Case("set_buffer_null_size_not_zero", set_buffer_null_size_not_zero, greentea_failure_handler),
925933
Case("set_buffer_size_is_zero", set_buffer_size_is_zero, greentea_failure_handler),
926934
Case("set_same_key_several_time", set_same_key_several_time, greentea_failure_handler),
935+
#if defined(MBED_CONF_RTOS_PRESENT)
927936
Case("set_several_keys_multithreaded", set_several_keys_multithreaded, greentea_failure_handler),
937+
#endif
928938
Case("set_write_once_flag_try_set_twice", set_write_once_flag_try_set_twice, greentea_failure_handler),
929939
Case("set_write_once_flag_try_remove", set_write_once_flag_try_remove, greentea_failure_handler),
930940
Case("set_key_value_one_byte_size", set_key_value_one_byte_size, greentea_failure_handler),
@@ -944,8 +954,9 @@ Case cases[] = {
944954
Case("get_non_existing_key", get_non_existing_key, greentea_failure_handler),
945955
Case("get_removed_key", get_removed_key, greentea_failure_handler),
946956
Case("get_key_that_was_set_twice", get_key_that_was_set_twice, greentea_failure_handler),
957+
#if defined(MBED_CONF_RTOS_PRESENT)
947958
Case("get_several_keys_multithreaded", get_several_keys_multithreaded, greentea_failure_handler),
948-
959+
#endif
949960
Case("remove_key_null", remove_key_null, greentea_failure_handler),
950961
Case("remove_key_length_exceeds_max", remove_key_length_exceeds_max, greentea_failure_handler),
951962
Case("remove_non_existing_key", remove_non_existing_key, greentea_failure_handler),

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
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
20+
1721
#include "nvstore.h"
1822
#ifdef MBED_CONF_RTOS_PRESENT
1923
#include "Thread.h"
@@ -27,10 +31,6 @@
2731
#include <stdio.h>
2832
#include <algorithm>
2933

30-
#if !NVSTORE_ENABLED
31-
#error [NOT_SUPPORTED] NVSTORE needs to be enabled for this test
32-
#else
33-
3434
using namespace utest::v1;
3535

3636
static const uint16_t max_test_keys = 20;

0 commit comments

Comments
 (0)