2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

Fixes for Windows/GCC-3.2

[SVN r16815]
This commit is contained in:
Dave Abrahams
2003-01-09 01:29:30 +00:00
parent 960b42bdf9
commit 4b0384ff03
20 changed files with 130 additions and 56 deletions

View File

@@ -297,14 +297,31 @@ class Tester(TestCmd.TestCmd):
ignore_elements(self.unexpected_difference.modified_files, wildcard)
def expect_touch(self, names):
if type(names) == types.StringType:
names = [names]
names = [names]
d = self.unexpected_difference
for name in names:
# We need to check in both touched and modified files if
# it's a Windows exe because they sometimes have slight
# differences even with identical inputs
if name.endswith('.exe'):
filesets = [d.modified_files, d.touched_files]
else:
filesets = [d.touched_files]
while filesets:
try:
self.unexpected_difference.touched_files.remove(name)
except:
print "File %s not touched as expected" % (name,)
self.fail_test(1)
filesets[-1].remove(name)
break
except ValueError:
filesets.pop()
if not filesets:
print "File %s not touched as expected" % (name,)
self.fail_test(1)
def ignore_touch(self, wildcard):

View File

@@ -5,32 +5,49 @@
# 2) than if 'make' create targets of type CPP, they are
# correctly used (there was a bug with it).
from BoostBuild import Tester
from BoostBuild import Tester, exe_suffix
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", """
t.write("Jamfile", r'''
rule create ( dst : src * : properties * )
{
# hack to echo a space under NT
setup on $(dst) = "set x=int main(){}" ;
}
actions create
import modules ;
if [ modules.peek : NT ]
{
echo "int main(){}" > $(<)
actions create
{
$(setup)
echo %x% > $(<)
}
}
else
{
actions create
{
echo "int main(){}" > $(<)
}
}
IMPORT $(__name__) : create : : create ;
exe a : l ;
lib l : a.cpp b.cpp ;
# needs to be static lib for Windows - main can't appear in DLL
static-lib l : a.cpp b.cpp ;
make b.cpp : : create ;
""")
''')
t.write("a.cpp", "")
t.run_build_system()
t.expect_addition("bin/gcc/debug/a")
t.expect_addition("bin/gcc/debug/a" + exe_suffix)
t.cleanup()

View File

@@ -2,15 +2,15 @@
# Test that default build clause actually has any effect.
from BoostBuild import Tester
from BoostBuild import Tester, exe_suffix
t = Tester()
t.write("project-root.jam", "import gcc ;")
t.write("Jamfile", "exe a : a.cpp : : debug release ;")
t.write("a.cpp", "int main() {}")
t.write("a.cpp", "int main() {}\n")
t.run_build_system()
t.expect_addition("bin/gcc/debug/a")
t.expect_addition("bin/gcc/release/a")
t.expect_addition("bin/gcc/debug/a"+exe_suffix)
t.expect_addition("bin/gcc/release/a"+exe_suffix)
t.cleanup()

View File

@@ -29,7 +29,7 @@ t.expect_nothing_more()
t.touch("src1/a.h")
t.run_build_system()
t.expect_touch("bin/gcc/debug/a")
t.expect_touch("bin/gcc/debug/a" + exe_suffix)
t.expect_touch("bin/gcc/debug/a.o")
t.expect_touch("bin/gcc/debug/main-target-c/c" + exe_suffix)
t.expect_nothing_more()

View File

@@ -4,4 +4,4 @@ void foo();
int main()
{
foo();
}
}

View File

@@ -1,4 +1,4 @@
#ifdef MACROS
void foo() {}
#endif
#endif

View File

@@ -1,6 +1,6 @@
#!/usr/bin/python
from BoostBuild import Tester, List
from BoostBuild import Tester, List, dll_suffix, exe_suffix
import os
from string import strip
@@ -10,6 +10,9 @@ t = Tester()
t.set_tree("direct-request-test")
t.run_build_system(extra_args="define=MACROS")
t.expect_addition("bin/gcc/debug/" * List("a.o b.o b.so a"))
t.expect_addition("bin/gcc/debug/"
* (List("a.o b.o")
+ ('b'+dll_suffix)
+ ('a'+exe_suffix)))
t.cleanup()

