Skip to content

Commit

Permalink
xtest 6007: close and re-open object
Browse files Browse the repository at this point in the history
Update regression test 6007 to close and re-open the persistent object
after truncation and extension.
Reproducer for issue OP-TEE/optee_os#2094.

From: Kevin Peng <kevinp@marvell.com>
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
  • Loading branch information
jforissier committed Jan 26, 2018
1 parent 692efd1 commit 87a0a11
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions host/xtest/regression_6000.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,29 @@ static void test_truncate_file_length(ADBG_Case_t *c, uint32_t storage_id)
/* check buffer */
(void)ADBG_EXPECT_BUFFER(c, &data_00[5], 5, out, count);

/* close */
if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
goto exit;

/* open */
if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_open(&sess, file_01, sizeof(file_01),
TEE_DATA_FLAG_ACCESS_WRITE |
TEE_DATA_FLAG_ACCESS_READ |
TEE_DATA_FLAG_ACCESS_WRITE_META, &obj, storage_id)))
goto exit;

/* seek */
if (!ADBG_EXPECT_TEEC_SUCCESS(
c, fs_seek(&sess, obj, 5, TEE_DATA_SEEK_SET)))
goto exit;

/* verify */
if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_read(&sess, obj, out, 10, &count)))
goto exit;

/* check buffer */
(void)ADBG_EXPECT_BUFFER(c, &data_00[5], 5, out, count);

/* clean */
if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
goto exit;
Expand Down Expand Up @@ -531,6 +554,31 @@ static void test_extend_file_length(ADBG_Case_t *c, uint32_t storage_id)
expect[1] = data_00[31];
(void)ADBG_EXPECT_BUFFER(c, &expect[0], 10, out, count);

/* close */
if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_close(&sess, obj)))
goto exit;

/* open */
if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_open(&sess, file_01, sizeof(file_01),
TEE_DATA_FLAG_ACCESS_WRITE |
TEE_DATA_FLAG_ACCESS_READ |
TEE_DATA_FLAG_ACCESS_WRITE_META, &obj, storage_id)))
goto exit;

/* seek */
if (!ADBG_EXPECT_TEEC_SUCCESS(
c, fs_seek(&sess, obj, 30, TEE_DATA_SEEK_SET)))
goto exit;

/* verify */
if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_read(&sess, obj, out, 10, &count)))
goto exit;

/* check buffer */
expect[0] = data_00[30];
expect[1] = data_00[31];
(void)ADBG_EXPECT_BUFFER(c, &expect[0], 10, out, count);

/* clean */
if (!ADBG_EXPECT_TEEC_SUCCESS(c, fs_unlink(&sess, obj)))
goto exit;
Expand Down

0 comments on commit 87a0a11

Please sign in to comment.