Skip to content

Skip Bare Metal green tea test for PSA component #11821

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 2 commits into from
Nov 12, 2019
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
2 changes: 2 additions & 0 deletions TESTS/mbedtls/selftest/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
#include "greentea-client/test_env.h"
#include "unity.h"
#include "utest.h"
#if defined(MBED_CONF_RTOS_PRESENT)
#include "rtos.h"
#endif

using namespace utest::v1;

Expand Down
5 changes: 5 additions & 0 deletions TESTS/psa/attestation/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
* limitations under the License.
*/

#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] PSA attestation test cases require RTOS to run.
#else

#include "psa/crypto.h"

#if ((!defined(TARGET_PSA)) || (!defined(MBEDTLS_PSA_CRYPTO_C)))
Expand Down Expand Up @@ -157,3 +161,4 @@ int main()
}

#endif // ((!defined(TARGET_PSA)) || (!defined(MBEDTLS_PSA_CRYPTO_C)))
#endif // !defined(MBED_CONF_RTOS_PRESENT)
5 changes: 5 additions & 0 deletions TESTS/psa/its_ps/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
* limitations under the License.
*/

#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] ITS/PS test cases require RTOS to run.
#else

#ifndef TARGET_PSA
#error [NOT_SUPPORTED] ITS/PS tests can run only on PSA-enabled targets.
#else
Expand Down Expand Up @@ -239,3 +243,4 @@ int main()
}

#endif // TARGET_PSA
#endif // !defined(MBED_CONF_RTOS_PRESENT)
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#include "val_interfaces.h"
#include "pal_mbed_os_intf.h"

#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] PSA compliance attestation test cases require RTOS to run.
#else
void test_entry_a001(val_api_t *val_api, psa_api_t *psa_api);

int main(void)
{
test_start(test_entry_a001, COMPLIANCE_TEST_ATTESTATION);
}
#endif
5 changes: 5 additions & 0 deletions components/TARGET_PSA/TESTS/compliance_its/test_s001/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "val_interfaces.h"
#include "pal_mbed_os_intf.h"

#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] PSA compliance its test cases require RTOS to run
#else

#ifdef ITS_TEST
void test_entry_s001(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
Expand All @@ -15,3 +19,4 @@ int main(void)
test_start(test_entry_p001, COMPLIANCE_TEST_STORAGE);
#endif
}
#endif // !defined(MBED_CONF_RTOS_PRESENT)
4 changes: 4 additions & 0 deletions components/TARGET_PSA/TESTS/compliance_its/test_s002/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include "val_interfaces.h"
#include "pal_mbed_os_intf.h"
#include "lifecycle.h"
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] PSA compliance its test cases require RTOS to run
#else

#ifdef ITS_TEST
void test_entry_s002(val_api_t *val_api, psa_api_t *psa_api);
Expand All @@ -16,3 +19,4 @@ int main(void)
test_start(test_entry_p002, COMPLIANCE_TEST_STORAGE);
#endif
}
#endif // !defined(MBED_CONF_RTOS_PRESENT)
4 changes: 4 additions & 0 deletions components/TARGET_PSA/TESTS/compliance_its/test_s004/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "val_interfaces.h"
#include "pal_mbed_os_intf.h"
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] PSA compliance its test cases require RTOS to run
#else

#ifdef ITS_TEST
void test_entry_s004(val_api_t *val_api, psa_api_t *psa_api);
Expand All @@ -15,3 +18,4 @@ int main(void)
test_start(test_entry_p004, COMPLIANCE_TEST_STORAGE);
#endif
}
#endif // !defined(MBED_CONF_RTOS_PRESENT)
5 changes: 5 additions & 0 deletions components/TARGET_PSA/TESTS/compliance_its/test_s005/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "val_interfaces.h"
#include "pal_mbed_os_intf.h"

#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] PSA compliance its test cases require RTOS to run
#else

#ifdef ITS_TEST
void test_entry_s005(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
Expand All @@ -15,3 +19,4 @@ int main(void)
test_start(test_entry_p005, COMPLIANCE_TEST_STORAGE);
#endif
}
#endif // !defined(MBED_CONF_RTOS_PRESENT)
5 changes: 5 additions & 0 deletions components/TARGET_PSA/TESTS/compliance_its/test_s006/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "val_interfaces.h"
#include "pal_mbed_os_intf.h"