View File

@@ -17,7 +17,7 @@ t.write("a.cpp", """
void foo();
int main() { foo(); }
""")
t.write("b.cpp", "void foo() {}")
t.write("b.cpp", "void foo() {}\n")
t.run_build_system()
t.expect_addition("bin/gcc/debug/main-target-b/b.o")

View File

@@ -7,7 +7,7 @@ t = Tester()
t.write("project-root.jam", "import gcc ;")
t.write("Jamfile", "exe a : src/a.cpp ;")
t.write("src/a.cpp", "int main() {}")
t.write("src/a.cpp", "int main() {}\n")
t.run_build_system()

View File

@@ -9,7 +9,7 @@ t.write("Jamfile", """
lib b : b.cpp : : : <define>FOO ;
exe a : a.cpp b ;
""")
t.write("b.cpp", "void foo() {}")
t.write("b.cpp", "void foo() {}\n")
t.write("a.cpp", """
#ifdef FOO
void foo() {}
@@ -28,7 +28,7 @@ t.write("Jamfile", """
lib b : b.cpp : : : <define>FOO ;
exe a : a.cpp : <dependency>b ;
""")
t.write("b.cpp", "void foo() {}")
t.write("b.cpp", "void foo() {}\n")
t.write("a.cpp", """
#ifdef FOO
int main() {}
@@ -48,7 +48,7 @@ project :
;
lib b : b.cpp ;
""")
t.write("lib/b.cpp", "void foo() {}")
t.write("lib/b.cpp", "void foo() {}\n")
t.run_build_system()
# Test that use requirements are inherited correctly
@@ -74,7 +74,7 @@ project :
;
lib b : b.cpp ;
""")
t.write("lib/1/b.cpp", "void foo() {}")
t.write("lib/1/b.cpp", "void foo() {}\n")
t.run_build_system()
t.run_build_system("--clean")
@@ -164,4 +164,4 @@ void foo() {}
t.run_build_system()
t.expect_addition("libs/bin/gcc/debug/a_d.o")
t.cleanup()
t.cleanup()

View File

@@ -297,14 +297,31 @@ class Tester(TestCmd.TestCmd):
ignore_elements(self.unexpected_difference.modified_files, wildcard)
def expect_touch(self, names):
if type(names) == types.StringType:
names = [names]
names = [names]
d = self.unexpected_difference
for name in names:
# We need to check in both touched and modified files if
# it's a Windows exe because they sometimes have slight
# differences even with identical inputs
if name.endswith('.exe'):
filesets = [d.modified_files, d.touched_files]
else:
filesets = [d.touched_files]
while filesets:
try:
self.unexpected_difference.touched_files.remove(name)
except:
print "File %s not touched as expected" % (name,)
self.fail_test(1)
filesets[-1].remove(name)
break
except ValueError:
filesets.pop()
if not filesets:
print "File %s not touched as expected" % (name,)
self.fail_test(1)
def ignore_touch(self, wildcard):

View File

@@ -5,32 +5,49 @@
# 2) than if 'make' create targets of type CPP, they are
# correctly used (there was a bug with it).
from BoostBuild import Tester
from BoostBuild import Tester, exe_suffix
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", """
t.write("Jamfile", r'''
rule create ( dst : src * : properties * )
{
# hack to echo a space under NT
setup on $(dst) = "set x=int main(){}" ;
}
actions create
import modules ;
if [ modules.peek : NT ]
{
echo "int main(){}" > $(<)
actions create
{
$(setup)
echo %x% > $(<)
}
}
else
{
actions create
{
echo "int main(){}" > $(<)
}
}
IMPORT $(__name__) : create : : create ;
exe a : l ;
lib l : a.cpp b.cpp ;
# needs to be static lib for Windows - main can't appear in DLL
static-lib l : a.cpp b.cpp ;
make b.cpp : : create ;
""")
''')
t.write("a.cpp", "")
t.run_build_system()
t.expect_addition("bin/gcc/debug/a")
t.expect_addition("bin/gcc/debug/a" + exe_suffix)
t.cleanup()

