Ejemplo n.º 1
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()
Ejemplo n.º 2
0
if os.name != "posix":
    print "The symlink tests can be run on posix only"
    sys.exit(1)

t.write("project-root.jam", "import gcc ;")
t.write(
    "Jamfile",
    """
exe hello : hello.cpp ;
symlink hello_release : hello/<variant>release ; 
symlink hello_debug : hello/<variant>debug ;
symlink links/hello_release : hello/<variant>release ; 
""",
)
t.write(
    "hello.cpp",
    """
int main()
{
    return 0;
}
""",
)

t.run_build_system()
t.expect_addition(List("hello_debug.exe hello_release.exe links/hello_release.exe"))


t.cleanup()
Ejemplo n.º 3
0
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" ;
}
exe a : a.cpp ;
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', """

import path ;
Ejemplo n.º 5
0
t.write("x/Jamfile", """
local pwd = [ PWD ] ;
project : requirements <include>$(pwd)/x/include ;
exe m : m.cpp : <include>$(pwd)/x/include2 ;
""")
t.write("x/m.cpp", """
#include <h1.hpp>
#include <h2.hpp>

int main() {}
""")
t.write("x/include/h1.hpp", "\n")
t.write("x/include2/h2.hpp", "\n")

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

# Test that "&&" in path features is handled correctly.
t.rm("bin")
t.write("Jamfile", "build-project sub ;")
t.write("sub/Jamfile", """
exe a : a.cpp : <include>../h1&&../h2 ;
""")
t.write("sub/a.cpp", """
#include <header.h>
int main() { return OK; }
""")
t.write("h2/header.h", """
const int OK = 0;
""")
t.run_build_system()
Ejemplo n.º 6
0
lib lib1 : a.cpp : <variant>release <link>shared:<define>SHARED_LIB1
: : <link>shared:<define>SHARED_LIB1 ; 
""")

t.write(
    "libs/a_d.cpp", 
""" 
void
#if defined(_WIN32) && defined(SHARED_LIB1)
__declspec(dllexport)
#endif
foo() {} 
""")

t.run_build_system("link=static")
t.expect_addition("libs/bin/$toolset/debug/link-static/a_d.obj")


# Test that indirect conditionals are respected in
# usage requirements.
t.rm(".")

t.write("Jamroot", """
rule has-foo ( properties * )
{
    return <define>HAS_FOO ;
}

exe a : a.cpp b ;
lib b : b.cpp : <link>static : : <conditional>@has-foo ;
""")
Ejemplo n.º 7
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.º 8
0
""")

t.write("hello.cpp", """ #include <pch.hpp>

int main()
{
  TestClass c(1, 2);    
  return 0;
}

""")

t.run_build_system()

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

# Now make the header unusable, without changing timestamp.
# If everything is OK, Boost.Build won't recreate PCH, and
# compiler will happily use pre-compiled header, not noticing
# that the real header is bad.

t.copy_preserving_timestamp("pch.hpp.bad", "pch.hpp")

t.rm("bin/$toolset/debug/hello.obj")

t.run_build_system()
t.expect_addition("bin/$toolset/debug/hello.obj")

t.cleanup()
Ejemplo n.º 9
0
# Copyright 2002, 2003, 2004 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
import os
from string import strip, find

t = Tester(translate_suffixes=0)


t.set_tree("project-test4")

t.run_build_system()

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

t.expect_addition("bin/$toolset/debug/a.exe")
t.expect_content("bin/$toolset/debug/a.exe",
"$toolset/debug/include-everything\n" +
"bin/$toolset/debug/a.obj lib/bin/$toolset/debug/optimization-speed/b.obj\n"
)

t.expect_addition("lib/bin/$toolset/debug/optimization-speed/b.obj")
t.expect_content("lib/bin/$toolset/debug/optimization-speed/b.obj",
"""$toolset/debug/include-everything/optimization-speed
lib/b.cpp
Ejemplo n.º 10
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()
t = Tester()

t.write("Jamroot", """
exe hello : hello.cpp foo ;
lib foo : foo.cpp ;
""")
t.write("hello.cpp", """
extern void foo();
#ifdef FOO
int main()
{
    foo();
    return 0;
}
#endif
""")

t.write("foo.cpp", """
#ifdef FOO
void foo() {}
#endif
""")

# If FOO is not defined when compiling the 'foo'
# target, we'll get a link error at this point.
t.run_build_system("hello define=FOO")

t.expect_addition("bin/$toolset/debug/hello")

t.cleanup()
Ejemplo n.º 12
0
from BoostBuild import Tester, List

t = Tester()

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

exe hello : hello.cpp ;
exe hello2 : hello.cpp ;

explicit hello2 ;
""")
t.write("hello.cpp", """
int main()
{
    return 0;
}

""")

