blob: ed20e32b4d8a3edc0d49bbcd95fcfcb14fb76631 [file] [log] [blame]
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//testing/libfuzzer/fuzzer_test.gni")
import("//testing/test.gni")
config("common_config") {
if (is_win) {
defines = [
# Required to use math constants from math.h.
"_USE_MATH_DEFINES",
]
}
}
static_library("pffft") {
configs += [ ":common_config" ]
sources = [
"src/pffft.c",
"src/pffft.h",
]
}
# Fuzzing.
group("fuzzers") {
testonly = true
deps = [
":pffft_complex_fuzzer",
":pffft_real_fuzzer",
]
}
fuzzer_testdata_dir = "$target_gen_dir/testdata"
action("generate_pffft_fuzzer_corpus") {
script = "generate_seed_corpus.py"
sources = [
"generate_seed_corpus.py",
]
args = [ rebase_path(fuzzer_testdata_dir, root_build_dir) ]
outputs = [
fuzzer_testdata_dir,
]
}
fuzzer_test("pffft_complex_fuzzer") {
sources = [
"pffft_fuzzer.cc",
]
cflags = [ "-DTRANSFORM_COMPLEX" ]
deps = [
":pffft",
]
seed_corpus = fuzzer_testdata_dir
seed_corpus_deps = [ ":generate_pffft_fuzzer_corpus" ]
}
fuzzer_test("pffft_real_fuzzer") {
sources = [
"pffft_fuzzer.cc",
]
cflags = [ "-DTRANSFORM_REAL" ]
deps = [
":pffft",
]
seed_corpus = fuzzer_testdata_dir
seed_corpus_deps = [ ":generate_pffft_fuzzer_corpus" ]
}
# Unit tests and benchmark.
# This target must be used only for testing and benchmark purposes.
static_library("fftpack") {
testonly = true
configs += [ ":common_config" ]
sources = [
"src/fftpack.c",
"src/fftpack.h",
]
visibility = [ ":*" ]
}
executable("pffft_benchmark") {
testonly = true
configs += [ ":common_config" ]
sources = [
"src/test_pffft.c",
]
deps = [
":fftpack",
":pffft",
]
}
test("pffft_unittest") {
testonly = true
sources = [
"pffft_unittest.cc",
]
deps = [
":fftpack",
":pffft",
"//testing/gtest",
"//testing/gtest:gtest_main",
]
}