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

#  Test that conditional properties work, even if property is free, and
#  value includes colon.
from BoostBuild import Tester, List


t = Tester()

# Create the needed files
t.write("project-root.jam", "")
t.write("Jamfile", """
exe hello : hello.cpp : <variant>debug:<define>CLASS=Foo::Bar ;
""")
t.write("hello.cpp", """
namespace Foo { class Bar { } ; }
int main()
{
    CLASS c;
    return 0;
}

""")

# Don't check stderr, which can include warning about unused 'c'.
t.run_build_system(stdout=None, stderr=None)
t.expect_addition("bin/$toolset/debug/hello.exe")

t.cleanup()
Ejemplo n.º 2
0
#!/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) 

# 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
Ejemplo n.º 3
0
#!/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)

#  Test that composite properties are handled correctly.
from BoostBuild import Tester, List

t = Tester()

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

""")

t.run_build_system()

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

t.cleanup()
Ejemplo n.º 4
0
#include <a.h>
void
# ifdef _WIN32
__declspec(dllexport)
# endif 
foo() {}
""")
t.write("a.h", "//empty file\n")

t.write("d/Jamfile", "exe b : b.cpp ..//a ; ")
t.write("d/b.cpp", """
    void foo();
    int main() { foo(); }
""")

t.run_build_system(subdir="d")

# Now test the path features with condition work as well
t.write("Jamfile", "lib a : a.cpp : <variant>debug:<include>.  ;")
t.rm("bin")
t.run_build_system(subdir="d")

# Test path features with condtion in usage requirements
t.write("Jamfile",
        "lib a : a.cpp : <include>. : : <variant>debug:<include>. ;")
t.write("d/b.cpp", """
#include <a.h>
void foo();
int main() { foo(); }
""")
t.rm("d/bin")
Ejemplo n.º 5
0
t = Tester()
t.write("a.cpp", """ 
int main() {} 
""")

t.write("b.cpp", """ 
int main() {} 
""")

t.write("c.cpp", """ 
int main() {} 
""")

t.write("Jamfile", """ 
import feature : feature ;

feature foo : 1 2 : link-incompatible ;

exe a : a.cpp : <foo>1 ;
exe b : b.cpp : <foo>2 ;
exe c : c.cpp ; 
""")

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

t.run_build_system("foo=1")

t.cleanup()

Ejemplo n.º 6
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.

#  Test that we can access project-root attributes from Jamfiles.
from BoostBuild import Tester, List

# Create a temporary working directory
t = Tester()

t.write("Jamfile", """
local l = [ project-root get-location ] ;
ECHO XXX $(l) ;
""")

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

t.run_build_system(stdout="XXX .\n")

t.cleanup()
Ejemplo n.º 7
0
#!/usr/bin/python

# Test that default build clause actually has any effect.

from BoostBuild import Tester, List

t = Tester()

t.write("project-root.jam", "import gcc ;")
t.write("Jamfile", "exe a : a.cpp : : debug release ;")
t.write("a.cpp", "int main() { return 0; }\n")

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

# Check that explictly-specified build variant supresses
# default-build
t.rm("bin")
t.run_build_system("release")
t.expect_addition(List("bin/$toolset/release/") * "a.exe a.obj")
t.expect_nothing_more()

# Now check that we can specify explicit build request and
# default-build will be combined with it
t.run_build_system("optimization=space")
t.expect_addition("bin/$toolset/debug/optimization-space/a.exe")
t.expect_addition("bin/$toolset/release/optimization-space/a.exe")

