コード例 #1
0
#  all copies. This software is provided "as is" without express or implied
#  warranty, and with no claim as to its suitability for any purpose.

#  Tests that on gcc, we correctly report problem when static runtime
#  is requested when building DLL.
from BoostBuild import Tester, List
import string

t = Tester()

# Create the needed files
t.write("project-root.jam", "")
t.write("Jamfile", """
lib hello : hello.cpp ;
""")
t.write("hello.cpp", """
int main()
{
    return 0;
}
""")

t.run_build_system("runtime-link=static", status=1)
t.fail_test(string.find(t.stdout(),
                        "On gcc, DLL can't be build with '<runtime-link>static'") == -1)

t.run_build_system("link=static runtime-link=static")
t.expect_addition("bin/$toolset/debug/link-static/runtime-link-static/hello.lib")

t.cleanup()
コード例 #2
0
lib a : a.cpp ; 
""")

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


""")

t.write("b/Jamfile", """ 
lib b : b.cpp ../a//a ; 
""")

t.run_build_system("hardcode-dll-paths=true")

t.expect_addition("bin/$toolset/debug/mp.pathlist")

es1 = t.adjust_names(["a/bin/$toolset/debug"])[0]
es2 = t.adjust_names(["b/bin/$toolset/debug"])[0]
content = t.read("bin/$toolset/debug/mp.pathlist")

t.fail_test(find(content, es1) == -1)
t.fail_test(find(content, es2) == -1)

t.cleanup()
コード例 #3
0
t = Tester()

#  Regression test for double loading of the same Jamfile.
t.write("Jamfile", """ 
build-project subdir ; 
""")

t.write("project-root.jam", """ 
""")

t.write("subdir/Jamfile", """ 
ECHO "Loaded subdir" ; 
""")

t.run_build_system(subdir="subdir")
t.fail_test(string.count(t.stdout(), "Loaded subdir") != 1)

#  Regression test for a more contrived case. The top-level
#  jamfile refers to subdir via use-project, while subdir's
#  Jamfile is being loaded. The motivation why use-project
#  referring to subprojects are usefull can be found at
#  http://article.gmane.org/gmane.comp.lib.boost.build/3906/
t.write("Jamfile", """ 
use-project /subdir : subdir ; 
""")

t.write("project-root.jam", """ 
""")

t.write("subdir/Jamfile", """ 
project subdir ; 
コード例 #4
0
ファイル: build_no.py プロジェクト: jungikim/sbmt
#  Tests that <build>no property prevents a target from being built.
from BoostBuild import Tester, List
import string

# Create a temporary working directory
t = Tester()

# Create the needed files
t.write("Jamroot", """
exe hello : hello.cpp : <variant>debug:<build>no ;
""")
t.write("hello.cpp", """
int main()
{
    return 0;
}

""")

t.run_build_system()
t.expect_nothing_more()

t.fail_test(
    string.find(t.stdout(),
                "Skipping build of ./hello -- <build>no in properties.") == -1)

t.run_build_system("release")
t.expect_addition("bin/$toolset/release/hello.exe")

t.cleanup()
コード例 #5
0
    ; 
    
alias x : child//main ;    
""")

t.write("project-root.jam", """ 
""")

t.write("child/Jamfile", """ 
ECHO "Setting child requirements" ;
project /child ;

exe main : main.cpp ; 
""")

t.write("child/main.cpp", """ 
#if defined(PASS_THE_TEST)
int main() { return 0; }
#endif

""")

t.run_build_system()

t.expect_addition("child/bin/$toolset/debug/main.exe")
t.fail_test(find(t.stdout(), "Setting child requirements") <
            find(t.stdout(), "Setting parent requirements"))


t.cleanup()
コード例 #6
0
# Test the 'make' rule

from BoostBuild import Tester
from string import find

t = Tester(pass_toolset=0)

t.write("project-root.jam", "")
t.write(
    "Jamfile", """

rule creator ( string targets * : sources * : * )
{
    STRING on $(targets) = $(string) ;
    creator2 $(targets) : $(sources) ;
}

actions creator2
{
    echo $(STRING) > $(<)
}

make foo.bar : : creator foobar ;
""")

t.run_build_system()
t.expect_addition("bin/$toolset/debug/foo.bar")
t.fail_test(find(t.read("bin/$toolset/debug/foo.bar"), "foobar") == -1)

t.cleanup()
コード例 #7
0
ファイル: project_test4.py プロジェクト: Karlan88/xray
    "$toolset/debug/define-MACROS/include-everything\n" + "bin/$toolset/debug/a.obj\n",
)


t.copy("lib/Jamfile2", "lib/Jamfile")

expected = """error: Requirements for project at 'lib' conflict with parent's.
Explanation:  link-incompatible properties <threading>single and <threading>multi

"""
t.run_build_system("--no-error-backtrace", stdout=expected, status=None)

t.copy("lib/Jamfile3", "lib/Jamfile")

t.run_build_system(status=None)
t.fail_test(find(t.stdout(), "warning: skipped build of lib/b.obj with properties") != 0)

