当前位置: 首页>>代码示例>>Python>>正文


Python BoostBuild类代码示例

本文整理汇总了Python中BoostBuild的典型用法代码示例。如果您正苦于以下问题:Python BoostBuild类的具体用法?Python BoostBuild怎么用?Python BoostBuild使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BoostBuild类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_raw_empty

def test_raw_empty():
    whitespace_in = "  \n\n\r\r\v\v\t\t   \t   \r\r   \n\n"

    #   We tell the testing system to read its child process output as raw
    # binary data but the bjam process we run will read its input file and
    # write out its output as text, i.e. convert all of our "\r\n" sequences to
    # "\n" on input and all of its "\n" characters back to "\r\n" on output.
    # This means that any lone "\n" input characters not preceded by "\r" will
    # get an extra "\r" added in front of it on output.
    whitespace_out = whitespace_in.replace("\r\n", "\n").replace("\n", "\r\n")

    t = BoostBuild.Tester(["-d2", "-d+4"], pass_d0=False, pass_toolset=0,
        use_test_config=False)
    t.write("file.jam", """\
actions do_empty {%s}
JAMSHELL = %% ;
do_empty all ;
""" % (whitespace_in))
    t.run_build_system(["-ffile.jam"], universal_newlines=False)
    t.expect_output_lines("do_empty all")
    t.expect_output_lines("Executing raw command directly", False)
    if "\r\n%s\r\n" % whitespace_out not in t.stdout():
        BoostBuild.annotation("failure", "Whitespace action content not found "
            "on stdout.")
        t.fail_test(1, dump_difference=False)
    t.cleanup()
开发者ID:AlexMioMio,项目名称:boost,代码行数:26,代码来源:core_nt_cmd_line.py

示例2: run_tests

def run_tests(critical_tests, other_tests):
    """Runs first critical tests and then other_tests.

       Stops on first error, and write the name of failed test to
       test_results.txt. Critical tests are run in the specified order,
       other tests are run starting with the one that failed the last time.
    """
    last_failed = last_failed_test()
    other_tests = reorder_tests(other_tests, last_failed)
    all_tests = critical_tests + other_tests

    invocation_dir = os.getcwd()

    pass_count = 0
    failures_count = 0
    for i in all_tests:
        print ("%-25s : " %(i)),
        try:
            __import__(i)
        except SystemExit:
            print "FAILED"
            if failures_count == 0:
                f = open(os.path.join(invocation_dir, 'test_results.txt'), 'w')
                f.write(i)
                f.close()
            failures_count = failures_count + 1
            # Restore the current directory, which might be changed by the
            # test
            os.chdir(invocation_dir)
            BoostBuild.flush_annotations();
            continue
        print "PASSED"
        BoostBuild.flush_annotations();
        pass_count = pass_count + 1
        sys.stdout.flush()  # makes testing under emacs more entertaining.
        
    # Erase the file on success
    if failures_count == 0:
        open('test_results.txt', 'w')

    print """
    === Test summary ===
    PASS: %d
    FAIL: %d
    """ % (pass_count, failures_count)
开发者ID:gorkinovich,项目名称:DefendersOfMankind,代码行数:45,代码来源:test_all.py

示例3: check_for_existing_boost_build_jam

def check_for_existing_boost_build_jam(t):
    """
      This test depends on no boost-build.jam file existing in any of the
    folders along the current folder's path. If it does exist, not only would
    this test fail but it could point to a completely wrong Boost Build
    installation, thus causing headaches when attempting to diagnose the
    problem. That is why we explicitly check for this scenario.

    """
    problem = find_up_to_root(t.workdir, "boost-build.jam")
    if problem:
        BoostBuild.annotation("misconfiguration", """\
This test expects to be run from a folder with no 'boost-build.jam' file in any
of the folders along its path.

Working folder:
  '%s'

Problematic boost-build.jam found at:
  '%s'

Please remove this file or change the test's working folder and rerun the test.
""" % (t.workdir, problem))
        t.fail_test(1, dump_stdio=False, dump_stack=False)
