summaryrefslogtreecommitdiff
path: root/tools/build/v2/test/testing_support.py
blob: 01a7c4826824423f153c17fc94a45d06c45b6728 (plain)
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
#!/usr/bin/python

# Copyright 2008 Jurko Gospodnetic
# 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)

# Tests different aspects of Boost Builds automated testing support.

import BoostBuild


################################################################################
#
# test_files_with_spaces_in_their_name()
# --------------------------------------
#
################################################################################

def test_files_with_spaces_in_their_name():
    """Regression test making sure test result files get created correctly when
    testing files with spaces in their name.
    """

    t = BoostBuild.Tester(use_test_config=False)

    t.write("valid source.cpp", "int main() {}\n");

    t.write("invalid source.cpp", "this is not valid source code");
    
    t.write("jamroot.jam", """
import testing ;
testing.compile "valid source.cpp" ;
testing.compile-fail "invalid source.cpp" ;
""")

    t.run_build_system(status=0)
    t.expect_addition("bin/invalid source.test/$toolset/debug/invalid source.obj")
    t.expect_addition("bin/invalid source.test/$toolset/debug/invalid source.test")
    t.expect_addition("bin/valid source.test/$toolset/debug/valid source.obj")
    t.expect_addition("bin/valid source.test/$toolset/debug/valid source.test")

    t.expect_content("bin/valid source.test/$toolset/debug/valid source.test", \
        "passed" )
    t.expect_content( \
        "bin/invalid source.test/$toolset/debug/invalid source.test", \
        "passed" )
    t.expect_content( \
        "bin/invalid source.test/$toolset/debug/invalid source.obj", \
        "failed as expected" )

    t.cleanup()


################################################################################
#
# main()
# ------
#
################################################################################

test_files_with_spaces_in_their_name()