Multiple persistent object manipulation

xtest 6014 is introduced. It highlights an issue when persistent
objects are manipulated in a loop.
cf. https://github.com/OP-TEE/optee_os/issues/798

Signed-off-by: Pascal Brand <pascal.brand@st.com>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Tested-by: Joakim Bech <joakim.bech@linaro.org> (QEMU)
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
diff --git a/host/xtest/xtest_6000.c b/host/xtest/xtest_6000.c
index dacadff..0358a2b 100644
--- a/host/xtest/xtest_6000.c
+++ b/host/xtest/xtest_6000.c
@@ -1275,6 +1275,25 @@
 	TEEC_CloseSession(&sess);
 }
 
+static void xtest_tee_test_6014(ADBG_Case_t *c)
+{
+	TEEC_Session sess;
+	uint32_t orig;
+	TEEC_Operation op = TEEC_OPERATION_INITIALIZER;
+
+	if (!ADBG_EXPECT_TEEC_SUCCESS(c,
+		xtest_teec_open_session(&sess, &storage_ta_uuid, NULL, &orig)))
+		return;
+
+	op.paramTypes = TEEC_PARAM_TYPES(TEEC_NONE, TEEC_NONE,
+					 TEEC_NONE, TEEC_NONE);
+
+	ADBG_EXPECT_TEEC_SUCCESS(c,
+		TEEC_InvokeCommand(&sess, TA_STORAGE_CMD_LOOP, &op, &orig));
+
+	TEEC_CloseSession(&sess);
+}
+
 ADBG_CASE_DEFINE(
 	XTEST_TEE_6001, xtest_tee_test_6001,
 	/* Title */
@@ -1432,3 +1451,15 @@
     /* How to implement */
     "Description of how to implement ..."
 );
+
+ADBG_CASE_DEFINE(
+    XTEST_TEE_6014, xtest_tee_test_6014,
+    /* Title */
+    "Loop on Persistent objects",
+    /* Short description */
+    "Short description ...",
+    /* Requirement IDs */
+    "TEE-??",
+    /* How to implement */
+    "Description of how to implement ..."
+);
diff --git a/host/xtest/xtest_main.c b/host/xtest/xtest_main.c
index e1f8d3b..88e5734 100644
--- a/host/xtest/xtest_main.c
+++ b/host/xtest/xtest_main.c
@@ -66,6 +66,7 @@
 #endif
 ADBG_SUITE_ENTRY(XTEST_TEE_6012, NULL)
 ADBG_SUITE_ENTRY(XTEST_TEE_6013, NULL)
+ADBG_SUITE_ENTRY(XTEST_TEE_6014, NULL)
 ADBG_SUITE_ENTRY(XTEST_TEE_7001, NULL)
 /* FVP    ADBG_SUITE_ENTRY(XTEST_TEE_7002, NULL) */
 ADBG_SUITE_ENTRY(XTEST_TEE_7003, NULL)
diff --git a/host/xtest/xtest_test.h b/host/xtest/xtest_test.h
index 8f2ac7f..f815335 100644
--- a/host/xtest/xtest_test.h
+++ b/host/xtest/xtest_test.h
@@ -61,6 +61,7 @@
 #endif
 ADBG_CASE_DECLARE(XTEST_TEE_6012);
 ADBG_CASE_DECLARE(XTEST_TEE_6013);
+ADBG_CASE_DECLARE(XTEST_TEE_6014);
 ADBG_CASE_DECLARE(XTEST_TEE_7001);
 ADBG_CASE_DECLARE(XTEST_TEE_7002);
 ADBG_CASE_DECLARE(XTEST_TEE_7003);