Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/tools/build/v2/test/test_all.py @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

File size: 4.3 KB
Line 
1#!/usr/bin/python
2import os, sys, string
3from BoostBuild import get_toolset
4
5# clear environment for testing
6#
7for s in (
8    'BOOST_ROOT','BOOST_BUILD_PATH','JAM_TOOLSET','BCCROOT',
9    'MSVCDir','MSVC','MSVCNT','MINGW','watcom'
10    ):
11   
12    try:
13        del os.environ[s]
14    except:
15        pass
16
17def run_tests(critical_tests, other_tests):
18    """Runs first critical tests and then other_tests.
19
20       Stops on first error, and write the name of failed test to
21       test_results.txt. Critical tests are run in the specified order,
22       other tests are run starting with the one that failed the last time.
23    """
24    last_failed = last_failed_test()
25    other_tests = reorder_tests(other_tests, last_failed)
26    all_tests = critical_tests + other_tests
27
28    invocation_dir = os.getcwd()
29
30    failures_count = 0
31    for i in all_tests:
32        print ("%-25s : " %(i)),
33        try:
34            __import__(i)
35        except SystemExit:
36            print "FAILED"
37            if failures_count == 0:
38                f = open(os.path.join(invocation_dir, 'test_results.txt'), 'w')
39                f.write(i)
40                f.close()
41            failures_count = failures_count + 1
42            # Restore the current directory, which might be changed by the
43            # test
44            os.chdir(invocation_dir)
45            continue
46        print "PASSED"
47        sys.stdout.flush()  # makes testing under emacs more entertaining.
48       
49    # Erase the file on success
50    if failures_count == 0:
51        open('test_results.txt', 'w')
52       
53
54def last_failed_test():
55    "Returns the name of last failed test or None"
56    try:
57        f = open("test_results.txt")
58        s = string.strip(f.read())
59        return s
60    except:
61        return None
62
63def reorder_tests(tests, first_test):
64    try:
65        n = tests.index(first_test)
66        return [first_test] + tests[:n] + tests[n+1:]
67    except ValueError:
68        return tests
69
70           
71critical_tests = ["unit_tests", "module_actions", "startup_v1", "startup_v2"]
72
73critical_tests += ["core_d12", "core_typecheck", "core_delete_module",
74                   "core_varnames", "core_import_module"]
75
76tests = [ "rebuilds",
77          "timedata",
78          "project_test3",
79          "project_test4",
80          "generators_test",
81          "dependency_test",
82          "path_features",
83          "relative_sources",
84          "no_type",
85          "chain",
86          "default_build",
87          "use_requirements",
88          "conditionals",
89          "stage",
90          "prebuilt",
91          "project_dependencies",
92          "build_dir",
93          "searched_lib",
94          "make_rule",
95          "alias",
96          "alternatives",
97          "default_features",
98          "print",
99          "ndebug",
100          "explicit",
101          "absolute_sources",
102          "dependency_property",
103          "custom_generator",
104          "bad_dirname",
105          "c_file",
106          "inline",
107          "conditionals2",
108          "property_expansion",
109          "loop",
110          "conditionals3",
111          "tag",
112          "suffix",
113          "inherit_toolset",
114          "skipping",
115          "glob",
116          "project_root_constants",
117          "double_loading",
118          "dll_path",
119          "regression",
120          "composite",
121          "library_chain",
122          "unit_test",
123          "standalone",
124          "expansion",
125          "wrapper",
126          "duplicate",
127          "library_property",
128          "load_order",
129          "wrong_project",
130          "using",
131          "source_locations",
132          "out_of_tree",
133          "notfile",
134          ]
135
136if os.name == 'posix':
137    tests.append("symlink")
138    # On windows, library order is not important, so skip this test
139    # Besides, it fails ;-)
140    # Further, the test relies on the fact that on Linux, one
141    # can build a shared library with unresolved symbols. This is
142    # not true on Windows (even with cygwin gcc).
143    if string.find(os.uname()[0], "CYGWIN") == -1:
144        tests.append("library_order")
145
146if string.find(get_toolset(), 'gcc') == 0:
147    tests.append("gcc_runtime")
148
149if os.environ.has_key('QTDIR'):
150    tests.append("railsys")
151else:
152    print 'skipping railsys test since QTDIR environment variable is unset'
153
154if "--extras" in sys.argv:
155    tests.append("boostbook")
156else:
157    print 'Note: skipping extra tests'
158
159run_tests(critical_tests, tests)
Note: See TracBrowser for help on using the repository browser.