# Check that project can be skipped as well
t.copy("Jamfile4", "Jamfile")

expected = "warning: skipping build of project at lib2 due to unsatisfied requirements."
t.run_build_system("rtti=on")
t.fail_test(find(t.stdout(), expected) != 0)

t.copy("lib2/Jamfile2", "lib2/Jamfile")

expected = "warning: skipping build of project /mylib at lib2 due to unsatisfied\nrequirements."
t.run_build_system("rtti=on")
t.fail_test(find(t.stdout(), expected) != 0)

# We don't yet make targets depend on Jamfile, so need to start from scratch
コード例 #8
0
feature.feature test_feature : : free ;

import toolset ;
toolset.flags creator STRING : <test_feature> ;

actions creator
{
    echo $(STRING) > $(<)
}

make foo.bar : : creator : <test_feature>12345678 ;
""")

t.run_build_system()
t.expect_addition("bin/$toolset/debug/foo.bar")
t.fail_test(find(t.read("bin/$toolset/debug/foo.bar"), "12345678") == -1)

# Regression test. Make sure that if main target requested two times,
# and build request differ only in incidental properties, the main target
# if created only once. The bug was discovered by Kirill Lapshin.

t.write(
    "Jamroot", """ 
# Make sure that incidental property does not
# cause second creation of 'hello1.cpp'.
exe a : dir//hello1.cpp ;
exe b : dir//hello1.cpp/<hardcode-dll-paths>true ; 
""")

t.write("dir/Jamfile", """ 
import common ;
コード例 #9
0
ファイル: build_file.py プロジェクト: khongtuong/flyffsf
exe hello : hello.cpp ;
build-project sub ;
""")
t.write("hello.cpp", """
int main()
{
    return 0;
}
""")
t.write("sub/Jamfile", """
exe hello : hello.cpp ;
exe sub : hello.cpp ;
""")
t.write("sub/hello.cpp", """
int main()
{
    return 0;
}
""")


t.run_build_system(t.adjust_suffix("hello.obj"))

t.fail_test(find(t.stdout(), "depends on itself") != -1)
t.expect_addition("bin/$toolset/debug/hello.obj")
t.expect_addition("sub/bin/$toolset/debug/hello.obj")
t.expect_nothing_more()

# Remove temporary directories
t.cleanup()
コード例 #10
0
ファイル: dll_path.py プロジェクト: Albermg7/boost
lib a : a.cpp ; 
""")

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


""")

t.write("b/Jamfile", """ 
lib b : b.cpp ../a//a ; 
""")

t.run_build_system("hardcode-dll-paths=true")

t.expect_addition("bin/$toolset/debug/mp.pathlist")

es1 = t.adjust_names(["a/bin/$toolset/debug"])[0]
es2 = t.adjust_names(["b/bin/$toolset/debug"])[0]
content = t.read("bin/$toolset/debug/mp.pathlist")

t.fail_test(find(content, es1) == -1)
t.fail_test(find(content, es2) == -1)

t.cleanup()

コード例 #11
0
#!/usr/bin/python

#  Copyright (C) Vladimir Prus 2006.
#  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)

#  Test the 'libraries' example.
from BoostBuild import Tester, List
import os
import string

# Create a temporary working directory
t = Tester()

t.set_tree("../example/gettext")

t.run_build_system(stderr=None)

t.expect_addition(
    ["bin/$toolset/debug/main.exe", "bin/$toolset/debug/russian.mo"])

file = t.adjust_names(["bin/$toolset/debug/main.exe"])[0]

input_fd = os.popen(file)
input = input_fd.read()

t.fail_test(string.find(input, "international hello") != 0)

t.cleanup()
コード例 #12
0
ファイル: alternatives.py プロジェクト: jungikim/sbmt
    "Jamfile", """
exe a : a_empty.cpp : <variant>debug <define>FOO <include>BAR ;
exe a : a.cpp : <variant>release ;
""")

t.rm("bin/$toolset/release/a.exe")
t.run_build_system("release define=FOO")
t.expect_addition("bin/$toolset/release/a.exe")

# Test that abibuity is reported correctly
t.write("Jamfile", """
exe a : a_empty.cpp ;
exe a : a.cpp ;
""")
t.run_build_system("--no-error-backtrace", status=None)
t.fail_test(find(t.stdout(), "No best alternative") == -1)

# Another ambiguity test: two matches properties in one alternative are
# neither better nor worse than a single one in another alternative.
t.write(
    "Jamfile", """
exe a : a_empty.cpp : <optimization>off <profiling>off ;
exe a : a.cpp : <debug-symbols>on ;
""")

t.run_build_system("--no-error-backtrace", status=None)
t.fail_test(find(t.stdout(), "No best alternative") == -1)

# Test that we can have alternative without sources
t.write(
    "Jamfile", """
コード例 #13
0
ファイル: example_gettext.py プロジェクト: domz1/integrity
#  Copyright (C) Vladimir Prus 2006.
#  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)