t.run_build_system()
t.ignore("*.tds")
t.expect_addition(List("bin/$toolset/debug/hello") * [".exe", ".obj"])
t.expect_nothing_more()

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


t.cleanup()
Ejemplo n.º 13
0
# Copyright 2002, 2003, 2005 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 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.º 14
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

# Create a temporary working directory
t = Tester()

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

t.run_build_system()

t.expect_addition(["app/bin/$toolset/debug/app.exe",
                   "util/foo/bin/$toolset/debug/bar.dll"])


t.cleanup()
Ejemplo n.º 15
0
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", """
project
    : build-dir build 
    ;
Ejemplo n.º 16
0
import feature ;
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 ;
Ejemplo n.º 17
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()
Ejemplo n.º 18
0
# Create the needed files
t.write("p1/Jamroot", """
exe hello : hello.cpp ;
""")
t.write("p1/hello.cpp", """
int main()
{
    return 0;
}

""")

t.write("p2/Jamroot", """
exe hello2 : hello.cpp ;
exe hello3 : hello.cpp ;
""")
t.write("p2/hello.cpp", """
int main()
{
    return 0;
}

""")

t.run_build_system("p1 p2//hello3")

t.expect_addition("p1/bin/$toolset/debug/hello.exe")
t.expect_addition("p2/bin/$toolset/debug/hello3.exe")

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

from BoostBuild import Tester, List
import string

t = Tester()

t.write("Jamroot", """ 
project : requirements <link>static ;

rule my-lib ( name )
{
   lib $(name) : [ glob *.cpp ] ;
} 
""")

t.write("sub/a.cpp", """ 
""")

t.write("sub/Jamfile", """ 
my-lib foo ; 
""")


t.run_build_system(subdir="sub")

t.expect_addition("sub/bin/$toolset/debug/link-static/foo.lib")

t.cleanup()

Ejemplo n.º 21
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.º 22
0
from BoostBuild import Tester
t = Tester()

t.write("project-root.jam", """
path-constant TOP : . ;
""")
t.write("Jamfile", """
local pwd = [ PWD ] ;
ECHO $(pwd) XXXXX ;
exe hello : $(pwd)/hello.cpp $(TOP)/empty.cpp ;
""")
t.write("hello.cpp", "int main() { return 0; }\n")
t.write("empty.cpp", "\n")

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

# Test a contrived case. There, absolute name is used in
# standalone project (not Jamfile). Moreover, the target with
# absolute name is returned by 'alias' and used from other project.
t.write("a.cpp", """ 
int main()
{
    return 0;
}

""")

t.write("Jamfile", """ 
exe a : /standalone//a ; 
""")
Ejemplo n.º 23
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")
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 "
    + "lib3/bin/$toolset/debug/f.obj\n",
Ejemplo n.º 24
0
t.set_tree('v1_testing')

os.environ['TOOLS'] = 'gcc'
os.environ['NOARSCAN'] = '1'

# 1) No existing bin directories.  Both build and test ran fine. As
# expected, the residue files were a bit different: There was no
# path_test.success, and path_test.test contained the word "passed"
# instead of the path to the .cpp file.  I've haven't looked yet to
# see if the lack of the path is a problem for reporting, but
# hopefully the information is trivially available somewhere else.
t.run_build_system(arguments='test', status=0)
t.expect_addition([
    'bin/compile.test/gcc/debug/runtime-link-dynamic/compile.test',
    'bin/nocompile.test/gcc/debug/runtime-link-dynamic/nocompile.test',
    'bin/link.test/gcc/debug/runtime-link-dynamic/link.test',
    'bin/nolink.test/gcc/debug/runtime-link-dynamic/nolink.test',
    'bin/run.test/gcc/debug/runtime-link-dynamic/run.test'
])

# 2) Missing source file for the library build. path_test.test was
# deleted, so the reporting programs would know that failure
# occurred. The stdout messages also indicated what had
# happened. Excellent!
t.rename('lib.cpp', 'lib.cpp.bak')
t.run_build_system(arguments='test', status=1)
t.expect_removal([
    'bin/link.test/gcc/debug/runtime-link-dynamic/link.test',
    'bin/nolink.test/gcc/debug/runtime-link-dynamic/nolink.test',
    'bin/run.test/gcc/debug/runtime-link-dynamic/run.test'
])
Ejemplo n.º 25
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.º 26
0
t = Tester()

