Пример #1
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", """
Пример #2
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()
Пример #3
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()

Пример #4
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 ; 
Пример #5
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()
Пример #6
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()
Пример #7
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()
Пример #8
0
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", "")
Пример #9
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()

Пример #10
0
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()
Пример #11
0
    "$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
Пример #12
0
    "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
#  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()
Пример #14
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()
Пример #15
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()
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", "")
Пример #17
0
# 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 -d+2", status=None, stderr=None)
# Try to find the "zzz" string either in response file
# (for Windows compilers), or in standard output.
rsp = t.adjust_names("bin/$toolset/debug/main.exe.rsp")[0]
if os.path.exists(rsp) and string.find(open(rsp).read(), "zzz") != -1:
    pass
elif string.find(t.stdout(), "zzz") != -1:
    pass
else:
    t.fail_test(1)

#
# Test main -> libb -> liba chain
# in the case where liba is a file, not a Boost.Build target.
#
t.rm(".")
t.write("Jamroot", "")
t.write("a/Jamfile", """
lib a : a.cpp ;
""")
t.write("a/a.cpp", """
#if defined(_WIN32)
Пример #18
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()
Пример #19
0
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 -d+2", status=None, stderr=None)
# Try to find the "zzz" string either in response file
# (for Windows compilers), or in standard output.
rsp = t.adjust_names("bin/$toolset/debug/main.exe.rsp")[0]
if os.path.exists(rsp) and string.find(open(rsp).read(), "zzz") != -1:
    pass
elif string.find(t.stdout(), "zzz") != -1:
    pass
else:
    t.fail_test(1)

#
# Test main -> libb -> liba chain
# in the case where liba is a file, not a Boost.Build target.
#
t.rm(".")
t.write("Jamroot", "")
t.write("a/Jamfile", """
lib a : a.cpp ;
install dist : a ;
""")
t.write("a/a.cpp", """
Пример #20
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 ;
}
""")
Пример #21
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()

Пример #22
0
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"))

# Regression test: parent requirements were ignored in some cases
t.rm(".")
t.write("Jamroot", """ 
build-project src ; 
""")

t.write("src/Jamfile", """ 
project : requirements <define>EVERYTHING_OK ; 
""")

t.write("src/app/Jamfile", """ 
exe test : test.cpp ; 
""")
Пример #23
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()
Пример #24
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()
Пример #25
0
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")
Пример #26
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)
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()
Пример #28
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=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", """
Пример #29
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()

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 ; 
Пример #31
0
# 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 ;
make hello1.cpp : hello.cpp : common.copy ;

""")

t.write("dir/hello.cpp", """
int main()
{
    return 1;
}
""")
# Show only names of the actions.
t.run_build_system("-d1 -n")
t.fail_test(t.stdout().count("copy") != 1)

t.cleanup()
Пример #32
0
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", "")
Пример #33
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()
Пример #34
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()
Пример #35
0
# 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", """ 
import common ;
make hello1.cpp : hello.cpp : common.copy ;

""")

t.write("dir/hello.cpp", """
int main()
{
    return 1;
}
""")
t.run_build_system("-d2")
t.fail_test(t.stdout().count("common.copy") != 1)

t.cleanup()
Пример #36
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)
Пример #37
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
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()
Пример #39
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

Пример #40
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()
Пример #41
0
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()

Пример #42
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()
Пример #43
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"])
Пример #44
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()
Пример #45
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()
Пример #46
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"])