#  Test the 'libraries' example.
from BoostBuild import Tester, List
import os
import string

# Create a temporary working directory
t = Tester()

t.set_tree("../example/gettext")

t.run_build_system(stderr=None)

t.expect_addition(["bin/$toolset/debug/main.exe",
                   "bin/$toolset/debug/russian.mo"])


file = t.adjust_names(["bin/$toolset/debug/main.exe"])[0]

input_fd = os.popen(file)
input = input_fd.read();

t.fail_test(string.find(input, "international hello") != 0)

t.cleanup()
コード例 #14
0
from BoostBuild import Tester, List
from string import find


t = Tester()

t.write("project-root.jam", "")
t.write("Jamfile", """
lib foo : foo.cpp ;
exe hello : hello.cpp ;
exe hello2 : hello.cpp : <library>foo ;
""")
t.write("hello.cpp", """
int main()
{
    return 0;
}

""")
t.write("foo.cpp", """
#ifdef _WIN32
__declspec(dllexport)
#endif
void foo() {}
""")

t.run_build_system("--no-error-backtrace", status=1)
t.fail_test(find(t.stdout(), "Duplicate name of actual target") == -1)

t.cleanup()
コード例 #15
0
#  all copies. This software is provided "as is" without express or implied
#  warranty, and with no claim as to its suitability for any purpose.

#  Tests that on gcc, we correctly report problem when static runtime
#  is requested when building DLL.
from BoostBuild import Tester, List
import string

t = Tester()

# Create the needed files
t.write("project-root.jam", "")
t.write("Jamfile", """
lib hello : hello.cpp ;
""")
t.write("hello.cpp", """
int main()
{
    return 0;
}
""")

t.run_build_system("link-runtime=static", status=1)
t.fail_test(string.find(t.stdout(),
                        "on gcc, DLL can't be build with <link-runtime>static") == -1)

t.run_build_system("link=static link-runtime=static")
t.expect_addition("bin/$toolset/debug/link-runtime-static/link-static/hello.lib")

t.cleanup()
コード例 #16
0
{
}

actions link
{
    yfc2-link
} 
""")

t.write("Jamfile", """ 
exe a : a.cpp ; 
""")

t.write("project-root.jam", """
using yfc1 ;
""")

t.run_build_system("-n -d2 yfc1")
t.fail_test(find(t.stdout(), "yfc1-link") == -1)

# Make sure we don't have to explicit 'use' yfc1.
t.write("project-root.jam", """
using yfc2 ;
""")

t.run_build_system("-n -d2 yfc2")
t.fail_test(find(t.stdout(), "yfc2-link") == -1)

t.cleanup()

コード例 #17
0
ファイル: library_order.py プロジェクト: kavoor/zen
t.write("project-root.jam", """ 
""")

t.run_build_system()
t.expect_addition("bin/$toolset/debug/main.exe")

# Test the order between searched libraries
t.write(
    "Jamfile", """
exe main : main.cpp png z ;
lib png : z : <name>png ;
lib z : : <name>zzz ;
""")

t.run_build_system("-a -n -d+2")
t.fail_test(string.find(t.stdout(), "png") > string.find(t.stdout(), "zzz"))

t.write(
    "Jamfile", """
exe main : main.cpp png z ;
lib png : : <name>png ;
lib z : png : <name>zzz ;
""")

t.run_build_system("-a -n -d+2")
t.fail_test(string.find(t.stdout(), "png") < string.find(t.stdout(), "zzz"))

# Test the order between prebuilt libraries

t.write("first.a", "")
t.write("second.a", "")
コード例 #18
0
actions valgrind
{
   valgrind $(>) 
}

""")

t.write(
    "hello.cpp", """

#include <iostream>

int main()
{
    std::cout << "Hello!\\n";
    return 1;
}

""")

t.run_build_system("-n -d+2")

t.fail_test(string.find(t.stdout(), "echo hi") == -1)

name = t.adjust_names(["bin/$toolset/debug/hello.exe"])[0]
name = apply(os.path.join, string.split(name, "/"))
c = "valgrind " + name
t.expect_output_line(c)

t.cleanup()
コード例 #19
0
{
}

