1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
#!/usr/bin/python
# Copyright 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, List
import string
# Test that on compilers which are sensitive to library order on
# linker's command line, we generate the right order.
t = Tester()
t.write("a.cpp", """
void b();
void a()
{
b();
}
""")
t.write("b.cpp", """
void c();
void b()
{
c();
}
""")
t.write("c.cpp", """
void d();
void c()
{
d();
}
""")
t.write("d.cpp", """
void d() {}
""")
# The order of libraries in 'main' is crafted so that
# we get error unless we do something about the order ourselfs.
t.write("Jamfile", """
exe main : main.cpp libd libc libb liba ;
lib libd : d.cpp ;
lib libc : c.cpp : <link>static <use>libd ;
lib libb : b.cpp : <use>libc ;
lib liba : a.cpp : <use>libb ;
""")
t.write("main.cpp", """
void a();
int main()
{
a();
return 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", "")
t.write("Jamfile", """
exe main : main.cpp first second ;
lib first : second : <file>first.a ;
lib second : : <file>second.a ;
""")
t.run_build_system("-a -n -d+2")
t.fail_test(string.find(t.stdout(), "first") > string.find(t.stdout(), "second"))
t.write("Jamfile", """
exe main : main.cpp first second ;
lib first : : <file>first.a ;
lib second : first : <file>second.a ;
""")
t.run_build_system("-a -n -d+2")
t.fail_test(string.find(t.stdout(), "first") < string.find(t.stdout(), "second"))
t.cleanup()
|