# Test that default-build must be identical in all alternatives. Error case.
t.write(
Ejemplo n.º 8
0
#!/usr/bin/python
# Tests that we can use objects from other projects
# (i.e. with other project root)
# Test also that we can refer to those target using project-id.

from BoostBuild import Tester, List

t = Tester()
t.set_tree("test1")

t.run_build_system("-sTOOLSET=yfc", subdir="p1")

t.expect_addition("p1/bin/a.obj/yfc/debug/runtime-link-dynamic/a.obj")
t.expect_addition("p1/auxillary/bin/b.obj/yfc/debug/runtime-link-dynamic/optimization-space/b.obj")
t.expect_addition("p2/bin/c.obj/yfc/debug/runtime-link-dynamic/c.obj")
t.expect_addition("bin/a/yfc/debug/runtime-link-dynamic/a")
t.expect_nothing_more()

t.fail(t.read("p1/bin/a.obj/yfc/debug/runtime-link-dynamic/a.obj") !=\
"""
<optimization>off <rtti>on <runtime-link>dynamic <toolset>yfc <variant>debug
a.cpp
""")

t.fail(t.read("p1/auxillary/bin/b.obj/yfc/debug/runtime-link-dynamic/b.obj") !=\
"""
<optimization>space <rtti>on <runtime-link>dynamic <toolset>yfc <variant>debug
b.cpp
""")

t.fail(t.read("p2/bin/c.obj/yfc/debug/runtime-link-dynamic/c.obj") !=\
Ejemplo n.º 9
0
from BoostBuild import Tester, List
import os
from string import strip

t = Tester()

# Arrange a project which will build only if
# 'a.cpp' is compiled with "STATIC" define.
t.write("project-root.jam", "import gcc ;")
t.write("a.cpp", """
#ifdef STATIC
int main() {  return 0; }
#endif
""")
t.write("Jamfile", "exe a : a.cpp : <link>static:<define>STATIC ;")
t.run_build_system("link=static")
t.expect_addition("bin/$toolset/debug/link-static/a.exe")

t.write("Jamfile", """
project : requirements <link>static:<define>STATIC ;
exe a : a.cpp ;
""")
t.rm("bin")
t.run_build_system("link=static")
t.expect_addition("bin/$toolset/debug/link-static/a.exe")

# Regression test for a bug found by Ali Azarbayejani.
# Conditionals inside usage requirement were not evaluated.
# This breaks 

t.write("Jamfile", """
Ejemplo n.º 10
0
    "b/b.cpp", """ 
void geek();

void 
#if defined(_WIN32)
__declspec(dllexport)
#endif
foo() { geek(); }

""")

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

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"])

# Check that <library> works for static linking.

t.write("b/Jamfile", """ 
lib b : b.cpp : <library>../a//a ; 
""")
t.run_build_system("link=static")
t.expect_addition("bin/$toolset/debug/link-static/main.exe")
Ejemplo n.º 11
0
t.write(
    "a.cpp",
"""
#ifdef FOO
void
# if defined(_WIN32) && defined(SHARED_B)
__declspec(dllexport)
# endif
foo() {}
#endif

int main() { foo(); }
""")

t.run_build_system()

t.run_build_system("--clean")

# Test that use requirements on main target work, when they are referred using
# 'dependency' features.
t.write("project-root.jam", "import gcc ;")

t.write(
    "Jamfile", 
"""
    lib b : b.cpp : <link>shared:<define>SHARED_B
    : : <define>FOO <link>shared:<define>SHARED_B
    ;
    exe a : a.cpp : <use>b ;
""")
Ejemplo n.º 12
0
t.write("d2/d/Jamfile", """ 
lib l : [ glob *.cpp ] ; 
""")

t.write("d3/d/Jamfile", """
exe a : [ glob ../*.cpp ] ;
""")
t.write("d3/a.cpp", """
int main()
{
    return 0;
}
""")

t.run_build_system(subdir="d1")
t.expect_addition("d1/bin/$toolset/debug/a.exe")

t.run_build_system(subdir="d3/d")
t.expect_addition("d3/d/bin/$toolset/debug/a.exe")

t.rm("d2/d/bin")
t.run_build_system(subdir="d2/d")
t.expect_addition("d2/d/bin/$toolset/debug/l.dll")

# Test that when 'source-location' is explicitly-specified
# glob works relatively to source location
t.rm("d1")

t.write("d1/src/a.cpp", """ 
int main() { return 0; }
Ejemplo n.º 13
0
# Test main target alternatives.

from BoostBuild import Tester
t = Tester()

# Test that basic alternatives selection works.
t.write("project-root.jam", " ")
t.write("Jamfile", """

exe a : a_empty.cpp ;
exe a : a.cpp : <variant>release ;
""")
t.write("a_empty.cpp", "")
t.write("a.cpp", "int main() { return 0; }\n")

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

# Test that everything works ok even with default
# build.

t.write(
    "Jamfile", """

exe a : a_empty.cpp : <variant>release ;
exe a : a.cpp : <variant>debug ;
""")

t.run_build_system(pass_toolset=0)
t.expect_addition("bin/$toolset/debug/a.exe")
#!/usr/bin/python

# Test usage of searched-libs: one which are found via -l
# switch to the linker/compiler.

from BoostBuild import Tester
import string
t = Tester()

# To start with, we have to prepate a library to link with
t.write("lib/project-root.jam", "import gcc ; ")
t.write("lib/Jamfile", "lib test_lib : test_lib.cpp ;")
t.write("lib/test_lib.cpp", "void foo() {}\n")

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

t.copy("lib/bin/$toolset/debug/test_lib.dll", "lib/libtest_lib.dll")

# A regression test: <library>property referring to
# searched-lib was mishandled. As the result, we were
# putting target name to the command line!
# Note that
#    g++ ...... <.>z
# works nicely in some cases, sending output from compiler
# to file 'z'.
# This problem shows up when searched libs are in usage
# requirements.

t.write('project-root.jam', 'import gcc ;')
t.write('Jamfile', 'exe main : main.cpp d/d2/a ;')
#!/usr/bin/python

from BoostBuild import Tester, List
import os
from string import strip

t = Tester()

# First check some startup
t.set_tree("direct-request-test")
t.run_build_system(extra_args="define=MACROS")

t.expect_addition("bin/$toolset/debug/" * (List("a.o b.o b.dll a.exe")))

# Regression test: direct build request was not working
# when there's more than one level of 'build-project'

t.rm(".")
t.write('project-root.jam', '')
t.write('Jamfile', 'build-project a ;')
t.write('a/Jamfile', 'build-project b ;')
t.write('a/b/Jamfile', '')

t.run_build_system("release")

t.cleanup()
Ejemplo n.º 16
0
from BoostBuild import Tester, List
import os
from string import strip
import re


def match_re(actual, expected):
    return re.match(expected, actual, re.DOTALL) != None


t = Tester(match=match_re)

t.set_tree('testing-primitives')

# We expect t5 and t7's output to be dumped to stdout
t.run_build_system(stdout=r'''.*failing t5.*failing t7''')

t.expect_addition('t2.txt')
t.expect_addition('t3.txt')

t.expect_addition('t5.out')

t.expect_addition('t6.out')
t.expect_addition('t6.txt')

t.expect_addition('t7.out')
t.expect_addition('t7.txt')

t.expect_addition('t8.out')

t.expect_nothing_more()
Ejemplo n.º 17
0
#!/usr/bin/python

# Test that default build clause actually has any effect.

from BoostBuild import Tester, List
t = Tester()

t.write("project-root.jam", "import gcc ;")
t.write("Jamfile", "exe a : a.cpp : : debug release ;")
t.write("a.cpp", "int main() { return 0; }\n")

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

# Check that explictly-specified build variant supresses
# default-build
t.rm("bin")
t.run_build_system("release")
t.expect_addition(List("bin/$toolset/release/") * "a.exe a.obj")
t.expect_nothing_more()

# Now check that we can specify explicit build request and
# default-build will be combined with it
t.run_build_system("optimization=space")
t.expect_addition("bin/$toolset/debug/optimization-space/a.exe")
t.expect_addition("bin/$toolset/release/optimization-space/a.exe")

# Test that default-build must be identical in all alternatives. Error case.
t.write("Jamfile", """
exe a : a.cpp : : debug ;
Ejemplo n.º 18
0
#!/usr/bin/python

# Copyright 2002 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) 

# Test that we cannot specify targets of unknown type as sources.
# This is based on the fact that Unix 'ar' will happily consume
# just about anything.

from BoostBuild import Tester
t = Tester()

t.write("project-root.jam", "import gcc ;")
t.write("Jamfile", """
static-lib a : a.foo ;
""")
t.write("a.foo", "")

t.run_build_system(status=1)

t.cleanup()
Ejemplo n.º 19
0
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)

# 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", "")
Ejemplo n.º 20
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", """ 
Ejemplo n.º 21
0
import re

def match_re(actual,expected):
    return re.match(expected,actual,re.DOTALL) != None

# Test the v1 startup behavior
t = Tester(
    match= match_re
    , boost_build_path=''
    , pass_toolset=0
    )

t.set_tree('startup')

t.run_build_system(
    status=1, stdout=r'''Unable to load Boost\.Build: could not find "boost-build.jam"
.*Attempted search from .* up to the root''', match = match_re)

os.chdir('no-bootstrap1')

t.run_build_system(
    status=1
    , stdout=r'''Unable to load Boost\.Build: could not find build system\.'''
    + r'''.*attempted to load the build system by invoking'''
    + r'''.*'boost-build ;'.*'''
    + r'''but we were unable to find "bootstrap\.jam"'''
    )

# Descend to a subdirectory which /doesn't/ contain a boost-build.jam
# file, and try again to test the crawl-up behavior.
os.chdir('subdir')
Ejemplo n.º 22
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()
Ejemplo n.º 23
0
#!/usr/bin/python

# Tests that 'make' accepts target from other directories and that
# build request for those targets can be overriden.

from BoostBuild import Tester, List

t = Tester()
t.set_tree("test1")

t.run_build_system("-sTOOLSET=yfc")

t.expect_addition("bin/a.obj/yfc/debug/runtime-link-dynamic/a.obj")
t.expect_addition("auxillary/bin/b.obj/yfc/debug/runtime-link-dynamic/optimization-space/b.obj")
t.expect_addition("bin/a/yfc/debug/runtime-link-dynamic/a")
t.expect_nothing_more()

t.fail(t.read("bin/a.obj/yfc/debug/runtime-link-dynamic/a.obj") !=\
"""
<optimization>off <rtti>on <runtime-link>dynamic <toolset>yfc <variant>debug
a.cpp
""")

t.fail(t.read("auxillary/bin/b.obj/yfc/debug/runtime-link-dynamic/b.obj") !=\
"""
<optimization>space <rtti>on <runtime-link>dynamic <toolset>yfc <variant>debug
b.cpp
""")


t.fail(t.read("bin/a/yfc/debug/runtime-link-dynamic/a") !=\
Ejemplo n.º 24
0
# Test staging

from BoostBuild import Tester

t = Tester()

t.write("project-root.jam", "import gcc ;")
t.write("Jamfile", """
lib a : a.cpp ;
stage dist : a a.h auxilliary/1 ;
""")
t.write("a.cpp", "")
t.write("a.h", "")
t.write("auxilliary/1", "")

t.run_build_system()
t.expect_addition(["dist/a.dll", "dist/a.h", "dist/1"])

# Test the <location> property
t.write(
    "Jamfile", """
lib a : a.cpp ;
stage dist : a 
    : <variant>debug:<location>ds <variant>release:<location>rs
    ;
""")

t.run_build_system()
t.expect_addition("ds/a.dll")

t.run_build_system("release")
Ejemplo n.º 25
0
#!/usr/bin/python

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

# Create a temporary working directory
t = Tester()

t.set_tree("boostbook")
# For some reason, the messages are sent to stderr.
t.run_build_system(stderr="""Writing A.html for refentry(A)
Writing library/reference.html for section(library.reference)
Writing index.html for chapter(library)
Writing HTML.manifest
""")
t.expect_addition(["html/A.html", "html/index.html"])

t.cleanup()
Ejemplo n.º 26
0
""")

t.write(
    "a.cpp",
"""
int
#ifdef _WIN32
__declspec(dllexport)
#endif
must_export_something;
""")

t.write("a.h", "")
t.write("auxilliary/1", "")

t.run_build_system()
t.expect_addition(["dist/a.dll", "dist/a.h", "dist/1"])


# Regression test: the following was causing the "duplicate target name"
# error.
t.write(
    "Jamfile", 
"""
project : requirements <hardcode-dll-paths>true ;
lib a : a.cpp ;
stage dist : a a.h auxilliary/1 ;
alias dist-alias : dist ;
""")
t.run_build_system()
Ejemplo n.º 27
0
#!/usr/bin/python

from BoostBuild import Tester, List
import os
from string import strip

t = Tester()

# First check some startup
t.set_tree("direct-request-test")
t.run_build_system(extra_args="define=MACROS")

t.expect_addition("bin/$toolset/debug/" 
                  * (List("a.o b.o b.dll a.exe")))
		  
# Regression test: direct build request was not working
# when there's more than one level of 'build-project'

t.rm(".")
t.write('project-root.jam', '')
t.write('Jamfile', 'build-project a ;')
t.write('a/Jamfile', 'build-project b ;')
t.write('a/b/Jamfile', '')

t.run_build_system("release")		  


t.cleanup()
Ejemplo n.º 28
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
Ejemplo n.º 29
0
from BoostBuild import Tester, get_toolset
import string
import os
t = Tester()

# To start with, we have to prepate a library to link with
t.write("lib/project-root.jam", "")
t.write("lib/Jamfile", "lib libtest_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/libtest_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 get_toolset() != 'gcc':
    t.copy("lib/bin/$toolset/debug/libtest_lib.lib", "lib/test_lib.lib")
else:
    t.copy("lib/bin/$toolset/debug/libtest_lib.dll", "lib/libtest_lib.dll")


# Test that the simplest usage of searched library works.
t.write('project-root.jam', '')
t.write('Jamfile', """
Ejemplo n.º 30
0
#!/usr/bin/python

from BoostBuild import Tester, List
import os

t = Tester()

t.set_tree("generators-test")
t.run_build_system()

t.expect_addition(
    "bin/$toolset/debug/"
    * (
    List(   
       "a.obj b.obj c.h c.cpp c.obj d_parser.whl d_lexer.dlp d_parser.cpp d_lexer.cpp "
        + "d_parser.lr0 d_parser.h d_parser_symbols.h x.c x.obj y.x1 y.x2 "
        + "y.cpp y.obj e.marked_cpp e.positions e.target_cpp e.obj "))
    )
ok = 0

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

t.expect_addition(["lib/bin/$toolset/debug/c.obj",
                   "lib/bin/$toolset/debug/auxilliary.lib",
                   ])


t.run_build_system(subdir='lib')

t.expect_addition(["lib/bin/$toolset/debug/auxilliary2.dll"])
Ejemplo n.º 31
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.

#  Test that we can access project-root attributes from Jamfiles.
from BoostBuild import Tester, List

# Create a temporary working directory
t = Tester()

t.write("Jamfile", """
local l = [ project-root get-location ] ;
ECHO XXX $(l) ;
""")

t.write("project-root.jam", "")
        
t.run_build_system(stdout="XXX .\n")

t.cleanup()
Ejemplo n.º 32
0
List("bin/$toolset/debug/a_ds.exe") + \
List("bin/$toolset/debug/b_ds.dll") + \
List("c/a_ds.exe") + \
List("bin/$toolset/release/a_rs.exe") + \
List("bin/$toolset/release/b_rs.dll") + \
List("c/a_rs.exe") + \
List("bin/$toolset/debug/link-static/a_dt.exe") + \
List("bin/$toolset/debug/link-static/b_dt.lib") + \
List("c/a_dt.exe") + \
List("bin/$toolset/release/link-static/a_rt.exe") + \
List("bin/$toolset/release/link-static/b_rt.lib") + \
List("c/a_rt.exe")

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" ;
}
Ejemplo n.º 33
0
t.write("project-root.jam", "import gcc ; ")
t.write(
    "Jamfile", """
project
    : build-dir build
    ;
    
exe a : a.cpp ;
build-project src ;    
""")
t.write("a.cpp", "int main() { return 0; }\n")

t.write("src/Jamfile", "exe b : b.cpp ; ")
t.write("src/b.cpp", "int main() { return 0; }\n")

t.run_build_system()

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

# Test that building from child projects work
t.run_build_system(subdir='src')
t.expect_nothing_more()

# Test that project can override build dir
t.write("Jamfile", """
exe a : a.cpp ;
build-project src ;
""")

t.write("src/Jamfile", """
Ejemplo n.º 34
0
#!/usr/bin/python

from BoostBuild import Tester, List
import os
from string import strip

t = Tester(translate_suffixes=0)

# First check some startup
t.set_tree("project-test3")
os.remove("project-root.jam")
t.run_build_system(status=1,
                   stdout="""error: Could not find parent for project at '.'
error: Did not find Jamfile or project-root.jam in any parent directory.

""")

t.set_tree("project-test3")
t.run_build_system()

t.expect_addition("bin/$toolset/debug/a.obj")
t.expect_content("bin/$toolset/debug/a.obj", """$toolset/debug
a.cpp
""")

t.expect_addition("bin/$toolset/debug/a.exe")
t.expect_content(
    "bin/$toolset/debug/a.exe", "$toolset/debug\n" +
    "bin/$toolset/debug/a.obj lib/bin/$toolset/debug/b.obj " +
    "lib2/bin/$toolset/debug/c.obj lib2/bin/$toolset/debug/d.obj " +
    "lib2/helper/bin/$toolset/debug/e.obj " +
Ejemplo n.º 35
0
#!/usr/bin/python

from BoostBuild import Tester, List
import os
from string import strip

t = Tester(translate_suffixes=0)

# First check some startup
t.set_tree("project-test3")
os.remove("project-root.jam")
t.run_build_system(
    status=1,
    stdout="""Failed to find the project root for directory '.'.
Did not find a project-root.jam file there or in any of its parent directories.
Please consult the documentation at 'http://www.boost.org'.
""",
)

t.set_tree("project-test3")
t.run_build_system()

t.expect_addition("bin/$toolset/debug/a.obj")
t.expect_content(
    "bin/$toolset/debug/a.obj",
    """$toolset/debug
a.cpp
""",
)

t.expect_addition("bin/$toolset/debug/a.exe")
Ejemplo n.º 36
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()

Ejemplo n.º 37
0
from BoostBuild import Tester, List
import os
from string import strip

t = Tester()

# Arrange a project which will build only if
# 'a.cpp' is compiled with "STATIC" define.
t.write("project-root.jam", "import gcc ;")
t.write("a.cpp", """
#ifdef STATIC
int main() {  return 0; }
#endif
""")
t.write("Jamfile", "exe a : a.cpp : <link>static:<define>STATIC ;")
t.run_build_system("link=static")
t.expect_addition("bin/$toolset/debug/link-static/a.exe")

t.write(
    "Jamfile", """
project : requirements <link>static:<define>STATIC ;
exe a : a.cpp ;
""")
t.rm("bin")
t.run_build_system("link=static")
t.expect_addition("bin/$toolset/debug/link-static/a.exe")

# Regression test for a bug found by Ali Azarbayejani.
# Conditionals inside usage requirement were not evaluated.
# This breaks
Ejemplo n.º 38
0
t.write("project-root.jam", "import gcc ; ")
t.write(
    "Jamfile", """
project
    : build-dir build
    ;
    
exe a : a.cpp ;
build-project src ;    
""")
t.write("a.cpp", "int main() { return 0; }\n")

t.write("src/Jamfile", "exe b : b.cpp ; ")
t.write("src/b.cpp", "int main() { return 0; }\n")

t.run_build_system()

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

# Test that building from child projects work
t.run_build_system(subdir='src')
t.expect_nothing_more()

# Test that project can override build dir
t.write("Jamfile", """
exe a : a.cpp ;
build-project src ;
""")

t.write("src/Jamfile", """
Ejemplo n.º 39
0
from BoostBuild import Tester
import os, string

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",
'/boost-build-test-project-1/dir':

* Project root: %(root-dir)s
* Parent project: %(root-dir)s
* Requirements: <threading>multi <include>/home/ghost/local/include
* Default build: release
* Source location: %(root-dir-prefix)sdir/src
* Projects to build:

"""

# Test that correct project structure is created when jam is invoked
# outside of the source tree.
expected = (expected_output1 + expected_output2 + expected_output3) % \
    {"root-dir": "project-test1",
     "root-dir-prefix": "project-test1/" }

t.run_build_system(stdout=expected)

# Test that correct project structure is created when jam is invoked
# at the top of the source tree.
expected = (expected_output1 + expected_output3 + expected_output2) % \
    {"root-dir": ".",
     "root-dir-prefix": "" }

os.chdir("project-test1")
t.run_build_system(stdout=expected)

t.cleanup()
import os
import re


def match_re(actual, expected):
    return re.match(expected, actual, re.DOTALL) != None


# Test the v1 startup behavior
t = Tester(match=match_re, boost_build_path='', pass_toolset=0)

t.set_tree('startup')

t.run_build_system(
    status=1,
    stdout=r'''Unable to load Boost\.Build: could not find "boost-build.jam"
.*Attempted search from .* up to the root''',
    match=match_re)

os.chdir('no-bootstrap1')

t.run_build_system(
    status=1,
    stdout=r'''Unable to load Boost\.Build: could not find build system\.''' +
    r'''.*attempted to load the build system by invoking''' +
    r'''.*'boost-build ;'.*''' +
    r'''but we were unable to find "bootstrap\.jam"''')

# Descend to a subdirectory which /doesn't/ contain a boost-build.jam
# file, and try again to test the crawl-up behavior.
os.chdir('subdir')
Ejemplo n.º 42
0
t = Tester()

# In order to correctly link this app, 'b.cpp', created by 'make'
# rule, should be compiled.
t.write("project-root.jam", "import gcc ;")
t.write("Jamfile", """
lib b : b.cpp : <define>BAR ;
exe a : a.cpp b ;
""")
t.write("a.cpp", """
void foo();
int main() { foo(); }
""")
t.write("b.cpp", "void foo() {}\n")

t.run_build_system()
t.expect_addition("bin/$toolset/debug/main-target-b/b.o")

# This tests another bug: when source file was used by two main targets,
# one without any requirements and another with free requirements, it 
# was compiled twice with to the same locaiton. 

t.write("Jamfile", """
exe a : a.cpp ;
exe b : a.cpp : <define>FOO ;
""")
t.write("a.cpp", """
int main() { return 0; }
""")

t.rm("bin")
Ejemplo n.º 43
0
t.write("b/b.cpp", """ 
void geek();

void 
#if defined(_WIN32)
__declspec(dllexport)
#endif
foo() { geek(); }

""")

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

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"])

# Check that <library> works for static linking.

t.write("b/Jamfile", """ 
lib b : b.cpp : <library>../a//a ; 
""")
t.run_build_system("link=static")
t.expect_addition("bin/$toolset/debug/link-static/main.exe")
Ejemplo n.º 44
0
alias bin1 : a ;
alias bin2 : a b ;

alias src : s.cpp ;
exe hello : hello.cpp src ;

""")
t.write("a.cpp", "int main() { return 0; }\n")
t.copy("a.cpp", "b.cpp")
t.copy("a.cpp", "c.cpp")
t.copy("a.cpp", "hello.cpp")
t.write("s.cpp", "")

# Check that targets to which "bin1" refers are updated,
# and only those.
t.run_build_system("bin1")
t.ignore("*.tds")
t.expect_addition(List("bin/$toolset/debug/") * "a.exe a.obj")
t.expect_nothing_more()

# Try again with "bin2"
t.run_build_system("bin2")
t.ignore("*.tds")
t.expect_addition(List("bin/$toolset/debug/") * "b.exe b.obj")
t.expect_nothing_more()

# Try building everything, making sure 'hello' target is
# created
t.run_build_system()
t.ignore("*.tds")
t.expect_addition("bin/$toolset/debug/hello.exe")
Ejemplo n.º 45
0
#include <a.h>
void
# ifdef _WIN32
__declspec(dllexport)
# endif 
foo() {}
""")
t.write("a.h", "//empty file\n")

t.write("d/Jamfile", "exe b : b.cpp ..//a ; ")
t.write("d/b.cpp", """
    void foo();
    int main() { foo(); }
""")

t.run_build_system(subdir="d")

# Now test the path features with condition work as well
t.write("Jamfile", "lib a : a.cpp : <variant>debug:<include>.  ;")
t.rm("bin")
t.run_build_system(subdir="d")

# Test path features with condtion in usage requirements
t.write("Jamfile", "lib a : a.cpp : <include>. : : <variant>debug:<include>. ;")
t.write("d/b.cpp", """
#include <a.h>
void foo();
int main() { foo(); }
""")
t.rm("d/bin")
t.run_build_system(subdir="d")
Ejemplo n.º 46
0
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

#  Test that conditional properties work, even if property is free, and
#  value includes colon.
from BoostBuild import Tester, List

t = Tester()

# Create the needed files
t.write("project-root.jam", "")
t.write(
    "Jamfile", """
exe hello : hello.cpp : <variant>debug:<define>CLASS=Foo::Bar ;
""")
t.write(
    "hello.cpp", """
namespace Foo { class Bar { } ; }
int main()
{
    CLASS c;
    return 0;
}

""")

# Don't check stderr, which can include warning about unused 'c'.
t.run_build_system(stdout=None, stderr=None)
t.expect_addition("bin/$toolset/debug/hello.exe")

t.cleanup()
Ejemplo n.º 47
0
#!/usr/bin/python

# Test usage of searched-libs: one which are found via -l
# switch to the linker/compiler. 

from BoostBuild import Tester
import string
t = Tester()

# To start with, we have to prepate a library to link with
t.write("lib/project-root.jam", "import gcc ; ")
t.write("lib/Jamfile", "lib test_lib : test_lib.cpp ;")
t.write("lib/test_lib.cpp", "void foo() {}\n");

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

t.copy("lib/bin/$toolset/debug/test_lib.dll", "lib/libtest_lib.dll")


# A regression test: <library>property referring to
# searched-lib was mishandled. As the result, we were
# putting target name to the command line!
# Note that 
#    g++ ...... <.>z
# works nicely in some cases, sending output from compiler
# to file 'z'.
# This problem shows up when searched libs are in usage
# requirements.

t.write('project-root.jam', 'import gcc ;')
Ejemplo n.º 48
0
#!/usr/bin/python

# Copyright 2002, 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

t = Tester(pass_toolset=0)
t.run_build_system(extra_args="--debug --build-system=test")

t.cleanup()
Ejemplo n.º 49
0
t = Tester(pass_toolset=0)

t.set_tree('module-actions')

expected = r'''A.act t1: X1-t1   
B.act t1: X1-t1 X2-B  
act t1: X1-t1 X2-global X3-global 
A.act t2: X1-A X2-t2  
B.act t2:  X2-t2  
act t2: X1-global X2-t2 X3-global 
A.act t3: X1-A  X3-t3 
B.act t3:  X2-B X3-t3 
act t3: X1-global X2-global X3-t3 
'''

# On Unixes, call to 'echo 1     2      3' produces '1 2 3' (note spacing)
# Accomodate for that fact.
if os.name != 'nt':
    expected = re.sub(spaces_re, " ", expected)
    expected = re.sub(trailing_spaces_re, "\n", expected)    

# We expect t5 and t7's output to be dumped to stdout
t.run_build_system(
    stdout = expected
)

t.expect_nothing_more()
t.cleanup()

Ejemplo n.º 50
0
t.write("a.cpp", """
extern void helper();
int main()
{
    return 0;
}

""")

t.write("helper.cpp", """
void helper()
{
}
""")

t.run_build_system()
t.expect_addition("bin/$toolset/debug/link-static/a__helper.lib")
t.rm("bin/$toolset/debug/link-static/a__helper.lib")

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

t.rm("bin")

# Now check that inline targets with the same name but
# present in different places are not confused between
# each other, and with top-level targets.
t.write("Jamroot", """
project : requirements <link>static ;
exe a : a.cpp [ lib helper : helper.cpp ] ;
exe a2 : a.cpp [ lib helper : helper.cpp ] ; 
Ejemplo n.º 51
0
# Create a temporary working directory
t = Tester()

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

""")

t.run_build_system()

# First, create a list of three pathnames
file_list = List("bin/$toolset/debug/") * List("hello.exe hello.obj")
# Second, assert that those files were added as result of the last build system invocation.
t.expect_addition(file_list)

# Invoke the build system once again
t.run_build_system("clean")
# Check if the files added previously were removed.
t.expect_removal(file_list)

# Remove temporary directories
t.cleanup()