1# Copyright 2015 The Chromium Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4# 5# Fuzzing Infrastructure Tests 6 7import("//testing/libfuzzer/fuzzer_test.gni") 8import("//testing/test.gni") 9 10# TODO(crbug.com/906751): Get the tests working on Windows. Disable them for now 11# because they cause the Windows clang ToT builder to fail. 12if (!is_win) { 13 test("libfuzzer_tests") { 14 sources = [ "fuzzer_launcher_test.cc" ] 15 deps = [ 16 ":test_config_and_dict", 17 ":test_config_and_seed_corpus", 18 ":test_config_and_seed_corpuses", 19 ":test_config_only", 20 ":test_dict_from_subdir", 21 ":test_dict_only", 22 "//base", 23 "//testing/gmock", 24 "//testing/gtest", 25 "//testing/gtest:gtest_main", 26 ] 27 data_deps = [ 28 ":check_fuzzer_config", 29 ":check_seed_corpus_archive", 30 ] 31 } 32} 33 34fuzzer_test("test_dict_only") { 35 sources = [ "../fuzzers/empty_fuzzer.cc" ] 36 dict = "test.dict" 37 additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ] 38} 39 40fuzzer_test("test_config_only") { 41 sources = [ "../fuzzers/empty_fuzzer.cc" ] 42 libfuzzer_options = [ 43 "some_test_option=test_value", 44 "max_len=1024", 45 ] 46 additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ] 47} 48 49fuzzer_test("test_config_and_dict") { 50 sources = [ "../fuzzers/empty_fuzzer.cc" ] 51 dict = "test.dict" 52 libfuzzer_options = [ 53 "max_len=random(1337, 31337)", 54 "timeout = 666", 55 "use_traces=1", 56 ] 57 additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ] 58} 59 60fuzzer_test("test_config_and_seed_corpus") { 61 sources = [ "../fuzzers/empty_fuzzer.cc" ] 62 seed_corpus = "test_corpus" 63 libfuzzer_options = [ 64 "some_test_option=test_value", 65 "max_len=1024", 66 ] 67 additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ] 68} 69 70fuzzer_test("test_config_and_seed_corpuses") { 71 sources = [ "../fuzzers/empty_fuzzer.cc" ] 72 seed_corpuses = [ 73 "test_corpus", 74 "test_corpus_2", 75 ] 76 libfuzzer_options = [ 77 "some_test_option=another_test_value", 78 "max_len=1337", 79 ] 80 additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ] 81} 82 83fuzzer_test("test_dict_from_subdir") { 84 sources = [ "../fuzzers/empty_fuzzer.cc" ] 85 dict = "dicts_subdir/test_subdir.dict" 86 additional_configs = [ "//testing/libfuzzer:no_clusterfuzz" ] 87} 88 89copy("check_fuzzer_config") { 90 sources = [ "check_fuzzer_config.py" ] 91 outputs = [ "$root_build_dir/check_fuzzer_config.py" ] 92} 93 94copy("check_seed_corpus_archive") { 95 sources = [ "check_seed_corpus_archive.py" ] 96 outputs = [ "$root_build_dir/check_seed_corpus_archive.py" ] 97} 98