]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/test_all.py
3 # Copyright 2002-2005 Dave Abrahams.
4 # Copyright 2002-2006 Vladimir Prus.
5 # Distributed under the Boost Software License, Version 1.0.
6 # (See accompanying file LICENSE.txt or copy at
7 # https://www.bfgroup.xyz/b2/LICENSE.txt)
9 from __future__
import print_function
17 xml
= "--xml" in sys
.argv
18 toolset
= BoostBuild
.get_toolset()
21 # Clear environment for testing.
23 for s
in ("BOOST_ROOT", "BOOST_BUILD_PATH", "JAM_TOOLSET", "BCCROOT",
24 "MSVCDir", "MSVC", "MSVCNT", "MINGW", "watcom"):
30 BoostBuild
.set_defer_annotations(1)
33 def run_tests(critical_tests
, other_tests
):
35 Runs first the critical_tests and then the other_tests.
37 Writes the name of the first failed test to test_results.txt. Critical
38 tests are run in the specified order, other tests are run starting with the
39 one that failed first on the last test run.
42 last_failed
= last_failed_test()
43 other_tests
= reorder_tests(other_tests
, last_failed
)
44 all_tests
= critical_tests
+ other_tests
46 invocation_dir
= os
.getcwd()
47 max_test_name_len
= 10
49 if len(x
) > max_test_name_len
:
50 max_test_name_len
= len(x
)
55 for test
in all_tests
:
57 s
= "%%-%ds :" % max_test_name_len
% test
64 except KeyboardInterrupt:
65 """This allows us to abort the testing manually using Ctrl-C."""
67 except SystemExit as e
:
68 """This is the regular way our test scripts are supposed to report
70 if e
.code
is None or e
.code
== 0:
73 exc_type
, exc_value
, exc_tb
= sys
.exc_info()
75 BoostBuild
.annotation("failure - unhandled exception", "%s - "
76 "%s" % (exc_type
.__name
__, exc_value
))
77 BoostBuild
.annotate_stack_trace(exc_tb
)
79 # Explicitly clear a hard-to-garbage-collect traceback
80 # related reference cycle as per documented sys.exc_info()
88 if failures_count
== 1:
89 f
= open(os
.path
.join(invocation_dir
, "test_results.txt"), "w")
95 # Restore the current directory, which might have been changed by the
97 os
.chdir(invocation_dir
)
104 BoostBuild
.flush_annotations()
110 <test-log library="build" test-name="%s" test-type="run" toolset="%s" test-program="%s" target-directory="%s">
111 <run result="%s">''' % (test
, toolset
, "tools/build/v2/test/" + test
+ ".py",
112 "boost/bin.v2/boost.build.tests/" + toolset
+ "/" + test
, rs
))
114 BoostBuild
.flush_annotations(1)
119 sys
.stdout
.flush() # Makes testing under emacs more entertaining.
120 BoostBuild
.clear_annotations()
122 # Erase the file on success.
123 if failures_count
== 0:
124 open("test_results.txt", "w").close()
131 ''' % (pass_count
, failures_count
))
133 # exit with failure with failures
134 if failures_count
> 0:
137 def last_failed_test():
138 "Returns the name of the last failed test or None."
140 f
= open("test_results.txt")
142 return f
.read().strip()
149 def reorder_tests(tests
, first_test
):
151 n
= tests
.index(first_test
)
152 return [first_test
] + tests
[:n
] + tests
[n
+ 1:]
157 critical_tests
= ["unit_tests", "module_actions", "startup_v2", "core_d12",
158 "core_typecheck", "core_delete_module", "core_language", "core_arguments",
159 "core_varnames", "core_import_module"]
161 # We want to collect debug information about the test site before running any
162 # of the tests, but only when not running the tests interactively. Then the
163 # user can easily run this always-failing test directly to see what it would
164 # have returned and there is no need to have it spoil a possible 'all tests
167 critical_tests
.insert(0, "collect_debug_info")
169 tests
= ["abs_workdir",
183 "builtin_split_by_characters",
188 "cli_property_expansion",
189 "command_line_properties",
195 "conditionals_multiple",
199 "core_action_output",
200 "core_action_status",
201 "core_actions_quietly",
205 "core_syntax_error_exit_status",
206 "core_fail_expected",
209 "core_multifile_actions",
214 "core_parallel_actions",
215 "core_parallel_multifile_actions_1",
216 "core_parallel_multifile_actions_2",
218 "core_source_line_tracking",
220 "core_variables_in_actions",
227 # This test is known to be broken itself.
229 "dependency_property",
241 "feature_implicit_dependency",
243 "feature_suppress_import_lib",
246 "generator_selection",
248 "implicit_dependency",
249 "indirect_conditional",
251 "inherited_dependency",
259 "lib_source_property",
272 # FIXME: Disabled due to bug in B2
273 # "ordered_properties",
281 "project_dependencies",
284 "project_root_constants",
288 "property_expansion",
289 # FIXME: Disabled due lack of qt5 detection
293 "remove_requirement",
297 "scanner_causing_rebuilds",
306 "static_and_shared_library",
314 "toolset_clang_darwin",
315 "toolset_clang_linux",
316 "toolset_clang_vxworks",
320 "toolset_intel_darwin",
322 "toolset_requirements",
332 if os
.name
== "posix":
333 tests
.append("symlink")
334 # On Windows, library order is not important, so skip this test. Besides,
335 # it fails ;-). Further, the test relies on the fact that on Linux, one can
336 # build a shared library with unresolved symbols. This is not true on
337 # Windows, even with cygwin gcc.
339 # Disable this test until we figure how to address failures due to --as-needed being default now.
340 # if "CYGWIN" not in os.uname()[0]:
341 # tests.append("library_order")
343 if toolset
.startswith("gcc") and os
.name
!= "nt":
344 # On Windows it's allowed to have a static runtime with gcc. But this test
345 # assumes otherwise. Hence enable it only when not on Windows.
346 tests
.append("gcc_runtime")
348 if toolset
.startswith("clang") or toolset
.startswith("gcc") or toolset
.startswith("msvc"):
350 if sys
.platform
!= "darwin": # clang-darwin does not yet support
351 tests
.append("feature_force_include")
353 # Clang includes Objective-C driver everywhere, but GCC usually in a separate gobj package
354 if toolset
.startswith("clang") or "darwin" in toolset
:
355 tests
.append("lang_objc")
357 # Disable on OSX as it doesn't seem to work for unknown reasons.
358 if sys
.platform
!= 'darwin':
359 tests
.append("builtin_glob_archive")
361 if "--extras" in sys
.argv
:
362 tests
.append("boostbook")
365 tests
.append("example_qt4")
366 # Requires ./whatever.py to work, so is not guaranteed to work everywhere.
367 tests
.append("example_customization")
368 # Requires gettext tools.
369 tests
.append("example_gettext")
371 print("Note: skipping extra tests")
373 run_tests(critical_tests
, tests
)