开发者ID:Kirija,项目名称:XPIR,代码行数:24,代码来源:startup_v2.py

示例4: run_tests

def run_tests(critical_tests, other_tests):
    """Runs first critical tests and then other_tests.

       Stops on first error, and write the name of failed test to
       test_results.txt. Critical tests are run in the specified order, other
       tests are run starting with the one that failed the last time.
    """
    last_failed = last_failed_test()
    other_tests = reorder_tests(other_tests, last_failed)
    all_tests = critical_tests + other_tests

    invocation_dir = os.getcwd()

    pass_count = 0
    failures_count = 0

    for i in all_tests:
        passed = 1
        if not xml:
            print ("%-25s : " % (i)),
        try:
            __import__(i)
        except SystemExit:
            passed = 0
            if failures_count == 0:
                f = open(os.path.join(invocation_dir, "test_results.txt"), "w")
                f.write(i)
                f.close()
            failures_count = failures_count + 1
            # Restore the current directory, which might be changed by the test.
            os.chdir(invocation_dir)

        if not xml:
            if passed:
                print "PASSED"
            else:
                print "FAILED"

            if i == "regression":
                BoostBuild.flush_annotations()
            BoostBuild.clear_annotations()
        else:
            rs = "succeed"
            if not passed:
                rs = "fail"
            print """
<test-log library="build" test-name="%s" test-type="run" toolset="%s" test-program="%s" target-directory="%s">
<run result="%s">""" % (
                i,
                toolset,
                "tools/build/v2/test/" + i + ".py",
                "boost/bin.v2/boost.build.tests/" + toolset + "/" + i,
                rs,
            )

            if not passed:
                BoostBuild.flush_annotations(1)

            print """
</run>
</test-log>
"""
        if passed:
            pass_count = pass_count + 1
        sys.stdout.flush()  # Makes testing under emacs more entertaining.

    # Erase the file on success.
    if failures_count == 0:
        open("test_results.txt", "w")

    if not xml:
        print """
        === Test summary ===
        PASS: %d
        FAIL: %d
        """ % (
            pass_count,
            failures_count,
        )
开发者ID:,项目名称:,代码行数:79,代码来源:

示例5: in

#!/usr/bin/python

# Copyright 2002-2005 Dave Abrahams.
# Copyright 2002-2006 Vladimir Prus.
# Distributed under the Boost Software License, Version 1.0.
#    (See accompanying file LICENSE_1_0.txt or copy at
#         http://www.boost.org/LICENSE_1_0.txt)

import os
import sys
import string
import BoostBuild

xml = "--xml" in sys.argv
toolset = BoostBuild.get_toolset()


# Clear environment for testing.
#
for s in ("BOOST_ROOT", "BOOST_BUILD_PATH", "JAM_TOOLSET", "BCCROOT", "MSVCDir", "MSVC", "MSVCNT", "MINGW", "watcom"):
    try:
        del os.environ[s]
    except:
        pass

BoostBuild.set_defer_annotations(1)


def run_tests(critical_tests, other_tests):
    """Runs first critical tests and then other_tests.
开发者ID:,项目名称:,代码行数:30,代码来源:

示例6: defined

lib a : a.cpp ;
install dist : a ;
""")

t.write("a/a.cpp", """
#if defined(_WIN32)
__declspec(dllexport)
#endif
void a() {}
""")

t.run_build_system(subdir="a")
t.expect_addition("a/dist/a.dll")

if ( ( os.name == 'nt' ) or os.uname()[0].lower().startswith('cygwin') ) and \
    ( BoostBuild.get_toolset() != 'gcc' ):
    # This is windows import library -- we know the exact name.
    file = "a/dist/a.lib"
else:
    file = t.adjust_names(["a/dist/a.dll"])[0]

t.write("b/jamfile.jam", """
lib b : b.cpp ../%s ;
""" % file)

t.write("b/b.cpp", """
#if defined(_WIN32)
__declspec(dllimport)
#endif
void a();
#if defined(_WIN32)
开发者ID:elemel,项目名称:boost-python,代码行数:31,代码来源:library_chain.py

示例7: g

    typedef void type;
};
typedef time_waster<true, 10, void>::type type;
int g() { return 0; }
""")