actions link
{
    yfc2-link
} 
""")

t.write("Jamfile", """ 
exe a : a.cpp ; 
""")

t.write("project-root.jam", """
using yfc1 ;
""")

t.run_build_system("-n -d2 yfc1")
t.fail_test(find(t.stdout(), "yfc1-link") == -1)

# Make sure we don't have to explicit 'use' yfc1.
t.write("project-root.jam", """
using yfc2 ;
""")

t.run_build_system("-n -d2 yfc2")
t.fail_test(find(t.stdout(), "yfc2-link") == -1)

t.cleanup()

コード例 #20
0
    , workdir = os.getcwd()
    , pass_toolset=0
    )

jamfile="""
actions print_pwd { pwd ; }
print_pwd pwd ;
Always pwd ;
"""

t.write("Jamfile", jamfile)
t.write("project-root.jam", " ")

t.run_build_system(status=0, extra_args = "pwd")

if 'TMP' in os.environ:
  tmp_dir =os.environ.get('TMP')
else:
  tmp_dir ="/tmp"

if string.rfind(t.stdout(), tmp_dir) != -1:
    t.fail_test(1)

if string.rfind(t.stdout(), 'build/v2/test') == -1:
    t.fail_test(1)

t.run_build_system(status=1, extra_args = "pwd", subdir ="/must/fail/with/absolute/path",
                   stderr=None)
t.cleanup

コード例 #21
0
from BoostBuild import Tester, List
from string import find

# Create a temporary working directory
t = Tester()

# Create the needed files
t.write("project-root.jam", """
constant FOO : foobar gee ;
ECHO $(FOO) ;
""")
t.write("Jamfile", """
""")

t.run_build_system()
t.fail_test(find(t.stdout(), "foobar gee") == -1)

# Regression test: when absolute paths were passed to path-constant rule,
# Boost.Build failed to recognize path as absolute and prepended current dir.
t.write("project-root.jam", """
import path ;
local here = [ path.native [ path.pwd ] ] ;
path-constant HERE : $(here) ;
if $(HERE) != $(here) 
{
    ECHO "PWD           =" $(here) ;
    ECHO "path constant =" $(HERE) ;
    EXIT ;
}
""")
t.write("Jamfile", "")
コード例 #22
0
   valgrind $(>) 
}

""")

t.write("hello.cpp", """

#include <iostream>

int main()
{
    std::cout << "Hello!\\n";
    return 1;
}

""")


t.run_build_system("-n -d+2")

t.fail_test(string.find(t.stdout(), "echo hi") == -1)

name = t.adjust_names(["bin/$toolset/debug/hello.exe"])[0]
name = apply(os.path.join, string.split(name, "/"));
c = "valgrind " + name
t.fail_test(string.find(t.stdout(), c) == -1)


t.cleanup()

コード例 #23
0
""")

t.run_build_system(stderr=None)
t.expect_addition("bin/$toolset/debug/main.exe")
t.rm(["bin", "a/bin", "b/bin"])

t.run_build_system("link=static")
t.expect_addition("bin/$toolset/debug/link-static/main.exe")
t.rm(["bin", "a/bin", "b/bin"])

t.write("b/Jamfile", """ 
lib b : b.cpp ../a//a/<link>shared : <link>static ; 
""")

t.run_build_system()
t.expect_addition("bin/$toolset/debug/main.exe")
t.rm(["bin", "a/bin", "b/bin"])

# Test that putting library in sources of a searched library
# works.
t.write(
    "Jamfile", """
exe main : main.cpp png ;
lib png : z : <name>png ;
lib z : : <name>zzz ;
""")
t.run_build_system("-a -n -d+2")
t.fail_test(string.find(t.stdout(), "zzz") == -1)

t.cleanup()
コード例 #24
0
#  Tests that <build>no property prevents a target from being built.
from BoostBuild import Tester, List
import string


# Create a temporary working directory
t = Tester()

# Create the needed files
t.write("Jamroot", """
exe hello : hello.cpp : <variant>debug:<build>no ;
""")
t.write("hello.cpp", """
int main()
{
    return 0;
}

""")

t.run_build_system()
t.expect_nothing_more()

t.fail_test(string.find(t.stdout(), "Skipping build of ./hello -- <build>no in properties.") == -1)

t.run_build_system("release")
t.expect_addition("bin/$toolset/release/hello.exe")


t.cleanup()
コード例 #25
0
from BoostBuild import Tester, List
from string import find

# Create a temporary working directory
t = Tester()

# Create the needed files
t.write("project-root.jam", """
constant FOO : foobar gee ;
ECHO $(FOO) ;
""")
t.write("Jamfile", """
""")

t.run_build_system()
t.fail_test(find(t.stdout(), "foobar gee") == -1)

# Regression test: when absolute paths were passed to path-constant rule,
# Boost.Build failed to recognize path as absolute and prepended current dir.
t.write(
    "project-root.jam", """
import path ;
local here = [ path.native [ path.pwd ] ] ;
path-constant HERE : $(here) ;
if $(HERE) != $(here) 
{
    ECHO "PWD           =" $(here) ;
    ECHO "path constant =" $(HERE) ;
    EXIT ;
}
""")
コード例 #26
0
ファイル: dependency_property.py プロジェクト: kavoor/zen
from BoostBuild import Tester, List
from string import find

t = Tester()

t.write("project-root.jam", "")
t.write(
    "Jamfile", """
lib foo : foo.cpp ;
exe hello : hello.cpp ;
exe hello2 : hello.cpp : <library>foo ;
""")
t.write("hello.cpp", """
int main()
{
    return 0;
}

""")
t.write("foo.cpp", """
#ifdef _WIN32
__declspec(dllexport)
#endif
void foo() {}
""")

t.run_build_system("--no-error-backtrace", status=1)
t.fail_test(find(t.stdout(), "Duplicate name of actual target") == -1)

t.cleanup()
コード例 #27
0
ファイル: make_rule.py プロジェクト: NeoAnomaly/xray
# Test the 'make' rule

from BoostBuild import Tester
from string import find

t = Tester(pass_toolset=0)

t.write("project-root.jam", "")
t.write("Jamfile", """

