vitess.io/vitess@v0.16.2/go/test/fuzzing/oss_fuzz_build.sh (about) 1 #!/bin/bash 2 3 # Copyright 2021 The Vitess Authors. 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 set -o nounset 18 set -o pipefail 19 set -o errexit 20 set -x 21 22 go get github.com/AdaLogics/go-fuzz-headers 23 go mod vendor 24 25 # Disable logging for mysql conn 26 # This affects the mysql fuzzers 27 sed -i '/log.Errorf/c\\/\/log.Errorf' $SRC/vitess/go/mysql/conn.go 28 29 mv ./go/vt/vttablet/tabletmanager/vreplication/framework_test.go \ 30 ./go/vt/vttablet/tabletmanager/vreplication/framework_fuzz.go 31 32 #consistent_lookup_test.go is needed for loggingVCursor 33 mv ./go/vt/vtgate/vindexes/consistent_lookup_test.go \ 34 ./go/vt/vtgate/vindexes/consistent_lookup_test_fuzz.go 35 36 # fake_vcursor_test.go is needed for loggingVCursor 37 mv ./go/vt/vtgate/engine/fake_vcursor_test.go \ 38 ./go/vt/vtgate/engine/fake_vcursor.go 39 40 # plan_test.go is needed for vschemaWrapper 41 mv ./go/vt/vtgate/planbuilder/plan_test.go \ 42 ./go/vt/vtgate/planbuilder/plan_test_fuzz.go 43 44 # tabletserver fuzzer 45 mv ./go/vt/vttablet/tabletserver/testutils_test.go \ 46 ./go/vt/vttablet/tabletserver/testutils_fuzz.go 47 48 # autogenerate and build api_marshal_fuzzer: 49 cd $SRC/vitess/go/vt 50 grep -r ') Unmarshal' .>>/tmp/marshal_targets.txt 51 cd $SRC/vitess/go/test/fuzzing/autogenerate 52 go run convert_grep_to_fuzzer.go 53 mv api_marshal_fuzzer.go $SRC/vitess/go/test/fuzzing/ 54 compile_go_fuzzer vitess.io/vitess/go/test/fuzzing FuzzAPIMarshal api_marshal_fuzzer 55 56 # collation fuzzer 57 mv ./go/mysql/collations/uca_test.go \ 58 ./go/mysql/collations/uca_test_fuzz.go 59 60 compile_go_fuzzer vitess.io/vitess/go/mysql/collations FuzzCollations fuzz_collations 61 62 63 compile_go_fuzzer vitess.io/vitess/go/vt/vtgate/planbuilder FuzzTestBuilder fuzz_test_builder gofuzz 64 compile_go_fuzzer vitess.io/vitess/go/vt/vtgate/vindexes FuzzVindex fuzz_vindex 65 compile_go_fuzzer vitess.io/vitess/go/vt/vttablet/tabletmanager/vreplication FuzzEngine fuzz_replication_engine 66 compile_go_fuzzer vitess.io/vitess/go/vt/vtgate/engine FuzzEngine engine_fuzzer 67 68 69 compile_go_fuzzer vitess.io/vitess/go/test/fuzzing Fuzz vtctl_fuzzer 70 compile_go_fuzzer vitess.io/vitess/go/test/fuzzing FuzzIsDML is_dml_fuzzer 71 compile_go_fuzzer vitess.io/vitess/go/test/fuzzing FuzzNormalizer normalizer_fuzzer 72 compile_go_fuzzer vitess.io/vitess/go/test/fuzzing FuzzParser parser_fuzzer 73 compile_go_fuzzer vitess.io/vitess/go/test/fuzzing FuzzNodeFormat fuzz_node_format 74 compile_go_fuzzer vitess.io/vitess/go/test/fuzzing FuzzGRPCTMServer fuzz_grpc_tm_server 75 compile_go_fuzzer vitess.io/vitess/go/test/fuzzing FuzzOnlineDDLFromCommentedStatement fuzz_online_ddl_from_commented_statement 76 compile_go_fuzzer vitess.io/vitess/go/test/fuzzing FuzzNewOnlineDDLs fuzz_new_online_ddls 77 compile_go_fuzzer vitess.io/vitess/go/test/fuzzing FuzzEqualsSQLNode fuzz_equals_sql_node 78 compile_go_fuzzer vitess.io/vitess/go/test/fuzzing FuzzSplitStatementToPieces fuzz_split_statement_to_pieces 79 compile_go_fuzzer vitess.io/vitess/go/test/fuzzing FuzzTabletManager_ExecuteFetchAsDba fuzz_tablet_manager_execute_fetch_as_dba 80 compile_go_fuzzer vitess.io/vitess/go/test/fuzzing FuzzUnmarshalJSON fuzz_tabletserver_rules_unmarshal_json 81 compile_go_fuzzer vitess.io/vitess/go/test/fuzzing FuzzLoadTable fuzz_load_table 82 83 84 compile_go_fuzzer vitess.io/vitess/go/mysql FuzzWritePacket write_packet_fuzzer 85 compile_go_fuzzer vitess.io/vitess/go/mysql FuzzHandleNextCommand handle_next_command_fuzzer 86 compile_go_fuzzer vitess.io/vitess/go/mysql FuzzReadQueryResults read_query_results_fuzzer 87 compile_go_fuzzer vitess.io/vitess/go/mysql FuzzTLSServer fuzz_tls 88 89 compile_go_fuzzer vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer Fuzz vstreamer_planbuilder_fuzzer 90 compile_go_fuzzer vitess.io/vitess/go/vt/vttablet/tabletserver FuzzGetPlan fuzz_get_plan 91 92 # Several test utils are needed from suite_test.go: 93 mv ./go/vt/vtgate/grpcvtgateconn/suite_test.go \ 94 ./go/vt/vtgate/grpcvtgateconn/suite_test_fuzz.go 95 mv ./go/vt/vtgate/grpcvtgateconn/fuzz_flaky_test.go \ 96 ./go/vt/vtgate/grpcvtgateconn/fuzz.go 97 compile_go_fuzzer vitess.io/vitess/go/vt/vtgate/grpcvtgateconn Fuzz grpc_vtgate_fuzzer 98 99 compile_go_fuzzer vitess.io/vitess/go/vt/vtgate/planbuilder/abstract FuzzAnalyse fuzz_analyse gofuzz 100 101 102 103 # Build dictionaries 104 cp $SRC/vitess/go/test/fuzzing/vtctl_fuzzer.dict $OUT/