1import("//build/test.gni") 2import("../../../musl_config.gni") 3 4if (use_gwp_asan) { 5 config("gwp_asan_test_config") { 6 cflags = [ 7 "-fno-omit-frame-pointer", 8 "-g", 9 "-Wno-incompatible-pointer-types", 10 ] 11 include_dirs = [ 12 "//third_party/musl/porting/linux/user/src/gwp_asan", 13 "//third_party/musl/libc-test/src/common", 14 ] 15 defines = [ "USE_GWP_ASAN" ] 16 } 17 18 ohos_executable("gwp_asan_double_free_test") { 19 testonly = true 20 sources = [ "double_free.c" ] 21 configs = [ 22 ":gwp_asan_test_config", 23 "//third_party/musl/libc-test/src/common:config_runtest", 24 ] 25 subsystem_name = "musl" 26 part_name = "libc-test" 27 } 28 29 ohos_executable("gwp_asan_invalid_free_left_test") { 30 testonly = true 31 sources = [ "invalid_free_left.c" ] 32 configs = [ 33 ":gwp_asan_test_config", 34 "//third_party/musl/libc-test/src/common:config_runtest", 35 ] 36 subsystem_name = "musl" 37 part_name = "libc-test" 38 } 39 40 ohos_executable("gwp_asan_invalid_free_right_test") { 41 testonly = true 42 sources = [ "invalid_free_right.c" ] 43 configs = [ 44 ":gwp_asan_test_config", 45 "//third_party/musl/libc-test/src/common:config_runtest", 46 ] 47 subsystem_name = "musl" 48 part_name = "libc-test" 49 } 50 51 ohos_executable("gwp_asan_buffer_overflow_test") { 52 testonly = true 53 sources = [ "buffer_overflow.c" ] 54 configs = [ 55 ":gwp_asan_test_config", 56 "//third_party/musl/libc-test/src/common:config_runtest", 57 ] 58 subsystem_name = "musl" 59 part_name = "libc-test" 60 } 61 62 ohos_executable("gwp_asan_buffer_underflow_test") { 63 testonly = true 64 sources = [ "buffer_underflow.c" ] 65 configs = [ 66 ":gwp_asan_test_config", 67 "//third_party/musl/libc-test/src/common:config_runtest", 68 ] 69 subsystem_name = "musl" 70 part_name = "libc-test" 71 } 72 73 ohos_executable("gwp_asan_use_after_free_test") { 74 testonly = true 75 sources = [ "use_after_free.c" ] 76 configs = [ 77 ":gwp_asan_test_config", 78 "//third_party/musl/libc-test/src/common:config_runtest", 79 ] 80 subsystem_name = "musl" 81 part_name = "libc-test" 82 } 83 84 ohos_executable("gwp_asan_unwind_test") { 85 testonly = true 86 sources = [ "unwind_test.c" ] 87 configs = [ 88 ":gwp_asan_test_config", 89 "//third_party/musl/libc-test/src/common:config_runtest", 90 ] 91 subsystem_name = "musl" 92 part_name = "libc-test" 93 } 94 95 ohos_executable("gwp_asan_smoke_test") { 96 testonly = true 97 sources = [ "gwp_asan_smoke_test.c" ] 98 configs = [ 99 ":gwp_asan_test_config", 100 "//third_party/musl/libc-test/src/common:config_runtest", 101 ] 102 subsystem_name = "musl" 103 part_name = "libc-test" 104 } 105 106 ohos_executable("gwp_asan_random_sample_test") { 107 testonly = true 108 sources = [ "random_sample_test.c" ] 109 configs = [ 110 ":gwp_asan_test_config", 111 "//third_party/musl/libc-test/src/common:config_runtest", 112 ] 113 subsystem_name = "musl" 114 part_name = "libc-test" 115 } 116 117 group("gwp_asan_test") { 118 testonly = true 119 deps = [ 120 ":gwp_asan_buffer_overflow_test", 121 ":gwp_asan_buffer_underflow_test", 122 ":gwp_asan_double_free_test", 123 ":gwp_asan_invalid_free_left_test", 124 ":gwp_asan_invalid_free_right_test", 125 ":gwp_asan_random_sample_test", 126 ":gwp_asan_smoke_test", 127 ":gwp_asan_unwind_test", 128 ":gwp_asan_use_after_free_test", 129 ] 130 } 131} 132