James Kung | 35b352d | 2015-09-07 18:01:16 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2015, Linaro Limited |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License Version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | */ |
| 13 | |
| 14 | #include <stdio.h> |
| 15 | #include <string.h> |
| 16 | |
| 17 | #include "xtest_test.h" |
| 18 | #include "xtest_helpers.h" |
| 19 | |
| 20 | #include <ta_bonnie.h> |
| 21 | |
| 22 | static void xtest_tee_benchmark_1001(ADBG_Case_t *Case_p); |
| 23 | static void xtest_tee_benchmark_1002(ADBG_Case_t *Case_p); |
| 24 | static void xtest_tee_benchmark_1003(ADBG_Case_t *Case_p); |
| 25 | static void xtest_tee_benchmark_1004(ADBG_Case_t *Case_p); |
| 26 | static void xtest_tee_benchmark_1005(ADBG_Case_t *Case_p); |
| 27 | static void xtest_tee_benchmark_1006(ADBG_Case_t *Case_p); |
| 28 | |
| 29 | |
| 30 | static TEEC_Result run_test(enum bonnie_cmd cmd) |
| 31 | { |
| 32 | TEEC_Operation op = TEEC_OPERATION_INITIALIZER; |
| 33 | TEEC_Result res; |
| 34 | TEEC_Session sess; |
| 35 | uint32_t orig; |
| 36 | |
| 37 | res = xtest_teec_open_session(&sess, &bonnie_ta_uuid, NULL, &orig); |
| 38 | if (res != TEEC_SUCCESS) |
| 39 | return res; |
| 40 | |
| 41 | res = TEEC_InvokeCommand(&sess, cmd, &op, &orig); |
| 42 | |
| 43 | TEEC_CloseSession(&sess); |
| 44 | |
| 45 | return res; |
| 46 | } |
| 47 | |
| 48 | static void xtest_tee_benchmark_1001(ADBG_Case_t *c) |
| 49 | { |
| 50 | ADBG_EXPECT_TEEC_SUCCESS(c, run_test(TA_BONNIE_CMD_TEST_PUTC)); |
| 51 | } |
| 52 | |
| 53 | static void xtest_tee_benchmark_1002(ADBG_Case_t *c) |
| 54 | { |
| 55 | ADBG_EXPECT_TEEC_SUCCESS(c, run_test(TA_BONNIE_CMD_TEST_REWRITE)); |
| 56 | } |
| 57 | |
| 58 | static void xtest_tee_benchmark_1003(ADBG_Case_t *c) |
| 59 | { |
| 60 | ADBG_EXPECT_TEEC_SUCCESS(c, run_test(TA_BONNIE_CMD_TEST_FASTWRITE)); |
| 61 | } |
| 62 | |
| 63 | static void xtest_tee_benchmark_1004(ADBG_Case_t *c) |
| 64 | { |
| 65 | ADBG_EXPECT_TEEC_SUCCESS(c, run_test(TA_BONNIE_CMD_TEST_GETC)); |
| 66 | } |
| 67 | |
| 68 | static void xtest_tee_benchmark_1005(ADBG_Case_t *c) |
| 69 | { |
| 70 | ADBG_EXPECT_TEEC_SUCCESS(c, run_test(TA_BONNIE_CMD_TEST_FASTREAD)); |
| 71 | } |
| 72 | |
| 73 | static void xtest_tee_benchmark_1006(ADBG_Case_t *c) |
| 74 | { |
| 75 | ADBG_EXPECT_TEEC_SUCCESS(c, run_test(TA_BONNIE_CMD_TEST_LSEEK)); |
| 76 | } |
| 77 | |
| 78 | |
| 79 | ADBG_CASE_DEFINE(XTEST_TEE_BENCHMARK_1001, xtest_tee_benchmark_1001, |
| 80 | /* Title */ "TEE Trusted Storage Performance Test (PUTC)", |
| 81 | /* Short description */ "", |
| 82 | /* Requirement IDs */ "", |
| 83 | /* How to implement */ "" |
| 84 | ); |
| 85 | |
| 86 | ADBG_CASE_DEFINE(XTEST_TEE_BENCHMARK_1002, xtest_tee_benchmark_1002, |
| 87 | /* Title */ "TEE Trusted Storage Performance Test (REWRITE)", |
| 88 | /* Short description */ "", |
| 89 | /* Requirement IDs */ "", |
| 90 | /* How to implement */ "" |
| 91 | ); |
| 92 | |
| 93 | ADBG_CASE_DEFINE(XTEST_TEE_BENCHMARK_1003, xtest_tee_benchmark_1003, |
| 94 | /* Title */ "TEE Trusted Storage Performance Test (FASTWRITE)", |
| 95 | /* Short description */ "", |
| 96 | /* Requirement IDs */ "", |
| 97 | /* How to implement */ "" |
| 98 | ); |
| 99 | |
| 100 | ADBG_CASE_DEFINE(XTEST_TEE_BENCHMARK_1004, xtest_tee_benchmark_1004, |
| 101 | /* Title */ "TEE Trusted Storage Performance Test (GETC)", |
| 102 | /* Short description */ "", |
| 103 | /* Requirement IDs */ "", |
| 104 | /* How to implement */ "" |
| 105 | ); |
| 106 | |
| 107 | ADBG_CASE_DEFINE(XTEST_TEE_BENCHMARK_1005, xtest_tee_benchmark_1005, |
| 108 | /* Title */ "TEE Trusted Storage Performance Test (FASTREAD)", |
| 109 | /* Short description */ "", |
| 110 | /* Requirement IDs */ "", |
| 111 | /* How to implement */ "" |
| 112 | ); |
| 113 | |
| 114 | ADBG_CASE_DEFINE(XTEST_TEE_BENCHMARK_1006, xtest_tee_benchmark_1006, |
| 115 | /* Title */ "TEE Trusted Storage Performance Test (LSEEK)", |
| 116 | /* Short description */ "", |
| 117 | /* Requirement IDs */ "", |
| 118 | /* How to implement */ "" |
| 119 | ); |
| 120 | |