View File

@@ -2,15 +2,15 @@
# Test that default build clause actually has any effect.
from BoostBuild import Tester
from BoostBuild import Tester, exe_suffix
t = Tester()
t.write("project-root.jam", "import gcc ;")
t.write("Jamfile", "exe a : a.cpp : : debug release ;")
t.write("a.cpp", "int main() {}")
t.write("a.cpp", "int main() {}\n")
t.run_build_system()
t.expect_addition("bin/gcc/debug/a")
t.expect_addition("bin/gcc/release/a")
t.expect_addition("bin/gcc/debug/a"+exe_suffix)
t.expect_addition("bin/gcc/release/a"+exe_suffix)
t.cleanup()

View File

@@ -29,7 +29,7 @@ t.expect_nothing_more()
t.touch("src1/a.h")
t.run_build_system()
t.expect_touch("bin/gcc/debug/a")
t.expect_touch("bin/gcc/debug/a" + exe_suffix)
t.expect_touch("bin/gcc/debug/a.o")
t.expect_touch("bin/gcc/debug/main-target-c/c" + exe_suffix)
t.expect_nothing_more()

View File

@@ -4,4 +4,4 @@ void foo();
int main()
{
foo();
}
}

View File

@@ -1,4 +1,4 @@
#ifdef MACROS
void foo() {}
#endif
#endif

View File

@@ -1,6 +1,6 @@
#!/usr/bin/python
from BoostBuild import Tester, List
from BoostBuild import Tester, List, dll_suffix, exe_suffix
import os
from string import strip
@@ -10,6 +10,9 @@ t = Tester()
t.set_tree("direct-request-test")
t.run_build_system(extra_args="define=MACROS")
t.expect_addition("bin/gcc/debug/" * List("a.o b.o b.so a"))
t.expect_addition("bin/gcc/debug/"
* (List("a.o b.o")
+ ('b'+dll_suffix)
+ ('a'+exe_suffix)))
t.cleanup()

View File

@@ -17,7 +17,7 @@ t.write("a.cpp", """
void foo();
int main() { foo(); }
""")
t.write("b.cpp", "void foo() {}")
t.write("b.cpp", "void foo() {}\n")
t.run_build_system()
t.expect_addition("bin/gcc/debug/main-target-b/b.o")

View File

@@ -7,7 +7,7 @@ t = Tester()
t.write("project-root.jam", "import gcc ;")
t.write("Jamfile", "exe a : src/a.cpp ;")
t.write("src/a.cpp", "int main() {}")
t.write("src/a.cpp", "int main() {}\n")
t.run_build_system()

View File

@@ -9,7 +9,7 @@ t.write("Jamfile", """
lib b : b.cpp : : : <define>FOO ;
exe a : a.cpp b ;
""")
t.write("b.cpp", "void foo() {}")
t.write("b.cpp", "void foo() {}\n")
t.write("a.cpp", """
#ifdef FOO
void foo() {}
@@ -28,7 +28,7 @@ t.write("Jamfile", """
lib b : b.cpp : : : <define>FOO ;
exe a : a.cpp : <dependency>b ;
""")
t.write("b.cpp", "void foo() {}")
t.write("b.cpp", "void foo() {}\n")
t.write("a.cpp", """
#ifdef FOO
int main() {}
@@ -48,7 +48,7 @@ project :
;
lib b : b.cpp ;
""")
t.write("lib/b.cpp", "void foo() {}")
t.write("lib/b.cpp", "void foo() {}\n")
t.run_build_system()
# Test that use requirements are inherited correctly
@@ -74,7 +74,7 @@ project :
;
lib b : b.cpp ;
""")
t.write("lib/1/b.cpp", "void foo() {}")
t.write("lib/1/b.cpp", "void foo() {}\n")
t.run_build_system()
t.run_build_system("--clean")
@@ -164,4 +164,4 @@ void foo() {}
t.run_build_system()
t.expect_addition("libs/bin/gcc/debug/a_d.o")
t.cleanup()
t.cleanup()