Test: Reduce running time of SST reliability tests
Reduces the running time of the SST reliability test suite to a level
acceptable for regular running during development.
Changes:
- Makes each write eight times larger. The asset used is eight times
larger than in the original design, so this restores the number of
writes per iteration to the original level.
- Sets number of iterations for test 3001 to five.
- Sets number of iterations for test 3002 to number of assets plus one.
Change-Id: I847b4177dd2a6a1bc6d87b2a07b0e55240e0f568
Signed-off-by: Jamie Fox <jamie.fox@arm.com>
diff --git a/docs/user_guides/tfm_user_guide.md b/docs/user_guides/tfm_user_guide.md
index 878b335..bd5e83d 100644
--- a/docs/user_guides/tfm_user_guide.md
+++ b/docs/user_guides/tfm_user_guide.md
@@ -148,8 +148,7 @@
```
-Note: SST reliability tests may take more than 40 minutes to run on the
- MPS2.
+Note: SST reliability tests take approximately three minutes to run on the MPS2.
## Software upgrade and image validation with BL2 bootloader
diff --git a/test/suites/sst/secure/sst_reliability_testsuite.c b/test/suites/sst/secure/sst_reliability_testsuite.c
index e17c349..59cbb5d 100644
--- a/test/suites/sst/secure/sst_reliability_testsuite.c
+++ b/test/suites/sst/secure/sst_reliability_testsuite.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -17,9 +17,19 @@
#include "s_test_helpers.h"
/* Test suite defines */
-#define LOOP_ITERATION 15UL
-#define READ_BUF_SIZE 11UL
-#define WRITE_BUF_SIZE 5UL
+#define LOOP_ITERATIONS_001 5U
+
+/* Perform one more create/delete than the number of assets to check that
+ * object metadata is being freed correctly.
+ */
+#define LOOP_ITERATIONS_002 (SST_NUM_ASSETS + 1U)
+
+#define WRITE_BUF_SIZE 33U
+#define READ_BUF_SIZE (WRITE_BUF_SIZE + 6U)
+
+#define WRITE_DATA "PACKMYBOXWITHFIVEDOZENLIQUORJUGS"
+#define READ_DATA "######################################"
+#define RESULT_DATA ("###" WRITE_DATA "###")
/* Define test suite for SST reliability tests */
/* List of tests */
@@ -57,8 +67,8 @@
struct tfm_sst_buf_t data;
enum tfm_sst_err_t err;
uint32_t itr;
- uint8_t wrt_data[WRITE_BUF_SIZE] = "GOOD";
- uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXX";
+ uint8_t wrt_data[WRITE_BUF_SIZE] = WRITE_DATA;
+ uint8_t read_data[READ_BUF_SIZE] = READ_DATA;
/* Prepares test context */
if (prepare_test_ctx(ret) != 0) {
@@ -81,7 +91,7 @@
/* Sets write and read sizes */
data.size = WRITE_BUF_SIZE-1;
- for (itr = 0; itr < LOOP_ITERATION; itr++) {
+ for (itr = 0; itr < LOOP_ITERATIONS_001; itr++) {
do {
/* Sets data structure */
data.data = wrt_data;
@@ -105,7 +115,7 @@
}
/* Checks read data buffer content */
- if (memcmp(read_data, "XXXGOODXXX", READ_BUF_SIZE) != 0) {
+ if (memcmp(read_data, RESULT_DATA, READ_BUF_SIZE) != 0) {
TEST_FAIL("Read buffer contains incorrect data");
return;
}
@@ -148,8 +158,8 @@
struct tfm_sst_buf_t data;
enum tfm_sst_err_t err;
uint32_t itr;
- uint8_t wrt_data[WRITE_BUF_SIZE] = "GOOD";
- uint8_t read_data[READ_BUF_SIZE] = "XXXXXXXXXX";
+ uint8_t wrt_data[WRITE_BUF_SIZE] = WRITE_DATA;
+ uint8_t read_data[READ_BUF_SIZE] = READ_DATA;
/* Prepares test context */
if (prepare_test_ctx(ret) != 0) {
@@ -159,7 +169,7 @@
/* Sets write and read sizes */
data.size = WRITE_BUF_SIZE-1;
- for (itr = 0; itr < LOOP_ITERATION; itr++) {
+ for (itr = 0; itr < LOOP_ITERATIONS_002; itr++) {
/* Checks write permissions in create function */
err = tfm_sst_veneer_create(app_id, asset_uuid);
if (err != TFM_SST_ERR_SUCCESS) {
@@ -196,7 +206,7 @@
}
/* Checks read data buffer content */
- if (memcmp(read_data, "XXXGOODXXX", READ_BUF_SIZE) != 0) {
+ if (memcmp(read_data, RESULT_DATA, READ_BUF_SIZE) != 0) {
read_data[READ_BUF_SIZE-1] = 0;
TEST_FAIL("Read buffer contains incorrect data");
return;