#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] PSA compliance its test cases require RTOS to run
#else

#ifdef ITS_TEST
void test_entry_s006(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
Expand All @@ -15,3 +19,4 @@ int main(void)
test_start(test_entry_p006, COMPLIANCE_TEST_STORAGE);
#endif
}
#endif // !defined(MBED_CONF_RTOS_PRESENT)
5 changes: 5 additions & 0 deletions components/TARGET_PSA/TESTS/compliance_its/test_s007/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "val_interfaces.h"
#include "pal_mbed_os_intf.h"

#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] PSA compliance its test cases require RTOS to run
#else

#ifdef ITS_TEST
void test_entry_s007(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
Expand All @@ -15,3 +19,4 @@ int main(void)
test_start(test_entry_p007, COMPLIANCE_TEST_STORAGE);
#endif
}
#endif // !defined(MBED_CONF_RTOS_PRESENT)
5 changes: 5 additions & 0 deletions components/TARGET_PSA/TESTS/compliance_its/test_s008/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "val_interfaces.h"
#include "pal_mbed_os_intf.h"

#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] PSA compliance its test cases require RTOS to run
#else

#ifdef ITS_TEST
void test_entry_s008(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
Expand All @@ -15,3 +19,4 @@ int main(void)
test_start(test_entry_p008, COMPLIANCE_TEST_STORAGE);
#endif
}
#endif // !defined(MBED_CONF_RTOS_PRESENT)
5 changes: 5 additions & 0 deletions components/TARGET_PSA/TESTS/compliance_its/test_s009/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "val_interfaces.h"
#include "pal_mbed_os_intf.h"

#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] PSA compliance its test cases require RTOS to run
#else

#ifdef ITS_TEST
void test_entry_s009(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
Expand All @@ -15,3 +19,4 @@ int main(void)
test_start(test_entry_p009, COMPLIANCE_TEST_STORAGE);
#endif
}
#endif // !defined(MBED_CONF_RTOS_PRESENT)
5 changes: 5 additions & 0 deletions components/TARGET_PSA/TESTS/compliance_its/test_s010/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include "val_interfaces.h"
#include "pal_mbed_os_intf.h"

#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] PSA compliance its test cases require RTOS to run
#else

#ifdef ITS_TEST
void test_entry_s010(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
Expand All @@ -15,3 +19,4 @@ int main(void)
test_start(test_entry_p010, COMPLIANCE_TEST_STORAGE);
#endif
}
#endif // !defined(MBED_CONF_RTOS_PRESENT)
2 changes: 2 additions & 0 deletions features/frameworks/TARGET_PSA/pal/pal_mbed_os_intf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@ int test_start(test_entry_f test_f, compliance_test_type type)
{
test_g = test_f;
type_g = type;
#if defined(MBED_CONF_RTOS_PRESENT)
MBED_ASSERT((type > COMPLIANCE_TEST_START) && (type < COMPLIANCE_TEST_END));
Thread thread(osPriorityNormal, TEST_STACK_SIZE, NULL);
thread.start(main_wrapper);
thread.join();
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need these ifdefs? Will this function run when there is no RTOS? What do we want this function to do if there is no RTOS?

If this function will run, and we want it to be more than a no-op, perhaps we should call main_wrapper() here.

Copy link
Contributor Author

@rajkan01 rajkan01 Nov 6, 2019

Choose a reason for hiding this comment

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

@Patater When we do "mbed test -m NUCLEO_F411RE -t GCC_ARM --app-config TESTS/configs/baremetal.json" then build tools build mbed-os and green tea test with bare-metal configuration and No RTOS.

pal_mbed_os_intf.cpp uses RTOS API which leads to undefined threads APIs and builds fails.so I added the ifdefs to make the build pass.

This is the first level changes to make green tea test to run in bare metal once this PR gets merged then please do necessary changes on PSA to make it work for bare-metal.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is pal_mbed_os_intf.cpp included in the build at all? Is it needed for anything in baremetal?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am happy with this approach (no-op in test_start()) so long as greentea sees the PSA tests are skipped, not that they passed (because pass is meaningless if the tests did nothing).

Copy link
Contributor

Choose a reason for hiding this comment

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

You could have returned a non-zero value but it is not checked anywhere...

return 0;
}