rule creator ( string targets * : sources * : * )
{
    STRING on $(targets) = $(string) ;
    creator2 $(targets) : $(sources) ;
}

actions creator2
{
    echo $(STRING) > $(<)
}

make foo.bar : : creator foobar ;
""")

t.run_build_system()
t.expect_addition("bin/$toolset/debug/foo.bar")
t.fail_test(find(t.read("bin/$toolset/debug/foo.bar"), "foobar") == -1)


t.cleanup()
コード例 #28
0
t.write("a.cpp", "")

t.write("Jamfile", """
project a : requirements <runtime-link>static ;

static-lib a : a.cpp l ;
lib l : : <name>l_f ;
""")

t.run_build_system("-n")


# Make sure that plain "lib foobar ; " works.
t.write("Jamfile", """
exe a : a.cpp foobar ;
lib foobar ;
""")
t.run_build_system("-n -d2")
t.fail_test(string.find(t.stdout(), "foobar") == -1)

# Make sure that plain "lib foo bar ; " works.
t.write("Jamfile", """
exe a : a.cpp foo bar ;
lib foo bar ;
""")
t.run_build_system("-n -d2")
t.fail_test(string.find(t.stdout(), "foo") == -1)
t.fail_test(string.find(t.stdout(), "bar") == -1)

t.cleanup()
コード例 #29
0
#!/usr/bin/python

# Copyright 2004, 2006 Vladimir Prus 
# Distributed under the Boost Software License, Version 1.0. 
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 

from BoostBuild import Tester, List
import string

# Create a temporary working directory
t = Tester()

t.set_tree("boostbook")
# For some reason, the messages are sent to stderr.
t.run_build_system()
t.fail_test(string.find(t.stdout(), """Writing boost/A.html for refentry(boost.A)
Writing library/reference.html for section(library.reference)
Writing index.html for chapter(library)
Writing docs_HTML.manifest
""") == -1)
t.expect_addition(["html/boost/A.html", "html/index.html"])

t.cleanup()
コード例 #30
0
#  Tests that on gcc, we correctly report problem when static runtime
#  is requested when building DLL.
from BoostBuild import Tester, List
import string

t = Tester()

# Create the needed files
t.write("project-root.jam", "")
t.write("Jamfile", """
lib hello : hello.cpp ;
""")
t.write("hello.cpp", """
int main()
{
    return 0;
}
""")

t.run_build_system("runtime-link=static", status=1)
t.fail_test(
    string.find(t.stdout(),
                "on gcc, DLL can't be build with <runtime-link>static") == -1)

t.run_build_system("link=static runtime-link=static")
t.expect_addition(
    "bin/$toolset/debug/link-static/runtime-link-static/hello.lib")

t.cleanup()
コード例 #31
0
exe a : a_empty.cpp : <variant>debug <define>FOO <include>BAR ;
exe a : a.cpp : <variant>release ;
""")

t.rm("bin/$toolset/release/a.exe")
t.run_build_system("release define=FOO")
t.expect_addition("bin/$toolset/release/a.exe")

# Test that abibuity is reported correctly
t.write("Jamfile", """
exe a : a_empty.cpp ;
exe a : a.cpp ;
""")
t.run_build_system("--no-error-backtrace", status=1)
t.fail_test(
    find(t.stdout(), "because no best-matching alternative could be found") ==
    -1)

# Another ambiguity test: two matches properties in one alternative are
# neither better nor worse than a single one in another alternative.
t.write(
    "Jamfile", """
exe a : a_empty.cpp : <optimization>off <profiling>off ;
exe a : a.cpp : <debug-symbols>on ;
""")

t.run_build_system("--no-error-backtrace", status=1)
t.fail_test(
    find(t.stdout(), "because no best-matching alternative could be found") ==
    -1)
コード例 #32
0
#!/usr/bin/python

# Test that unused sources are at least reported.

from BoostBuild import Tester
from string import find
t = Tester()

t.write("a.h", """ 
""")

t.write("a.cpp", """ 
int main()
{
    return 0;
} 
""")

t.write("Jamfile", """ 
exe a : a.cpp a.h ; 
""")

t.write("project-root.jam", """ 
""")

t.run_build_system()
t.fail_test(find(t.stdout(), "warning: Unused source target { a.H }") == -1)

t.cleanup()

コード例 #33
0
ファイル: alternatives.py プロジェクト: Albermg7/boost
t.write("Jamfile", """
exe a : a_empty.cpp : <variant>debug <define>FOO <include>BAR ;
exe a : a.cpp : <variant>release ;
""")

t.rm("bin/$toolset/release/a.exe")
t.run_build_system("release define=FOO")
t.expect_addition("bin/$toolset/release/a.exe")

