]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/sort_rule.py
3 # Copyright (C) 2008. Jurko Gospodnetic
4 # Distributed under the Boost Software License, Version 1.0.
5 # (See accompanying file LICENSE.txt or copy at
6 # https://www.bfgroup.xyz/b2/LICENSE.txt)
8 # Tests for the Boost Jam builtin SORT rule.
10 from __future__
import print_function
15 ###############################################################################
17 # testSORTCorrectness()
18 # ---------------------
20 ###############################################################################
22 def testSORTCorrectness():
23 """Testing that Boost Jam's SORT builtin rule actually sorts correctly."""
24 t
= BoostBuild
.Tester(["-ftest.jam", "-d1"], pass_toolset
=False,
25 use_test_config
=False)
27 t
.write("test.jam", """\
29 source-data = 1 8 9 2 7 3 4 7 1 27 27 9 98 98 1 1 4 5 6 2 3 4 8 1 -2 -2 0 0 0 ;
30 target-data = -2 -2 0 0 0 1 1 1 1 1 2 2 27 27 3 3 4 4 4 5 6 7 7 8 8 9 9 98 98 ;
32 sorted-data = [ SORT $(source-data) ] ;
34 if $(sorted-data) != $(target-data)
36 ECHO "Source :" $(source-data) ;
37 ECHO "Expected :" $(target-data) ;
38 ECHO "SORT returned:" $(sorted-data) ;
39 EXIT "SORT error" : -2 ;
44 t
.expect_output_lines("starting up")
45 t
.expect_output_lines("done")
46 t
.expect_output_lines("SORT error", False)
51 ###############################################################################
56 ###############################################################################
58 def testSORTDuration():
60 Regression test making sure Boost Jam's SORT builtin rule does not get
61 quadratic behaviour again in this use case.
64 t
= BoostBuild
.Tester(["-ftest.jam", "-d1"], pass_toolset
=False,
65 use_test_config
=False)
67 f
= open(t
.workpath("test.jam"), "w")
68 print("data = ", file=f
)
69 for i
in range(0, 20000):
71 print('"aaa"', file=f
)
73 print('"bbb"', file=f
)
77 sorted = [ SORT $(data) ] ;
83 t
.run_build_system(expected_duration
=1)
84 t
.expect_output_lines("starting up")
85 t
.expect_output_lines("done")
90 ###############################################################################
95 ###############################################################################