1# Copyright 2019 Google LLC 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# https://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 15# -*- mode: python; -*- 16# vim:set ft=blazebuild: 17 18"""Macro to run tests both with and without optimizations.""" 19 20def emboss_cc_util_test(name, copts = [], **kwargs): 21 """Constructs two cc_test targets, with and without optimizations.""" 22 native.cc_test( 23 name = name, 24 copts = copts + ["-Wsign-compare"], 25 **kwargs 26 ) 27 native.cc_test( 28 name = name + "_no_opts", 29 copts = copts + [ 30 # This is generally a dangerous flag for an individual target, but 31 # these tests do not depend on any other .cc files that might 32 # #include any Emboss headers. 33 "-DEMBOSS_NO_OPTIMIZATIONS", 34 ], 35 **kwargs 36 ) 37