tester.write("jamroot.jam", """\
obj test2 : test2.cpp ;
obj test1 : test1.cpp : <dependency>test2 ;
install test2i : test2 : <dependency>test1 ;
""")

tester.run_build_system()
tester.expect_addition("bin/$toolset/debug*/test2.obj")
tester.expect_addition("bin/$toolset/debug*/test1.obj")
tester.expect_addition("test2i/test2.obj")
tester.expect_nothing_more()

test2src = tester.read("test2i/test2.obj")
test2dest = tester.read("bin/$toolset/debug*/test2.obj")
if test2src != test2dest:
    BoostBuild.annotation("failure", "The object file was not copied "
        "correctly")
    tester.fail_test(1)

tester.run_build_system(["-d1"])
tester.expect_output_lines("common.copy*", False)
tester.expect_nothing_more()

tester.cleanup()
开发者ID:DanielaE,项目名称:boost.build,代码行数:30,代码来源:copy_time.py

示例8: test_raw_nt

def test_raw_nt(n=None, error=False):
    t = BoostBuild.Tester(["-d1", "-d+4"], pass_d0=False, pass_toolset=0,
        use_test_config=False)

    cmd_prefix = "%s -c \"print('XXX: " % executable
    cmd_suffix = "')\""
    cmd_extra_length = len(cmd_prefix) + len(cmd_suffix)

    if n == None:
        n = cmd_extra_length

    data_length = n - cmd_extra_length
    if data_length < 0:
        BoostBuild.annotation("failure", """\
Can not construct Windows command of desired length. Requested command length
too short for the current test configuration.
    Requested command length: %d
    Minimal supported command length: %d
""" % (n, cmd_extra_length))
        t.fail_test(1, dump_difference=False)

    #   Each $(Xx10-1) variable contains X words of 9 characters each, which,
    # including spaces between words, brings the total number of characters in
    # its string representation to X * 10 - 1 (X * 9 characters + (X - 1)
    # spaces).
    t.write("file.jam", """\
ten = 0 1 2 3 4 5 6 7 8 9 ;

1x10-1 = 123456789 ;
10x10-1 = $(ten)12345678 ;
100x10-1 = $(ten)$(ten)1234567 ;
1000x10-1 = $(ten)$(ten)$(ten)123456 ;

actions do_echo
{
    %s%s%s
}
JAMSHELL = %% ;
do_echo all ;
""" % (cmd_prefix, string_of_length(data_length), cmd_suffix))
    if error:
        expected_status = 1
    else:
        expected_status = 0
    t.run_build_system(["-ffile.jam"], status=expected_status)
    if error:
        t.expect_output_lines("Executing raw command directly", False)
        t.expect_output_lines("do_echo action is too long (%d, max 32766):" % n
            )
        t.expect_output_lines("XXX: *", False)
    else:
        t.expect_output_lines("Executing raw command directly")
        t.expect_output_lines("do_echo action is too long*", False)

        m = re.search("^XXX: (.*)$", t.stdout(), re.MULTILINE)
        if not m:
            BoostBuild.annotation("failure", "Expected output line starting "
                "with 'XXX: ' not found.")
            t.fail_test(1, dump_difference=False)
        if len(m.group(1)) != data_length:
            BoostBuild.annotation("failure", """Unexpected output data length.
    Expected: %d
    Received: %d""" % (n, len(m.group(1))))
            t.fail_test(1, dump_difference=False)

    t.cleanup()
开发者ID:AlexMioMio,项目名称:boost,代码行数:66,代码来源:core_nt_cmd_line.py

示例9: __declspec

    "lib/test_lib.cpp",
    """
#ifdef _WIN32
__declspec(dllexport)
#endif
void foo() {}
""",
)

t.run_build_system(subdir="lib")
t.expect_addition("lib/bin/$toolset/debug/test_lib.dll")


