1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2014, STMicroelectronics International N.V.
4  */
5 
6 #ifndef __ADBG_INT_H
7 #define __ADBG_INT_H
8 #include <adbg.h>
9 #include <stdarg.h>
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <sys/param.h>
14 #include <sys/queue.h>
15 
16 #include "security_utils_hex.h"
17 
18 typedef struct ADBG_Result {
19 	int NumTests;
20 	int NumFailedTests;
21 	int NumSubTests;
22 	int NumFailedSubTests;
23 	int NumSubCases;
24 	int NumFailedSubCases;
25 	int FirstFailedRow;
26 	char const *FirstFailedFile_p;
27 	bool AbortTestSuite;
28 } ADBG_Result_t;
29 
30 TAILQ_HEAD(ADBG_SubCaseHead, ADBG_SubCase);
31 typedef struct ADBG_SubCaseHead ADBG_SubCaseHead_t;
32 
33 typedef struct ADBG_SubCase ADBG_SubCase_t;
34 struct ADBG_SubCase {
35 	char *TestID_p;
36 	char *Title_p;
37 	ADBG_Result_t Result;
38 	ADBG_SubCase_t *Parent_p; /* The SubCase where this SubCase was added */
39 	ADBG_SubCaseHead_t SubCasesList; /* SubCases created in this SubCase*/
40 	TAILQ_ENTRY(ADBG_SubCase) Link;
41 };
42 
43 /* Typedefed in t_adbg.h */
44 struct ADBG_Case {
45 	const struct adbg_case_def *case_def;
46 
47 	ADBG_SubCase_t *CurrentSubCase_p;
48 	ADBG_SubCase_t *FirstSubCase_p;
49 
50 	ADBG_Result_t Result;
51 	TAILQ_ENTRY(ADBG_Case)          Link;
52 };
53 
54 typedef struct {
55 	ADBG_Case_t *Case_p;
56 	ADBG_SubCase_t *CurrentSubCase_p;
57 } ADBG_SubCase_Iterator_t;
58 
59 bool ADBG_Case_SubCaseIsMain(const ADBG_Case_t *const Case_p,
60 			     const ADBG_SubCase_t *const SubCase_p);
61 
62 void ADBG_Case_IterateSubCase(ADBG_Case_t *Case_p,
63 			      ADBG_SubCase_Iterator_t *Iterator_p);
64 
65 ADBG_SubCase_t *ADBG_Case_NextSubCase(ADBG_SubCase_Iterator_t *Iterator_p);
66 
67 ADBG_Case_t *ADBG_Case_New(const struct adbg_case_def *case_def);
68 
69 void ADBG_Case_Delete(ADBG_Case_t *Case_p);
70 
71 bool ADBG_TestIDMatches(const char *const TestID_p,
72 			const char *const Argument_p);
73 
74 #define IDENTIFIER_NOT_USED(x) { if (sizeof(&x)) {} }
75 
76 #endif /* __ADBG_INT_H */
77