• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import("//build/test.gni")
2import("../../../musl_config.gni")
3import("../../test_template.gni")
4
5if (musl_use_gwp_asan) {
6  config("gwp_asan_test_config") {
7    cflags = [
8      "-fno-omit-frame-pointer",
9      "-g",
10      "-Wno-incompatible-pointer-types",
11    ]
12    include_dirs = [
13      "//third_party/musl/src/gwp_asan/linux",
14      "//third_party/musl/libc-test/src/common",
15    ]
16    defines = [ "USE_GWP_ASAN" ]
17  }
18
19  config("gwp_asan_no_emutls") {
20    cflags = [
21      "-fno-emulated-tls",
22      "-fno-lto",
23    ]
24  }
25
26  ohos_executable("gwp_asan_double_free_test") {
27    testonly = true
28    sources = [ "double_free.c" ]
29    configs = [
30      ":gwp_asan_test_config",
31      "//third_party/musl/libc-test/src/common:config_runtest",
32    ]
33    subsystem_name = "musl"
34    part_name = "libc-test"
35  }
36
37  ohos_executable("gwp_asan_invalid_free_left_test") {
38    testonly = true
39    sources = [ "invalid_free_left.c" ]
40    configs = [
41      ":gwp_asan_test_config",
42      "//third_party/musl/libc-test/src/common:config_runtest",
43    ]
44    subsystem_name = "musl"
45    part_name = "libc-test"
46  }
47
48  ohos_executable("gwp_asan_invalid_free_right_test") {
49    testonly = true
50    sources = [ "invalid_free_right.c" ]
51    configs = [
52      ":gwp_asan_test_config",
53      "//third_party/musl/libc-test/src/common:config_runtest",
54    ]
55    subsystem_name = "musl"
56    part_name = "libc-test"
57  }
58
59  ohos_executable("gwp_asan_buffer_overflow_test") {
60    testonly = true
61    sources = [ "buffer_overflow.c" ]
62    configs = [
63      ":gwp_asan_test_config",
64      "//third_party/musl/libc-test/src/common:config_runtest",
65    ]
66    subsystem_name = "musl"
67    part_name = "libc-test"
68  }
69
70  ohos_executable("gwp_asan_buffer_underflow_test") {
71    testonly = true
72    sources = [ "buffer_underflow.c" ]
73    configs = [
74      ":gwp_asan_test_config",
75      "//third_party/musl/libc-test/src/common:config_runtest",
76    ]
77    subsystem_name = "musl"
78    part_name = "libc-test"
79  }
80
81  ohos_executable("gwp_asan_use_after_free_test") {
82    testonly = true
83    sources = [ "use_after_free.c" ]
84    configs = [
85      ":gwp_asan_test_config",
86      "//third_party/musl/libc-test/src/common:config_runtest",
87      ":gwp_asan_no_emutls",
88    ]
89    subsystem_name = "musl"
90    part_name = "libc-test"
91  }
92
93  ohos_executable("gwp_asan_unwind_test") {
94    testonly = true
95    sources = [ "unwind_test.c" ]
96    configs = [
97      ":gwp_asan_test_config",
98      "//third_party/musl/libc-test/src/common:config_runtest",
99    ]
100    subsystem_name = "musl"
101    part_name = "libc-test"
102  }
103
104  ohos_executable("gwp_asan_smoke_test") {
105    testonly = true
106    sources = [ "gwp_asan_smoke_test.c" ]
107    configs = [
108      ":gwp_asan_test_config",
109      "//third_party/musl/libc-test/src/common:config_runtest",
110    ]
111    subsystem_name = "musl"
112    part_name = "libc-test"
113  }
114
115  ohos_executable("gwp_asan_random_sample_test") {
116    testonly = true
117    sources = [ "random_sample_test.c" ]
118    configs = [
119      ":gwp_asan_test_config",
120      "//third_party/musl/libc-test/src/common:config_runtest",
121    ]
122    subsystem_name = "musl"
123    part_name = "libc-test"
124  }
125
126  ohos_executable("gwp_asan_fork_simple_test") {
127    testonly = true
128    sources = [ "fork_simple_test.c" ]
129    configs = [
130      ":gwp_asan_test_config",
131      "//third_party/musl/libc-test/src/common:config_runtest",
132    ]
133    subsystem_name = "musl"
134    part_name = "libc-test"
135  }
136
137  ohos_executable("gwp_asan_thread_fork_test") {
138    testonly = true
139    sources = [ "thread_fork_test.c" ]
140    configs = [
141      ":gwp_asan_test_config",
142      "//third_party/musl/libc-test/src/common:config_runtest",
143    ]
144    subsystem_name = "musl"
145    part_name = "libc-test"
146  }
147
148  group("gwp_asan_test") {
149    testonly = true
150    deps = [
151      ":gwp_asan_buffer_overflow_test",
152      ":gwp_asan_buffer_underflow_test",
153      ":gwp_asan_double_free_test",
154      ":gwp_asan_fork_simple_test",
155      ":gwp_asan_invalid_free_left_test",
156      ":gwp_asan_invalid_free_right_test",
157      ":gwp_asan_random_sample_test",
158      ":gwp_asan_smoke_test",
159      ":gwp_asan_thread_fork_test",
160      ":gwp_asan_unwind_test",
161      ":gwp_asan_use_after_free_test",
162    ]
163  }
164}
165