#!/bin/bash # Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. template("ohos_unittest") { if (defined(invoker.ldflags)) { print(invoker.ldflags) } executable(target_name) { forward_variables_from(invoker, "*") testonly = true if (defined(invoker.deps)) { deps += invoker.deps } if (defined(invoker.public_deps)) { public_deps += invoker.public_deps } if (defined(invoker.ldflags)) { print(invoker.ldflags) } if (defined(invoker.cflags)) { print(invoker.cflags) cflags += invoker.cflags } } } template("ohos_fuzztest") { executable(target_name) { forward_variables_from(invoker, "*") testonly = true deps = [] if (defined(invoker.deps)) { deps += invoker.deps } if (defined(invoker.cflags)) { cflags += invoker.cflags } ldflags += [ "-fsanitize=fuzzer" ] cflags += [ "-fno-sanitize-coverage=trace-pc-guard,edge,trace-cmp,indirect-calls,8bit-counters", "-fsanitize=fuzzer", ] } }