mirror of
https://github.com/boostorg/build.git
synced 2026-07-21 13:13:39 +00:00
test suite: msys/cygwin fixes (#253)
This commit is contained in:
+2
-1
@@ -17,7 +17,8 @@ if [ $? -ne 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
cd "$pwd"
|
cd "$pwd"
|
||||||
cp "./src/engine/b2" .
|
cp "./src/engine/b2" . 2>/dev/null
|
||||||
|
cp "./src/engine/b2.exe" . 2>/dev/null
|
||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -229,8 +229,8 @@ class symlink-target-class : basic-target
|
|||||||
|
|
||||||
rule do-file-link
|
rule do-file-link
|
||||||
{
|
{
|
||||||
local target = [ path.native [ path.relative-to [ path.pwd ] $(<) ] ] ;
|
local target = [ path.relative-to [ path.pwd ] $(<) ] ;
|
||||||
local source = [ path.native [ path.relative-to [ path.pwd ] $(>) ] ] ;
|
local source = [ path.relative-to [ path.pwd ] $(>) ] ;
|
||||||
local old-source = [ on $(target) return $(LINK-SOURCE) ] ;
|
local old-source = [ on $(target) return $(LINK-SOURCE) ] ;
|
||||||
if $(old-source)
|
if $(old-source)
|
||||||
{
|
{
|
||||||
@@ -240,6 +240,8 @@ rule do-file-link
|
|||||||
Link previously defined to another file, $(old-source[1]). ;
|
Link previously defined to another file, $(old-source[1]). ;
|
||||||
}
|
}
|
||||||
LINK-SOURCE on $(target) = $(source) $(.current-target) ;
|
LINK-SOURCE on $(target) = $(source) $(.current-target) ;
|
||||||
|
target = [ path.native $(target) ] ;
|
||||||
|
source = [ path.native $(source) ] ;
|
||||||
LOCATE on $(target) = . ;
|
LOCATE on $(target) = . ;
|
||||||
DEPENDS $(.current-target) : $(target) ;
|
DEPENDS $(.current-target) : $(target) ;
|
||||||
if $(.can-symlink) = true
|
if $(.can-symlink) = true
|
||||||
|
|||||||
+24
-18
@@ -112,12 +112,9 @@ def get_toolset():
|
|||||||
|
|
||||||
|
|
||||||
# Detect the host OS.
|
# Detect the host OS.
|
||||||
cygwin = hasattr(os, "uname") and os.uname()[0].lower().startswith("cygwin")
|
if sys.platform == "cygwin":
|
||||||
windows = cygwin or os.environ.get("OS", "").lower().startswith("windows")
|
|
||||||
|
|
||||||
if cygwin:
|
|
||||||
default_os = "cygwin"
|
default_os = "cygwin"
|
||||||
elif windows:
|
elif sys.platform == "win32":
|
||||||
default_os = "windows"
|
default_os = "windows"
|
||||||
elif hasattr(os, "uname"):
|
elif hasattr(os, "uname"):
|
||||||
default_os = os.uname()[0].lower()
|
default_os = os.uname()[0].lower()
|
||||||
@@ -158,7 +155,7 @@ def prepare_suffix_map(toolset, target_os=default_os):
|
|||||||
if target_os == "cygwin":
|
if target_os == "cygwin":
|
||||||
suffixes[".lib"] = ".a"
|
suffixes[".lib"] = ".a"
|
||||||
suffixes[".obj"] = ".o"
|
suffixes[".obj"] = ".o"
|
||||||
suffixes[".implib"] = ".lib.a"
|
suffixes[".implib"] = ".dll.a"
|
||||||
elif target_os == "windows":
|
elif target_os == "windows":
|
||||||
if toolset == "gcc":
|
if toolset == "gcc":
|
||||||
# MinGW
|
# MinGW
|
||||||
@@ -196,6 +193,11 @@ def prepare_library_prefix(toolset, target_os=default_os):
|
|||||||
else:
|
else:
|
||||||
dll_prefix = "lib"
|
dll_prefix = "lib"
|
||||||
|
|
||||||
|
global implib_prefix
|
||||||
|
implib_prefix = None
|
||||||
|
if toolset == "gcc":
|
||||||
|
implib_prefix = "lib"
|
||||||
|
|
||||||
|
|
||||||
def re_remove(sequence, regex):
|
def re_remove(sequence, regex):
|
||||||
me = re.compile(regex)
|
me = re.compile(regex)
|
||||||
@@ -268,7 +270,7 @@ class Tester(TestCmd.TestCmd):
|
|||||||
if not executable:
|
if not executable:
|
||||||
executable = os.getenv('B2')
|
executable = os.getenv('B2')
|
||||||
if not executable:
|
if not executable:
|
||||||
executable = 'b2' if os.name != 'nt' else 'b2.exe'
|
executable = 'b2' if sys.platform not in ['win32', 'cygwin'] else 'b2.exe'
|
||||||
|
|
||||||
assert arguments.__class__ is not str
|
assert arguments.__class__ is not str
|
||||||
self.original_workdir = os.path.dirname(__file__)
|
self.original_workdir = os.path.dirname(__file__)
|
||||||
@@ -280,6 +282,7 @@ class Tester(TestCmd.TestCmd):
|
|||||||
self.translate_suffixes = translate_suffixes
|
self.translate_suffixes = translate_suffixes
|
||||||
self.use_test_config = use_test_config
|
self.use_test_config = use_test_config
|
||||||
|
|
||||||
|
self.target_os = default_os
|
||||||
self.toolset = get_toolset()
|
self.toolset = get_toolset()
|
||||||
self.expanded_toolset = expand_toolset(self.toolset)
|
self.expanded_toolset = expand_toolset(self.toolset)
|
||||||
self.pass_toolset = pass_toolset
|
self.pass_toolset = pass_toolset
|
||||||
@@ -341,11 +344,14 @@ class Tester(TestCmd.TestCmd):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def set_toolset(self, toolset, target_os=default_os):
|
def set_toolset(self, toolset, target_os=default_os):
|
||||||
|
self.target_os = target_os
|
||||||
self.toolset = toolset
|
self.toolset = toolset
|
||||||
self.expanded_toolset = expand_toolset(toolset, target_os)
|
self.expanded_toolset = expand_toolset(toolset, target_os)
|
||||||
self.pass_toolset = True
|
self.pass_toolset = True
|
||||||
prepare_prefixes_and_suffixes(toolset, target_os)
|
prepare_prefixes_and_suffixes(toolset, target_os)
|
||||||
|
|
||||||
|
def is_implib_expected(self):
|
||||||
|
return self.target_os in ["windows", "cygwin"] and not self.toolset.startswith("clang-linux")
|
||||||
|
|
||||||
#
|
#
|
||||||
# Methods that change the working directory's content.
|
# Methods that change the working directory's content.
|
||||||
@@ -741,7 +747,7 @@ class Tester(TestCmd.TestCmd):
|
|||||||
def __ignore_junk(self):
|
def __ignore_junk(self):
|
||||||
# Not totally sure about this change, but I do not see a good
|
# Not totally sure about this change, but I do not see a good
|
||||||
# alternative.
|
# alternative.
|
||||||
if windows:
|
if self.target_os == "windows":
|
||||||
self.ignore("*.ilk") # MSVC incremental linking files.
|
self.ignore("*.ilk") # MSVC incremental linking files.
|
||||||
self.ignore("*.pdb") # MSVC program database files.
|
self.ignore("*.pdb") # MSVC program database files.
|
||||||
self.ignore("*.rsp") # Response files.
|
self.ignore("*.rsp") # Response files.
|
||||||
@@ -838,21 +844,21 @@ class Tester(TestCmd.TestCmd):
|
|||||||
def adjust_lib_name(self, name):
|
def adjust_lib_name(self, name):
|
||||||
global lib_prefix
|
global lib_prefix
|
||||||
global dll_prefix
|
global dll_prefix
|
||||||
|
global implib_prefix
|
||||||
result = name
|
result = name
|
||||||
|
|
||||||
pos = name.rfind(".")
|
pos = name.rfind(".")
|
||||||
if pos != -1:
|
if pos != -1:
|
||||||
suffix = name[pos:]
|
suffix = name[pos:]
|
||||||
if suffix == ".lib":
|
prefix = {
|
||||||
(head, tail) = os.path.split(name)
|
".lib": lib_prefix,
|
||||||
if lib_prefix:
|
".dll": dll_prefix,
|
||||||
tail = lib_prefix + tail
|
".implib": implib_prefix,
|
||||||
result = os.path.join(head, tail)
|
}.get(suffix)
|
||||||
elif suffix == ".dll" or suffix == ".implib":
|
(head, tail) = os.path.split(name)
|
||||||
(head, tail) = os.path.split(name)
|
if prefix:
|
||||||
if dll_prefix:
|
tail = prefix + tail
|
||||||
tail = dll_prefix + tail
|
result = os.path.join(head, tail)
|
||||||
result = os.path.join(head, tail)
|
|
||||||
# If we want to use this name in a Jamfile, we better convert \ to /,
|
# If we want to use this name in a Jamfile, we better convert \ to /,
|
||||||
# as otherwise we would have to quote \.
|
# as otherwise we would have to quote \.
|
||||||
result = result.replace("\\", "/")
|
result = result.replace("\\", "/")
|
||||||
|
|||||||
+1
-1
@@ -119,7 +119,7 @@ def test_toolset(toolset, version, property_sets):
|
|||||||
t.run_build_system(["--user-config=", "-sPYTHON_CMD=%s" % sys.executable] + properties)
|
t.run_build_system(["--user-config=", "-sPYTHON_CMD=%s" % sys.executable] + properties)
|
||||||
t.expect_addition("bin/%s/lib.obj" % (path("obj")))
|
t.expect_addition("bin/%s/lib.obj" % (path("obj")))
|
||||||
if "link=static" not in properties:
|
if "link=static" not in properties:
|
||||||
if get_target_os(properties) in ["cygwin", "windows"] and toolset != "clang-linux":
|
if t.is_implib_expected():
|
||||||
t.expect_addition("bin/%s/l1.implib" % (path("dll")))
|
t.expect_addition("bin/%s/l1.implib" % (path("dll")))
|
||||||
t.expect_addition("bin/%s/l1.dll" % (path("dll")))
|
t.expect_addition("bin/%s/l1.dll" % (path("dll")))
|
||||||
t.ignore_addition("bin/%s/*l1.*.rsp" % (path("dll")))
|
t.ignore_addition("bin/%s/*l1.*.rsp" % (path("dll")))
|
||||||
|
|||||||
@@ -7,12 +7,14 @@
|
|||||||
import BoostBuild
|
import BoostBuild
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
t = BoostBuild.Tester(pass_toolset=0)
|
t = BoostBuild.Tester(pass_toolset=0)
|
||||||
|
|
||||||
t.write("link-target", "")
|
t.write("link-target", "")
|
||||||
try:
|
try:
|
||||||
os.symlink("link-target", "link")
|
with patch.dict(os.environ, {var: "winsymlinks:nativestrict" for var in ["MSYS", "CYGWIN"]}):
|
||||||
|
os.symlink("link-target", "link")
|
||||||
except (AttributeError, OSError) as e:
|
except (AttributeError, OSError) as e:
|
||||||
# Either OS does not support symlinks or not enough privilege
|
# Either OS does not support symlinks or not enough privilege
|
||||||
print("XFAIL: %s" % e)
|
print("XFAIL: %s" % e)
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ void a() {}
|
|||||||
t.run_build_system(subdir="a")
|
t.run_build_system(subdir="a")
|
||||||
t.expect_addition("a/dist/a.dll")
|
t.expect_addition("a/dist/a.dll")
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
if t.is_implib_expected():
|
||||||
# This is a Windows import library.
|
# This is a Windows import library.
|
||||||
file = t.adjust_name("a.implib")
|
file = t.adjust_name("a.implib")
|
||||||
else:
|
else:
|
||||||
|
|||||||
+13
-9
@@ -8,6 +8,8 @@
|
|||||||
# common boost/ directory in the new git layout.
|
# common boost/ directory in the new git layout.
|
||||||
|
|
||||||
import BoostBuild
|
import BoostBuild
|
||||||
|
import os
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
def ignore_config(t):
|
def ignore_config(t):
|
||||||
"""These files are created by the configuration logic in link.jam
|
"""These files are created by the configuration logic in link.jam
|
||||||
@@ -339,12 +341,14 @@ def test_error_duplicate():
|
|||||||
|
|
||||||
t.cleanup()
|
t.cleanup()
|
||||||
|
|
||||||
test_basic()
|
|
||||||
test_merge_two()
|
with patch.dict(os.environ, {var: "winsymlinks:nativestrict" for var in ["MSYS", "CYGWIN"]}):
|
||||||
test_merge_existing_all()
|
test_basic()
|
||||||
test_merge_recursive()
|
test_merge_two()
|
||||||
test_merge_recursive_existing_all()
|
test_merge_existing_all()
|
||||||
test_include_scan()
|
test_merge_recursive()
|
||||||
test_include_scan_merge_existing()
|
test_merge_recursive_existing_all()
|
||||||
test_update_file_link_all()
|
test_include_scan()
|
||||||
test_error_duplicate()
|
test_include_scan_merge_existing()
|
||||||
|
test_update_file_link_all()
|
||||||
|
test_error_duplicate()
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ if [ os.name ] in NT
|
|||||||
}
|
}
|
||||||
else if [ os.name ] in CYGWIN
|
else if [ os.name ] in CYGWIN
|
||||||
{
|
{
|
||||||
dll-suffix = dll ;
|
dll-suffix = dll.a ;
|
||||||
}
|
}
|
||||||
else if [ os.name ] in MACOSX
|
else if [ os.name ] in MACOSX
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ if [ os.name ] in NT
|
|||||||
}
|
}
|
||||||
else if [ os.name ] in CYGWIN
|
else if [ os.name ] in CYGWIN
|
||||||
{
|
{
|
||||||
dll-suffix = dll ;
|
dll-suffix = dll.a ;
|
||||||
}
|
}
|
||||||
else if [ os.name ] in MACOSX
|
else if [ os.name ] in MACOSX
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ t.expect_addition("lib/bin/$toolset/debug*/test_lib.dll")
|
|||||||
|
|
||||||
# Auto adjusting of suffixes does not work, since we need to
|
# Auto adjusting of suffixes does not work, since we need to
|
||||||
# change dll to lib.
|
# change dll to lib.
|
||||||
if ( ( os.name == "nt" ) or os.uname()[0].lower().startswith("cygwin") ) and \
|
if t.is_implib_expected():
|
||||||
( BoostBuild.get_toolset() != "gcc" ):
|
t.expect_addition("lib/bin/$toolset/debug*/test_lib.implib")
|
||||||
t.copy("lib/bin/$toolset/debug*/test_lib.implib", "lib/test_lib.implib")
|
t.copy("lib/bin/$toolset/debug*/test_lib.implib", "lib/test_lib.implib")
|
||||||
t.copy("lib/bin/$toolset/debug*/test_lib.dll", "lib/test_lib.dll")
|
t.copy("lib/bin/$toolset/debug*/test_lib.dll", "lib/test_lib.dll")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user