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/porting/linux/user/src/gwp_asan", 14 "${musl_src_base}/src/gwp_asan", 15 "//third_party/musl/libc-test/src/common", 16 ] 17 defines = [ "USE_GWP_ASAN" ] 18 } 19 20 ohos_executable("gwp_asan_double_free_test") { 21 testonly = true 22 sources = [ "double_free.c" ] 23 configs = [ 24 ":gwp_asan_test_config", 25 "//third_party/musl/libc-test/src/common:config_runtest", 26 ] 27 subsystem_name = "musl" 28 part_name = "libc-test" 29 } 30 31 ohos_executable("gwp_asan_invalid_free_left_test") { 32 testonly = true 33 sources = [ "invalid_free_left.c" ] 34 configs = [ 35 ":gwp_asan_test_config", 36 "//third_party/musl/libc-test/src/common:config_runtest", 37 ] 38 subsystem_name = "musl" 39 part_name = "libc-test" 40 } 41 42 ohos_executable("gwp_asan_invalid_free_right_test") { 43 testonly = true 44 sources = [ "invalid_free_right.c" ] 45 configs = [ 46 ":gwp_asan_test_config", 47 "//third_party/musl/libc-test/src/common:config_runtest", 48 ] 49 subsystem_name = "musl" 50 part_name = "libc-test" 51 } 52 53 ohos_executable("gwp_asan_buffer_overflow_test") { 54 testonly = true 55 sources = [ "buffer_overflow.c" ] 56 configs = [ 57 ":gwp_asan_test_config", 58 "//third_party/musl/libc-test/src/common:config_runtest", 59 ] 60 subsystem_name = "musl" 61 part_name = "libc-test" 62 } 63 64 ohos_executable("gwp_asan_buffer_underflow_test") { 65 testonly = true 66 sources = [ "buffer_underflow.c" ] 67 configs = [ 68 ":gwp_asan_test_config", 69 "//third_party/musl/libc-test/src/common:config_runtest", 70 ] 71 subsystem_name = "musl" 72 part_name = "libc-test" 73 } 74 75 ohos_executable("gwp_asan_use_after_free_test") { 76 testonly = true 77 sources = [ "use_after_free.c" ] 78 configs = [ 79 ":gwp_asan_test_config", 80 "//third_party/musl/libc-test/src/common:config_runtest", 81 ] 82 subsystem_name = "musl" 83 part_name = "libc-test" 84 } 85 86 ohos_executable("gwp_asan_unwind_test") { 87 testonly = true 88 sources = [ "unwind_test.c" ] 89 configs = [ 90 ":gwp_asan_test_config", 91 "//third_party/musl/libc-test/src/common:config_runtest", 92 ] 93 subsystem_name = "musl" 94 part_name = "libc-test" 95 } 96 97 ohos_executable("gwp_asan_smoke_test") { 98 testonly = true 99 sources = [ "gwp_asan_smoke_test.c" ] 100 configs = [ 101 ":gwp_asan_test_config", 102 "//third_party/musl/libc-test/src/common:config_runtest", 103 ] 104 subsystem_name = "musl" 105 part_name = "libc-test" 106 } 107 108 ohos_executable("gwp_asan_random_sample_test") { 109 testonly = true 110 sources = [ "random_sample_test.c" ] 111 configs = [ 112 ":gwp_asan_test_config", 113 "//third_party/musl/libc-test/src/common:config_runtest", 114 ] 115 subsystem_name = "musl" 116 part_name = "libc-test" 117 } 118 119 ohos_executable("gwp_asan_fork_simple_test") { 120 testonly = true 121 sources = [ "fork_simple_test.c" ] 122 configs = [ 123 ":gwp_asan_test_config", 124 "//third_party/musl/libc-test/src/common:config_runtest", 125 ] 126 subsystem_name = "musl" 127 part_name = "libc-test" 128 } 129 130 ohos_executable("gwp_asan_thread_fork_test") { 131 testonly = true 132 sources = [ "thread_fork_test.c" ] 133 configs = [ 134 ":gwp_asan_test_config", 135 "//third_party/musl/libc-test/src/common:config_runtest", 136 ] 137 subsystem_name = "musl" 138 part_name = "libc-test" 139 } 140 141 group("gwp_asan_test") { 142 testonly = true 143 deps = [ 144 ":gwp_asan_buffer_overflow_test", 145 ":gwp_asan_buffer_underflow_test", 146 ":gwp_asan_double_free_test", 147 ":gwp_asan_fork_simple_test", 148 ":gwp_asan_invalid_free_left_test", 149 ":gwp_asan_invalid_free_right_test", 150 ":gwp_asan_random_sample_test", 151 ":gwp_asan_smoke_test", 152 ":gwp_asan_thread_fork_test", 153 ":gwp_asan_unwind_test", 154 ":gwp_asan_use_after_free_test", 155 ] 156 } 157} 158