#  Regression test: when staging V2 used to change suffixes on targets
#  corresponding to real files.
t.write("Jamfile", """ 
import type : register ;
register A : a1 a2 a3 ;

stage a : a.a3 ; 
""")

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

t.run_build_system()
t.expect_addition("a/a.a3");

# Regression test: we should be able to specify empty suffix for
# derived target type, even if base type has non-empty suffix.
t.write("a.cpp", "")

t.write("suffixes.jam", """ 
import type ;
import generators ;
import common ;

type.register First : first : ;
type.register Second : "" : First ;

generators.register-standard $(__name__).second : CPP : Second ;
Ejemplo n.º 27
0
#  Test that it's possible to add a suffix to a main target name to
#  disambiguate that main target from another, and that this does not
#  affect the names of the generated targets.
from BoostBuild import Tester, List

# Create a temporary working directory
t = Tester()

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

""")

t.run_build_system()

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


t.cleanup()
Ejemplo n.º 28
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
""")
Ejemplo n.º 29
0
# 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")
t.run_build_system()
Ejemplo n.º 30
0
#!/usr/bin/python

from BoostBuild import Tester, List

t = Tester()

t.set_tree("dependency-test")
t.run_build_system()
# Check that main target 'c' was able to find 'x.h' from
# 'a's dependency graph
t.expect_addition("bin/$toolset/debug/main-target-c/c.exe")
# Check that main target 'e' was able to find 'y.h'
t.expect_addition("bin/$toolset/debug/main-target-e/e.exe")

# Check handling of first level includes.

# Both 'a' and 'b' include "a.h" and should be updated
t.touch("a.h")
t.run_build_system()

t.expect_touch("bin/$toolset/debug/a.exe")
t.expect_touch("bin/$toolset/debug/a.obj")
t.expect_touch("bin/$toolset/debug/b.exe")
t.expect_touch("bin/$toolset/debug/b.obj")
t.expect_touch("bin/$toolset/debug/main-target-c/c.exe")
t.expect_nothing_more()

# Only 'a' include <a.h> and should be updated
t.touch("src1/a.h")
t.run_build_system()
Ejemplo n.º 31
0
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")

# Regression test.
Ejemplo n.º 32
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()

# Test the <location> property
t.write(
    "Jamfile", """
Ejemplo n.º 33
0
#!/usr/bin/python

from BoostBuild import Tester, List

t = Tester()

t.set_tree("dependency-test")
t.run_build_system()
# Check that main target 'c' was able to find 'x.h' from
# 'a's dependency graph
t.expect_addition("bin/$toolset/debug/c.exe")

# Check handling of first level includes.

# Both 'a' and 'b' include "a.h" and should be updated
t.touch("a.h")
t.run_build_system()

t.expect_touch("bin/$toolset/debug/a.exe")
t.expect_touch("bin/$toolset/debug/a.obj")
t.expect_touch("bin/$toolset/debug/a_c.obj")
t.expect_touch("bin/$toolset/debug/b.exe")
t.expect_touch("bin/$toolset/debug/b.obj")
# Now, <dependency> does not add dependency.
# It sound weird, but is intentional. Need
# to rename <dependency> eventually.
#t.expect_touch("bin/$toolset/debug/main-target-c/c.exe")
t.ignore("*.tds")
t.expect_nothing_more()

# Only 'a' include <a.h> and should be updated
Ejemplo n.º 34
0
t.write("a.cpp", """ 
#include <a.h>

int main()
{
   foo();
   return 0;
}

""")

t.write("Jamfile", """ 
exe a : a.cpp : <include>d2 <include>d1 ; 
""")

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

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

t.write("d2/a.h", """ 
inline void foo() {}

""")

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

t.cleanup()
Ejemplo n.º 35
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.º 36
0
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")
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 " +
"lib3/bin/$toolset/debug/f.obj\n"
)

t.expect_addition("lib/bin/$toolset/debug/b.obj")
Ejemplo n.º 37
0
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", """
lib l : l.cpp : : : <link>static:<define>STATIC ;
Ejemplo n.º 38
0
    "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", """
project
    : build-dir build 
    ;
Ejemplo n.º 39
0
t = Tester()

# Create the needed files
t.write("Jamroot", """
lib a : : <source>a.cpp ;
""")
t.write("a.cpp", """
#ifdef _WIN32
__declspec(dllexport)
#endif
void foo() {}

