• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 Huawei Technologies Co., Ltd.
3  * Licensed under the Mulan PSL v2.
4  * You can use this software according to the terms and conditions of the Mulan PSL v2.
5  * You may obtain a copy of Mulan PSL v2 at:
6  *     http://license.coscl.org.cn/MulanPSL2
7  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
8  * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
9  * PURPOSE.
10  * See the Mulan PSL v2 for more details.
11  */
12 
13 #include "public_test.h"
14 #include "test_defines.h"
15 
16 using namespace std;
17 
18 TEEC_Context PublicTest::context = { 0 };
19 TEEC_Session PublicTest::session = { 0 };
20 TEEC_UUID PublicTest::uuid = TEST_UUID;
21 
SetUpTestCase()22 void PublicTest::SetUpTestCase()
23 {
24     TEEC_Operation operation = { 0 };
25 
26     TEEC_Result ret = TEEC_InitializeContext(NULL, &context);
27     ABORT_UNLESS(ret != TEEC_SUCCESS);
28 
29     operation.started = 1;
30     operation.paramTypes = TEEC_PARAM_TYPES(TEEC_NONE, TEEC_NONE, TEEC_NONE, TEEC_NONE);
31 
32     ret = TEEC_OpenSession(&context, &session, &uuid, TEEC_LOGIN_IDENTIFY, NULL, &operation, NULL);
33     ABORT_UNLESS(ret != TEEC_SUCCESS);
34 }
35 
TearDownTestCase()36 void PublicTest::TearDownTestCase()
37 {
38     TEEC_CloseSession(&session);
39     TEEC_FinalizeContext(&context);
40 }
41 
SetUuid(const TEEC_UUID & uuid)42 void PublicTest::SetUuid(const TEEC_UUID &uuid)
43 {
44     PublicTest::uuid = uuid;
45 }
46 
47 TEEC_Context TeeBasicTestFramWithInitContext::context = { 0 };
48 TEEC_Session TeeBasicTestFramWithInitContext::session = { 0 };
49 TEEC_SharedMemory TeeBasicTestFramWithInitContext::sharedMem = { 0 };
50 
SetUp()51 void TeeBasicTestFramWithInitContext::SetUp()
52 {
53     TEEC_Result ret;
54     ret = TEEC_InitializeContext(NULL, &context);
55     ABORT_UNLESS(ret != TEEC_SUCCESS);
56 }
57 
TearDown()58 void TeeBasicTestFramWithInitContext::TearDown()
59 {
60     TEEC_CloseSession(&session);
61     TEEC_ReleaseSharedMemory(&sharedMem);
62     TEEC_FinalizeContext(&context);
63 }