# Auto adjusting of suffixes does not work, since we need to
# change dll to lib.
if ((os.name == "nt") or os.uname()[0].lower().startswith("cygwin")) and (BoostBuild.get_toolset() != "gcc"):
    t.copy("lib/bin/$toolset/debug/test_lib.implib", "lib/test_lib.implib")
    t.copy("lib/bin/$toolset/debug/test_lib.dll", "lib/test_lib.dll")
else:
    t.copy("lib/bin/$toolset/debug/test_lib.dll", "lib/test_lib.dll")


# Test that the simplest usage of searched library works.
t.write("jamroot.jam", "")

t.write(
    "jamfile.jam",
    """
import path ;
import project ;
开发者ID:ibrahim01832891988,项目名称:ssh-rd,代码行数:30,代码来源:searched_lib.py

示例10: test_basic

def test_basic():
    t = BoostBuild.Tester(pass_d0=False)
    __write_appender(t, "appender.jam")
    t.write("a.cpp", "")
    t.write("b.cxx", "")
    t.write("c.tui", "")
    t.write("d.wd", "")
    t.write("e.cpp", "")
    t.write("x.l", "")
    t.write("y.x_pro", "")
    t.write("z.cpp", "")
    t.write("lib/c.cpp", "int bar() { return 0; }\n")
    t.write("lib/jamfile.jam", "my-lib auxilliary : c.cpp ;")
    t.write("jamroot.jam",
r"""import appender ;

import "class" : new ;
import generators ;
import type ;


################################################################################
#
#   We use our own custom EXE, LIB & OBJ target generators as using the regular
# ones would force us to have to deal with different compiler/linker specific
# 'features' that really have nothing to do with this test. For example, IBM XL
# C/C++ for AIX, V12.1 (Version: 12.01.0000.0000) compiler exits with a non-zero
# exit code and thus fails our build when run with a source file using an
# unknown suffix like '.marked_cpp'.
#
################################################################################

type.register MY_EXE : my_exe ;
type.register MY_LIB : my_lib ;
type.register MY_OBJ : my_obj ;

appender.register compile-c : C : MY_OBJ ;
appender.register compile-cpp : CPP : MY_OBJ ;
appender.register link-lib composing : MY_OBJ : MY_LIB ;
appender.register link-exe composing : MY_OBJ MY_LIB : MY_EXE ;


################################################################################
#
# LEX --> C
#
################################################################################

type.register LEX : l ;

appender.register lex-to-c : LEX : C ;


################################################################################
#
#        /--> tUI_H --\
# tUI --<              >--> CPP
#        \------------/
#
################################################################################

type.register tUI : tui ;
type.register tUI_H : tui_h ;

appender.register ui-to-cpp : tUI tUI_H : CPP ;
appender.register ui-to-h : tUI : tUI_H ;


################################################################################
#
#          /--> X1 --\
# X_PRO --<           >--> CPP
#          \--> X2 --/
#
################################################################################

type.register X1 : x1 ;
type.register X2 : x2 ;
type.register X_PRO : x_pro ;

appender.register x1-x2-to-cpp : X1 X2 : CPP ;
appender.register x-pro-to-x1-x2 : X_PRO : X1 X2 ;


################################################################################
#
#   When the main target type is NM_EXE, build OBJ from CPP-MARKED and not from
# anything else, e.g. directly from CPP.
#
################################################################################

type.register CPP_MARKED : marked_cpp : CPP ;
type.register POSITIONS : positions ;
type.register NM.TARGET.CPP : target_cpp : CPP ;
type.register NM_EXE : : MY_EXE ;

appender.register marked-to-target-cpp : CPP_MARKED : NM.TARGET.CPP ;
appender.register cpp-to-marked-positions : CPP : CPP_MARKED POSITIONS ;

class nm::target::cpp-obj-generator : generator
#.........这里部分代码省略.........
开发者ID:AlexMioMio,项目名称:boost,代码行数:101,代码来源:generators_test.py

示例11: __declspec

t.write("lib/jamfile.jam", "lib test_lib : test_lib.cpp ;")
t.write("lib/test_lib.cpp", """
#ifdef _WIN32
__declspec(dllexport)
#endif
void foo() {}
""");

t.run_build_system(subdir="lib")
t.expect_addition("lib/bin/$toolset/debug/test_lib.dll")


# Auto adjusting of suffixes does not work, since we need to
# change dll to lib.
if ( ( os.name == "nt" ) or os.uname()[0].lower().startswith("cygwin") ) and \
    ( BoostBuild.get_toolset() != "gcc" ):
    t.copy("lib/bin/$toolset/debug/test_lib.implib", "lib/test_lib.implib")
    t.copy("lib/bin/$toolset/debug/test_lib.dll", "lib/test_lib.dll")
else:
    t.copy("lib/bin/$toolset/debug/test_lib.dll", "lib/test_lib.dll")


# Test that the simplest usage of searched library works.
t.write("jamroot.jam", "")

t.write("jamfile.jam", """
import path ;
import project ;

local here = [ project.attribute $(__name__) location ] ;
here = [ path.root $(here) [ path.pwd ] ] ;
开发者ID:CambrianTech,项目名称:boost-build,代码行数:31,代码来源:searched_lib.py

示例12: in

import BoostBuild
from BoostBuild import get_toolset

# clear environment for testing
#
for s in (
    'BOOST_ROOT','BOOST_BUILD_PATH','JAM_TOOLSET','BCCROOT',
    'MSVCDir','MSVC','MSVCNT','MINGW','watcom'
    ):
    
    try:
        del os.environ[s]
    except:
        pass

BoostBuild.set_defer_annotations(1)    

def run_tests(critical_tests, other_tests):
    """Runs first critical tests and then other_tests.

       Stops on first error, and write the name of failed test to
       test_results.txt. Critical tests are run in the specified order,
       other tests are run starting with the one that failed the last time.
    """
    last_failed = last_failed_test()
    other_tests = reorder_tests(other_tests, last_failed)
    all_tests = critical_tests + other_tests

    invocation_dir = os.getcwd()

    pass_count = 0
开发者ID:gorkinovich,项目名称:DefendersOfMankind,代码行数:31,代码来源:test_all.py

示例13: _info

def _info(*values):
    values = list(values) + [""]
    BoostBuild.annotation(tag, "\n".join(str(x) for x in values))
开发者ID:leloulight,项目名称:sugarlabcppboilerplate,代码行数:3,代码来源:collect_debug_info.py

示例14: __assertionFailure

 def __assertionFailure(self, message):
     BoostBuild.annotation("failure", "Internal test assertion failure "
         "- %s" % message)
     self.__tester.fail_test(1)
开发者ID:Kirija,项目名称:XPIR,代码行数:4,代码来源:configuration.py

示例15:

#ifdef ERROR
#error ERROR defined
#endif
#ifndef OK
#error ERROR not defined
#endif
''')

# Don't check the status immediately, so that we have a chance
# to print config.log.  Also, we need a minimum of d2 to make
# sure that we always see the commands and output.
t.run_build_system(['-sOBJECT_FILE=' + linker_input, '-d2'], status=None)

if t.status != 0:
    log_file = t.read('bin/config.log')
    BoostBuild.annotation("config.log", log_file)
    t.fail_test(True)

t.expect_output_lines(['    - has --illegal-flag-cpp   : no',
                       '    - has -DMACRO_CPP          : yes',
                       '    - has --illegal-flag-c     : no',
                       '    - has -DMACRO_C            : yes',
                       '    - has --illegal-flag-link  : no',
                       '    - has *bin*/input.* : yes'])
t.expect_addition('bin/$toolset/debug*/fail_cpp.obj')
t.expect_addition('bin/$toolset/debug*/pass_cpp.obj')
t.expect_addition('bin/$toolset/debug*/fail_c.obj')
t.expect_addition('bin/$toolset/debug*/pass_c.obj')
t.expect_addition('bin/$toolset/debug*/fail_link.obj')
t.expect_addition('bin/$toolset/debug*/pass_link.obj')
开发者ID:DanielaE,项目名称:boost.build,代码行数:30,代码来源:flags.py


注:本文中的BoostBuild类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。