1# pylint:disable=I0011,W0401,W0614,C0103,E0602 2############################################################################ 3# Copyright 2017 Intel Corporation 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"""Build configuration for unit test of minimal library. 18""" 19Import('*') 20env.PartName('utest') 21 22env.DependsOn([Component(env.subst('${PART_PARENT_NAME}'), 23 requires=REQ.EXISTS|REQ.DEFAULT), 24 Component('gtest'), 25 Component('common-testhelper'), 26 Component('verifier')]) 27 28utest_files = Pattern(src_dir='.', 29 includes=['*-test.cc', 30 '*-testhelper.cc'], 31 recursive=True).files() 32 33env.Append(CPPPATH='#') 34 35env['UNIT_TEST_TARGET_NAME'] = "${PART_PARENT_NAME}-${UNIT_TEST_TARGET}" 36 37shlib = [] 38 39if 'shared' in env['MODE']: 40 if env['TARGET_OS'] == 'win32': 41 dependent_shlib = env.subst("${{DEPENDS.{0}.SDKBIN}}" 42 .format(env.subst("${PART_PARENT_NAME}"))) 43 shlib = env.CCopy("${INSTALL_TEST_BIN}", dependent_shlib) 44 else: 45 dependent_shlib = env.subst("${{DEPENDS.{0}.SDKLIB}}" 46 .format(env.subst("${PART_PARENT_NAME}"))) 47 shlib = env.CCopy("${INSTALL_LIB}", dependent_shlib) 48 49 50utest = env.UnitTest('${PART_SHORT_NAME}', 51 utest_files, 52 command_args=[ 53 '--gtest_filter=**', 54 '--gtest_color=yes', 55 '--gtest_print_time=1', 56 '--gtest_output=xml', 57 #'--gtest_break_on_failure', 58 #'--gtest_catch_exceptions=0', 59 ], 60 data_src=[], 61 make_pdb=(env.isConfigBasedOn('debug')), 62 INSTALL_BIN='${INSTALL_TEST_BIN}' 63 ) 64Depends(utest, shlib) 65