BUILD.gn 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. # Copyright 2018 Google Inc. All rights reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import("//testing/libfuzzer/fuzzer_test.gni")
  15. import("//testing/test.gni")
  16. config("fuzzer_config") {
  17. configs = [ "../..:spvtools_internal_config" ]
  18. }
  19. group("fuzzers") {
  20. testonly = true
  21. deps = []
  22. if (!build_with_chromium || use_fuzzing_engine) {
  23. deps += [ ":fuzzers_bin" ]
  24. }
  25. }
  26. if (!build_with_chromium || use_fuzzing_engine) {
  27. group("fuzzers_bin") {
  28. testonly = true
  29. deps = [
  30. ":spvtools_as_fuzzer",
  31. ":spvtools_binary_parser_fuzzer",
  32. ":spvtools_dis_fuzzer",
  33. ":spvtools_opt_legalization_fuzzer",
  34. ":spvtools_opt_performance_fuzzer",
  35. ":spvtools_opt_size_fuzzer",
  36. ":spvtools_val_fuzzer",
  37. ]
  38. }
  39. }
  40. template("spvtools_fuzzer") {
  41. source_set(target_name) {
  42. testonly = true
  43. sources = invoker.sources
  44. sources += [ "random_generator.cpp" ]
  45. deps = [
  46. "../..:spvtools",
  47. "../..:spvtools_opt",
  48. "../..:spvtools_val",
  49. ]
  50. if (defined(invoker.deps)) {
  51. deps += invoker.deps
  52. }
  53. configs -= [ "//build/config/compiler:chromium_code" ]
  54. configs += [
  55. "//build/config/compiler:no_chromium_code",
  56. ":fuzzer_config",
  57. ]
  58. }
  59. }
  60. spvtools_fuzzer("spvtools_as_fuzzer_src") {
  61. sources = [
  62. "spvtools_as_fuzzer.cpp",
  63. ]
  64. }
  65. spvtools_fuzzer("spvtools_binary_parser_fuzzer_src") {
  66. sources = [
  67. "spvtools_binary_parser_fuzzer.cpp",
  68. ]
  69. }
  70. spvtools_fuzzer("spvtools_dis_fuzzer_src") {
  71. sources = [
  72. "spvtools_dis_fuzzer.cpp",
  73. ]
  74. }
  75. spvtools_fuzzer("spvtools_opt_performance_fuzzer_src") {
  76. sources = [
  77. "spvtools_opt_performance_fuzzer.cpp",
  78. "spvtools_opt_fuzzer_common.cpp",
  79. ]
  80. }
  81. spvtools_fuzzer("spvtools_opt_legalization_fuzzer_src") {
  82. sources = [
  83. "spvtools_opt_legalization_fuzzer.cpp",
  84. "spvtools_opt_fuzzer_common.cpp",
  85. ]
  86. }
  87. spvtools_fuzzer("spvtools_opt_size_fuzzer_src") {
  88. sources = [
  89. "spvtools_opt_size_fuzzer.cpp",
  90. "spvtools_opt_fuzzer_common.cpp",
  91. ]
  92. }
  93. spvtools_fuzzer("spvtools_val_fuzzer_src") {
  94. sources = [
  95. "spvtools_val_fuzzer.cpp",
  96. ]
  97. }
  98. if (!build_with_chromium || use_fuzzing_engine) {
  99. fuzzer_test("spvtools_as_fuzzer") {
  100. sources = []
  101. deps = [
  102. ":spvtools_as_fuzzer_src",
  103. ]
  104. # Intentionally doesn't use the seed corpus, because it consumes
  105. # part of the input as not part of the file.
  106. }
  107. fuzzer_test("spvtools_binary_parser_fuzzer") {
  108. sources = []
  109. deps = [
  110. ":spvtools_binary_parser_fuzzer_src",
  111. ]
  112. # Intentionally doesn't use the seed corpus, because it consumes
  113. # part of the input as not part of the file.
  114. }
  115. fuzzer_test("spvtools_dis_fuzzer") {
  116. sources = []
  117. deps = [
  118. ":spvtools_dis_fuzzer_src",
  119. ]
  120. # Intentionally doesn't use the seed corpus, because it consumes
  121. # part of the input as not part of the file.
  122. }
  123. fuzzer_test("spvtools_opt_performance_fuzzer") {
  124. sources = []
  125. deps = [
  126. ":spvtools_opt_performance_fuzzer_src",
  127. ]
  128. seed_corpus = "corpora/spv"
  129. }
  130. fuzzer_test("spvtools_opt_legalization_fuzzer") {
  131. sources = []
  132. deps = [
  133. ":spvtools_opt_legalization_fuzzer_src",
  134. ]
  135. seed_corpus = "corpora/spv"
  136. }
  137. fuzzer_test("spvtools_opt_size_fuzzer") {
  138. sources = []
  139. deps = [
  140. ":spvtools_opt_size_fuzzer_src",
  141. ]
  142. seed_corpus = "corpora/spv"
  143. }
  144. fuzzer_test("spvtools_val_fuzzer") {
  145. sources = []
  146. deps = [
  147. ":spvtools_val_fuzzer_src",
  148. ]
  149. seed_corpus = "corpora/spv"
  150. }
  151. }