1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
# -*- mode: python -*- vim: filetype=python
# -----------------------------------------------------------------------------
# Copyright (c) 2014-2023, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#
# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
# -----------------------------------------------------------------------------
def configure(ctx):
ctx.msg('Build tests', "enabled" if ctx.options.enable_tests else "disabled")
if ctx.options.enable_tests:
ctx.check_cc(lib='cmocka', mandatory=False, uselib_store='CMOCKA')
def build(ctx):
def test_program(name):
if ctx.env.DEST_OS == 'win32':
# Z: inflate*()
# ADVAPI32: ConvertStringSecurityDescriptorToSecurityDescriptorW()
extra_libs=['ADVAPI32', 'Z', 'STATIC_ZLIB']
else:
extra_libs=['STATIC_ZLIB']
ctx.program(
source= ["test_%s.c" % name],
target="test_%s" % name,
includes='../src',
use=ctx.env.link_with_dynlibs + ["CMOCKA", "OBJECTS"] + extra_libs,
stlib=ctx.env.link_with_staticlibs,
install_path=None,
)
if ctx.env.DEST_OS == 'win32' and ctx.variant.endswith('w'):
# Skip building tests on Windows with windowed variants. In addition to
# requiring additional libraries, these also expect the entry point to
# be WinMain() instead of main().
return
if ctx.options.enable_tests and "LIB_CMOCKA" in ctx.env:
test_program("path")
test_program("multipkg")
|