Boost logo

Boost-Build :

Subject: Re: [Boost-build] bpl-test sources list being automatically sorted?
From: Haoyu Bai (divinekid_at_[hidden])
Date: 2009-08-02 03:30:31

On Sat, Jul 25, 2009 at 5:50 PM, Vladimir Prus<ghost_at_[hidden]> wrote:
> On Monday 13 July 2009 Haoyu Bai wrote:
>> Hi,
>> When working on Boost.Python I got a problem with bpl-test, the
>> Boost.Build rule for declaring Boost.Python test case target. In
>> summary, when I call "bjam polymorphism2_auto_ptr" to run the test
>> case, it can run correctly. But when I call "bjam" to run the entire
>> test suite, the test case "polymorphism2_auto_ptr" will be failed
>> because the order of the sources was changed.
>> In detail, I have a test case entry:
>> [ bpl-test polymorphism2_auto_ptr
>>   : polymorphism2_auto_ptr.cpp
>> ]
>> The first file, "", is the file that will be
>> run by the Python interpreter, and the second one ""
>> is a dependency. So "" should be keep as the
>> first one. But when calling with "bjam" to run the entire test sutie,
>> the order of these 3 files is changed. "" will become
>> the first file and cause this test case fail.
>> It seems the sources list get sorted when calling "bjam", but is not
>> when calling "bjam polymorphism2_auto_ptr". So is this a feature or a
>> bug, or something wrong in my Boost.Build usage? How can I avoid the
>> unwanted sort?
> I am unable to reproduce this problem, and code inspection does not
> reveal any place where source would be sorted or otherwise rearranged.
> Can you give me instructions how to reproduce this? If you point me
> at some SVN branches, that's fine, but please make sure this reproduces
> in unmodified state of some revision -- and tell me that revision.
> - Volodya

Hi Volodya,

My BPL py3k SVN branch is located at:

Currently, the SVN HEAD revision which can reproduce this problem is
revision #55360.

Also, I have checked in some debugging code to output the dependencies
list in different stage:

And steps to reproduce this:

$ svn co
$ cd libs/python/test/
$ bjam polymorphism2_auto_ptr # (you don't need to build it with py3k,
any verison of Python is ok)

We will got some debugging output includes:

**passed** ...

Notice that the sequences in the two stages (calling bpl-test rule and
calling rule) are same. Now we call:
(I suggest using "bjam | less" to see the output)

$ bjam

The result will be:



warning: <p.> depends on itself
warning: <p.> depends on itself
...found 2637 targets...
...updating 264 targets...
====== BEGIN OUTPUT ======
Traceback (most recent call last):
  File "../../../bin.v2/libs/python/test/polymorphism2_auto_ptr.test/gcc-4.4.1/debug/",
line 90, in <module>
    from polymorphism2_ext import *
ImportError: No module named polymorphism2_ext
...failed capture-output

You see, the order in the stage (labeled as
"beforerun") is changed, though apparently it is not sorted in
alphabet order because the dummy is still in the middle.
Because the "" is reordered as the first .py file and
being recognized as the main entry point, this test will be failed, as
you see in the output.

I also noticed a strange warning "warning: <p.>
depends on itself". So, I tried to commented out "[ bpl-test
polymorphism2 ]" line in Jamfile.v2, and then, the problem is not
occur anymore! I also tried to move the "[ bpl-test polymorphism2 ]
" line to a position after "polymorphism2_auto_ptr" test case, and no
more fails too. So at least I got a workaround now, but still got the
"warning: <p.> depends on itself".

You might want to review my 2to3 support code for bpl-test: But I think it is
irrelevant to this problem because I can also reproduce this problem
in Boost's trunk branch.

Any ideas? Thank you!

Haoyu Bai
School of Computing,
National University of Singapore.

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at