""")

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

t.rm("bin")

# Now try with <conditional>
t.write("Jamroot", """
rule test ( properties * )
{
    return <source>a.cpp ;
}
lib a : : <conditional>@test ;
""")

t.run_build_system()
t.expect_addition("bin/$toolset/debug/a.obj")
Ejemplo n.º 40
0
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")

# Regression test.
Ejemplo n.º 41
0
feature.feature cf : off on : composite incidental ;

feature.compose <cf>off : <define>CF_IS_OFF ;

feature.subfeature cf on : version : 1 2 : composite optional incidental ;

feature.compose <cf-on:version>1 : <define>CF_1 ;
        
""")

t.expand_toolset("Jamfile")

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

t.rm("bin")

# Test for issue BB60
t.write("test.cpp", """
#include "header.h"
int main() { return 0; }
""")
t.write("Jamfile", """
project
    : requirements <toolset>$toolset:<include>foo
    ;
exe test : test.cpp : <toolset>$toolset ;
""")
Ejemplo n.º 42
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()

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

# Create a temporary working directory
t = Tester()

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

t.run_build_system()

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

t.cleanup()
Ejemplo n.º 45
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()
Ejemplo n.º 46
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()
Ejemplo n.º 47
0
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")

t.rm(["bin", "a/bin", "b/bin"])
Ejemplo n.º 48
0
int main() { foo(); return 0; } 
""")

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

t.write("project-root.jam", """ 
import gcc ; 
""")

t.write("libs/a.cpp", """ 
void foo() {} 
""")

# This library should be build with the same properties as
# 'main'. There were a bug when they were generated with
# empty properties, and there were ambiguity between variants.
t.write(
    "libs/Jamfile", """ 
lib lib1 : a_d.cpp : <variant>debug ;
lib lib1 : a.cpp : <variant>release ; 
""")

t.write("libs/a_d.cpp", """ 
void foo() {} 
""")

t.run_build_system("link=static")
t.expect_addition("libs/bin/$toolset/debug/link-static/a_d.o")

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

# Create a temporary working directory
t = Tester()

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

t.run_build_system()

t.expect_addition(["bin/$toolset/debug/main.exe"])
                   
t.cleanup()
Ejemplo n.º 50
0
t.expand_toolset("ext/project-root.jam")
t.expand_toolset("project-root.jam")
# First, build the external project
t.run_build_system("debug release", subdir="ext")

# Then pretend that we don't have the sources for the external project,
# and can only use compiled binaries
t.copy("ext/Jamfile2", "ext/Jamfile")
t.expand_toolset("ext/Jamfile")

# Now check that we can build the main project, and that
# correct prebuilt file is picked, depending of variant.
# This also checks that correct includes for prebuilt
# libraries are used.

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

t.rm("bin")
# Now test that prebuilt file specified by absolute name 
# works too.
t.copy("ext/Jamfile3", "ext/Jamfile")
t.expand_toolset("ext/Jamfile")
t.run_build_system("debug release")
t.expect_addition("bin/$toolset/debug/hello.exe")
t.expect_addition("bin/$toolset/release/hello.exe")


t.cleanup()
Ejemplo n.º 51
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.º 52
0
    return 0;
}

""")

t.write("project-root.jam", """ 
import standalone ; 
""")

t.write(
    "standalone.jam", """ 
import project ;

project.initialize $(__name__) ;
project standalone ;

local pwd = [ PWD ] ;

alias x : $(pwd)/../a.cpp ;
alias runtime : x ;

""")

t.write("sub/Jamfile", """ 
stage bin : /standalone//runtime ; 
""")

t.run_build_system(subdir="sub")
t.expect_addition("sub/bin/a.cpp")
t.cleanup()
#  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.º 54
0
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 test_lib : test_lib.cpp ;")
t.write("lib/test_lib.cpp", """
#ifdef _WIN32
__declspec(dllexport)
#endif
void foo() {}
""")

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

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

# Test that the simplest usage of searched library works.
t.write('project-root.jam', '')
t.write(
    'Jamfile', """
Ejemplo n.º 55
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.º 56
0
    "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", """
project
    : build-dir build 
    ;
Ejemplo n.º 57
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.º 58
0
#ifdef OK
int main() {}
#endif

""")

t.write("a2.cpp", """ 
#ifdef OK
int main() {}
#endif

""")

t.write("a3.cpp", """ 
#ifdef OK
int main() {}
#endif

""")



t.run_build_system()

t.expect_addition("bin/$toolset/debug/a1.exe")
t.expect_addition("bin/$toolset/debug/optimization-speed/a2.exe")
t.expect_addition("bin/$toolset/debug/optimization-speed/a3.exe")

t.cleanup()

Ejemplo n.º 59
0
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.º 60
0
# 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")
t.run_build_system()