# Test that abibuity is reported correctly
t.write("Jamfile", """
exe a : a_empty.cpp ;
exe a : a.cpp ;
""")
t.run_build_system("--no-error-backtrace", status=1)
t.fail_test(find(t.stdout(), "because no best-matching alternative could be found") == -1)

# Another ambiguity test: two matches properties in one alternative are
# neither better nor worse than a single one in another alternative.
t.write("Jamfile", """
exe a : a_empty.cpp : <optimization>off <profiling>off ;
exe a : a.cpp : <debug-symbols>on ;
""")

t.run_build_system("--no-error-backtrace", status=1)
t.fail_test(find(t.stdout(), "because no best-matching alternative could be found") == -1)



# Test that we can have alternative without sources
t.write("Jamfile", """
コード例 #34
0
t.write("Jamfile", """
exe a : a_empty.cpp : <variant>debug <define>FOO <include>BAR ;
exe a : a.cpp : <variant>release ;
""")

t.rm("bin/$toolset/release/a.exe")
t.run_build_system("release define=FOO")
t.expect_addition("bin/$toolset/release/a.exe")

# Test that abibuity is reported correctly
t.write("Jamfile", """
exe a : a_empty.cpp ;
exe a : a.cpp ;
""")
t.run_build_system("--no-error-backtrace", status=None)
t.fail_test(find(t.stdout(), "No best alternative") == -1)

# Another ambiguity test: two matches properties in one alternative are
# neither better nor worse than a single one in another alternative.
t.write("Jamfile", """
exe a : a_empty.cpp : <optimization>off <profiling>off ;
exe a : a.cpp : <debug-symbols>on ;
""")

t.run_build_system("--no-error-backtrace", status=None)
t.fail_test(find(t.stdout(), "No best alternative") == -1)



# Test that we can have alternative without sources
t.write("Jamfile", """
コード例 #35
0
t = Tester()

#  Regression test for double loading of the same Jamfile.
t.write("Jamfile", """ 
build-project subdir ; 
""")

t.write("project-root.jam", """ 
""")

t.write("subdir/Jamfile", """ 
ECHO "Loaded subdir" ; 
""")

t.run_build_system(subdir="subdir")
t.fail_test(string.count(t.stdout(), "Loaded subdir") != 1)

#  Regression test for a more contrived case. The top-level
#  jamfile refers to subdir via use-project, while subdir's
#  Jamfile is being loaded. The motivation why use-project
#  referring to subprojects are usefull can be found at
#  http://article.gmane.org/gmane.comp.lib.boost.build/3906/
t.write("Jamfile", """ 
use-project /subdir : subdir ; 
""")

t.write("project-root.jam", """ 
""")

t.write("subdir/Jamfile", """ 
project subdir ; 
コード例 #36
0
t.write("a.cpp", "")

t.write(
    "Jamfile", """
project a : requirements <runtime-link>static ;

static-lib a : a.cpp l ;
lib l : : <name>l_f ;
""")

t.run_build_system("-n")

# Make sure that plain "lib foobar ; " works.
t.write("Jamfile", """
exe a : a.cpp foobar ;
lib foobar ;
""")
t.run_build_system("-n -d2")
t.fail_test(string.find(t.stdout(), "foobar") == -1)

# Make sure that plain "lib foo bar ; " works.
t.write("Jamfile", """
exe a : a.cpp foo bar ;
lib foo bar ;
""")
t.run_build_system("-n -d2")
t.fail_test(string.find(t.stdout(), "foo") == -1)
t.fail_test(string.find(t.stdout(), "bar") == -1)

t.cleanup()
コード例 #37
0
ファイル: library_order.py プロジェクト: Albermg7/boost
t.write("project-root.jam", """ 
""")

t.run_build_system()
t.expect_addition("bin/$toolset/debug/main.exe")

# Test the order between searched libraries
t.write("Jamfile", """
exe main : main.cpp png z ;
lib png : z : <name>png ;
lib z : : <name>zzz ;
""")

t.run_build_system("-a -n -d+2")
t.fail_test(string.find(t.stdout(), "png") > string.find(t.stdout(), "zzz"))

t.write("Jamfile", """
exe main : main.cpp png z ;
lib png : : <name>png ;
lib z : png : <name>zzz ;
""")

t.run_build_system("-a -n -d+2")
t.fail_test(string.find(t.stdout(), "png") < string.find(t.stdout(), "zzz"))

# Test the order between prebuilt libraries

t.write("first.a", "")
t.write("second.a", "")
コード例 #38
0
ファイル: make_rule.py プロジェクト: Albermg7/boost
{
    STRING on $(targets) = $(string) ;
    creator2 $(targets) : $(sources) ;
}

actions creator2
{
    echo $(STRING) > $(<)
}

make foo.bar : : creator foobar ;
""")

t.run_build_system()
t.expect_addition("bin/$toolset/debug/foo.bar")
t.fail_test(find(t.read("bin/$toolset/debug/foo.bar"), "foobar") == -1)

# Regression test. Make sure that if main target requested two times,
# and build request differ only in incidental properties, the main target
# if created only once. The bug was discovered by Kirill Lapshin.

t.write("Jamfile", """ 
# Make sure that incidental property does not
# cause second creation of 'hello1.cpp'.
exe a : dir//hello1.cpp ;
exe b : dir//hello1.cpp/<hardcode-dll-paths>true ; 
""")

t.write("project-root.jam", "")

t.write("dir/Jamfile", """ 
コード例 #39
0
t.write("Jamroot", """
exe hello : hello.cpp ;
build-project sub ;
""")
t.write("hello.cpp", """
int main()
{
    return 0;
}
""")
t.write("sub/Jamfile", """
exe hello : hello.cpp ;
exe sub : hello.cpp ;
""")
t.write("sub/hello.cpp", """
int main()
{
    return 0;
}
""")

t.run_build_system(t.adjust_suffix("hello.obj"))

t.fail_test(find(t.stdout(), "depends on itself") != -1)
t.expect_addition("bin/$toolset/debug/hello.obj")
t.expect_addition("sub/bin/$toolset/debug/hello.obj")
t.expect_nothing_more()

# Remove temporary directories
t.cleanup()
コード例 #40
0
t = Tester(executable="jam", workdir=os.getcwd(), pass_toolset=0)

jamfile = """
actions print_pwd { pwd ; }
print_pwd pwd ;
Always pwd ;
"""

t.write("Jamfile", jamfile)
t.write("project-root.jam", " ")

t.run_build_system(status=0, extra_args="pwd")

if 'TMP' in os.environ:
    tmp_dir = os.environ.get('TMP')
else:
    tmp_dir = "/tmp"

if string.rfind(t.stdout(), tmp_dir) != -1:
    t.fail_test(1)

if string.rfind(t.stdout(), 'build/v2/test') == -1:
    t.fail_test(1)

t.run_build_system(status=1,
                   extra_args="pwd",
                   subdir="/must/fail/with/absolute/path",
                   stderr=None)
t.cleanup
コード例 #41
0
    : build-dir build 
    ;
exe b : b.cpp ;    
""")

t.run_build_system()
t.expect_addition(["bin/$toolset/debug/a.exe",
                   "src/build/$toolset/debug/b.exe"])

# Now test the '--build-dir' option.
t.rm(".")
t.write("Jamroot", "")

# Test that we get an error when no project id is specified.
t.run_build_system("--build-dir=foo")
t.fail_test(string.find(t.stdout(),
                   "warning: the --build-dir option will be ignored") == -1)

t.write("Jamroot", """
project foo ;
exe a : a.cpp ;
build-project sub ;
""")
t.write("a.cpp", "int main() { return 0; }\n")
t.write("sub/Jamfile", "exe b : b.cpp ;\n")
t.write("sub/b.cpp", "int main() { return 0; }\n")

t.run_build_system("--build-dir=build")
t.expect_addition(["build/foo/$toolset/debug/a.exe",
                   "build/foo/sub/$toolset/debug/b.exe"])

t.write("Jamroot", """
コード例 #42
0
# Test that unused sources are at least reported.

from BoostBuild import Tester
from string import find
t = Tester()

t.set_tree("unused")

t.run_build_system()
# The second invocation should do nothing, and produce
# no warning. The previous invocation might have printed
# executed actions and other things, so it's not easy
# to check if warning was issued or not.
t.run_build_system()
t.fail_test(find(t.stdout(), "warning: Unused source { b.X } in main target ./a") == -1)

t.run_build_system("-sGENERATE_ONLY_UNUSABLE=1")
t.fail_test(find(t.stdout(), "warning: Unused source { b.X } in main target ./a") == -1)

# Now check that even if main target generates nothing, its
# usage requirements are still propagated to dependents.
t.write("a.cpp","""
#ifdef FOO
int main() {}
#endif
""")
t.run_build_system("-sGENERATE_NOTHING=1")

t.cleanup()
コード例 #43
0
    "bin/$toolset/debug/main-target-b.exe/b.exe",
    "$toolset/debug/define-MACROS/include-everything\n" +
    "bin/$toolset/debug/a.obj\n")

t.copy("lib/Jamfile2", "lib/Jamfile")

expected = """error: Requirements for project at 'lib' conflict with parent's.
Explanation:  link-incompatible properties <threading>single and <threading>multi

"""
t.run_build_system("--no-error-backtrace", stdout=expected, status=None)

t.copy("lib/Jamfile3", "lib/Jamfile")

t.run_build_system(status=None)
t.fail_test(find(t.stdout(), "warning: skipped build of lib/b.obj with properties") \
            != 0)

# Check that project can be skipped as well
t.copy("Jamfile4", "Jamfile")

expected = "warning: skipping build of project at lib2 due to unsatisfied requirements."
t.run_build_system("rtti=on")
t.fail_test(find(t.stdout(), expected) != 0)

t.copy("lib2/Jamfile2", "lib2/Jamfile")

expected = "warning: skipping build of project /mylib at lib2 due to unsatisfied\nrequirements."
t.run_build_system("rtti=on")
t.fail_test(find(t.stdout(), expected) != 0)

# We don't yet make targets depend on Jamfile, so need to start from scratch
コード例 #44
0
ファイル: tag.py プロジェクト: pftmclub/Elsword-Source-2014
variants = "debug release link=static,shared"

t.run_build_system(variants)
t.expect_addition(file_list)

t.run_build_system(variants + " clean")
t.expect_removal(file_list)

# Regression test: the 'tag' feature did not work in directories that
# had dot in names.
t.write("version-1.32.0/Jamroot", """
project test : requirements <tag>@$(__name__).tag ;

rule tag ( name : type ? : property-set )
{
   # Do nothing, just make sure the rule is invoked OK.
   ECHO "The tag rule was invoked" ;
}
exe a : a.cpp ;
""")

t.write("version-1.32.0/a.cpp", "int main() { return 0; }\n")

t.run_build_system(subdir="version-1.32.0")
t.expect_addition("version-1.32.0/bin/$toolset/debug/a.exe")
t.fail_test(string.find(t.stdout(), "The tag rule was invoked") == -1)

t.cleanup()

コード例 #45
0
t.run_build_system(stderr=None)
t.expect_addition("bin/$toolset/debug/main.exe")
t.rm(["bin", "a/bin", "b/bin"])

t.run_build_system("link=static")
t.expect_addition("bin/$toolset/debug/link-static/main.exe")
t.rm(["bin", "a/bin", "b/bin"])

t.write("b/Jamfile", """ 
lib b : b.cpp ../a//a/<link>shared : <link>static ; 
""")

t.run_build_system()
t.expect_addition("bin/$toolset/debug/main.exe")
t.rm(["bin", "a/bin", "b/bin"])

# Test that putting library in sources of a searched library
# works.
t.write("Jamfile", """
exe main : main.cpp png ;
lib png : z : <name>png ;
lib z : : <name>zzz ;
""")
t.run_build_system("-a -n -d+2")
t.fail_test(string.find(t.stdout(), "zzz") == -1)



t.cleanup()
コード例 #46
0
    ;
exe b : b.cpp ;    
""")

t.run_build_system()
t.expect_addition(
    ["bin/$toolset/debug/a.exe", "src/build/$toolset/debug/b.exe"])

# Now test the '--build-dir' option.
t.rm(".")
t.write("Jamroot", "")

# Test that we get an error when no project id is specified.
t.run_build_system("--build-dir=foo")
t.fail_test(
    string.find(t.stdout(), "warning: the --build-dir option will be ignored")
    == -1)

t.write("Jamroot", """
project foo ;
exe a : a.cpp ;
build-project sub ;
""")
t.write("a.cpp", "int main() { return 0; }\n")
t.write("sub/Jamfile", "exe b : b.cpp ;\n")
t.write("sub/b.cpp", "int main() { return 0; }\n")

t.run_build_system("--build-dir=build")
t.expect_addition(
    ["build/foo/$toolset/debug/a.exe", "build/foo/sub/$toolset/debug/b.exe"])
コード例 #47
0
ファイル: loop.py プロジェクト: kavoor/zen
#!/usr/bin/python

# Copyright 2003 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

from BoostBuild import Tester, List
from string import find

t = Tester()

t.write("project-root.jam", "")
t.write("Jamfile", """ 

lib main : main.cpp l ;
lib l : l.cpp main ; 
""")

t.write("main.cpp", "")
t.write("l.cpp", "")

t.run_build_system("--no-error-backtrace", status=1)
t.fail_test(
    find(t.stdout(), "error: Recursion in main target references") == -1)
t.fail_test(find(t.stdout(), "./main ./l ./main") == -1)

t.cleanup()
コード例 #48
0
#!/usr/bin/python

#  Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and
#  distribute this software is granted provided this copyright notice appears in
#  all copies. This software is provided "as is" without express or implied
#  warranty, and with no claim as to its suitability for any purpose.

from BoostBuild import Tester, List
from string import find

t = Tester()


t.write("project-root.jam", "")
t.write("Jamfile", """ 

lib main : main.cpp l ;
lib l : l.cpp main ; 
""")

t.write("main.cpp", "")
t.write("l.cpp", "")

t.run_build_system("--no-error-backtrace", status=1)
t.fail_test(find(t.stdout(), "error: Recursion in main target references") == -1)
t.fail_test(find(t.stdout(), "./main ./l ./main") == -1)

t.cleanup()
コード例 #49
0
#!/usr/bin/python

# Copyright 2004, 2006 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

from BoostBuild import Tester, List
import string

# Create a temporary working directory
t = Tester()

t.set_tree("boostbook")
# For some reason, the messages are sent to stderr.
t.run_build_system()
t.fail_test(
    string.find(
        t.stdout(), """Writing boost/A.html for refentry(boost.A)
Writing library/reference.html for section(library.reference)
Writing index.html for chapter(library)
Writing docs_HTML.manifest
""") == -1)
t.expect_addition(["html/boost/A.html", "html/index.html"])

t.cleanup()