1 /*
2 * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
3 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 * of conditions and the following disclaimer in the documentation and/or other materials
13 * provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
16 * to endorse or promote products derived from this software without specific prior written
17 * permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31 #ifndef _IT_PTHREAD_TEST_H
32 #define _IT_PTHREAD_TEST_H
33
34 #include "osTest.h"
35 #include <sys/resource.h>
36 #include <sys/wait.h>
37 #include <time.h>
38
39 #define SLEEP_AND_YIELD(tick) usleep((tick)*10 * 1000)
40
41 #include "sys/syscall.h"
42
Syscall(int nbr,int parm1,int parm2,int parm3,int parm4)43 static inline int Syscall(int nbr, int parm1, int parm2, int parm3, int parm4)
44 {
45 register int reg7 __asm__("r7") = nbr;
46 register int reg3 __asm__("r3") = parm4;
47 register int reg2 __asm__("r2") = parm3;
48 register int reg1 __asm__("r1") = parm2;
49 register int reg0 __asm__("r0") = parm1;
50
51 __asm__ __volatile__("svc 0" : "=r"(reg0) : "r"(reg7), "r"(reg0), "r"(reg1), "r"(reg2), "r"(reg3) : "memory");
52
53 return reg0;
54 }
55 extern INT32 g_iCunitErrCode;
56 extern INT32 g_iCunitErrLineNo;
57
58 extern void ItTestPthread001(void);
59 extern void ItTestPthread002(void);
60 extern void ItTestPthread003(void);
61 extern void ItTestPthread004(void);
62 extern void ItTestPthread005(void);
63 extern void ItTestPthread006(void);
64 extern void ItTestPthread007(void);
65 extern void ItTestPthread008(void);
66 extern void ItTestPthread009(void);
67 extern void ItTestPthread010(void);
68 extern void ItTestPthread012(void);
69 extern void ItTestPthread011(void);
70 extern void ItTestPthread013(void);
71 extern void ItTestPthread014(void);
72 extern void ItTestPthread015(void);
73 extern void ItTestPthread016(void);
74 extern void ItTestPthread017(void);
75 extern void ItTestPthread018(void);
76 extern void ItTestPthread019(void);
77 extern void ItTestPthread020(void);
78 extern void ItTestPthread021(void);
79 extern void ItTestPthread022(void);
80 extern void ItTestPthread023(void);
81 extern void ItTestPthread024(void);
82 extern void ItTestPthread025(void);
83 extern void ItTestPthread026(void);
84 extern void ItTestPthread027(void);
85 extern void ItTestPthreadAtfork001(void);
86 extern void ItTestPthreadAtfork002(void);
87 extern void ItTestPthreadOnce001(void);
88 extern void ItTestPthreadCond001(void);
89 extern void ItTestPthreadCond002(void);
90 extern void ItTestPthreadCond003(void);
91 extern void ItTestPthreadCond004(void);
92 #endif
93