Boost logo

Boost-Build :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-04-04 09:27:25


----- Original Message -----
From: "Vladimir Prus" <ghost_at_[hidden]>
To: <jamboost_at_[hidden]>
Sent: Thursday, April 04, 2002 9:14 AM
Subject: Re: [jamboost] Test system

> David Abrahams wrote:
>
> > > > > Nay, this is not what the method does. It actually does
> > > > > rm -rf . && cp -r dir .
> > > > > as you already spelled it, not
> > > > > mkdir /tmp/another_tmp_dir && cp dir /tmp/another_tmp_dir
&&
> >
> > cd
> >
> > > > /tmp/another_tmp_dir
> > > >
> > > > Oh.
> > > >
> > > > rewrite_cwd - replaces the contents of the current
working
> > > > directory with the contents of a specified directory.
> > >
> > > Not yet right -- it rewrites the content of the scracth directory
> >
> > created
> >
> > > when the tester object was created, not the current working dir.
> >
> > Now I'm really confused. You used '.' above, which always refers to
the
> > CWD. You also said that the creation of the tester sets the CWD to
the
> > scratch directory.
>
> Use of "." above was wrong, true. I'll try again.
>
> 1. Tester's constructor creates a scratch directory and chdir there.
> 2. set_tree replaces the content of the scratch directory with the
content of
> some other dir, even if user has called chdir manually before, and
> CWD != scratch dir.

OK, perfectly clear!
However, I would prefer this interface:

class TestDirectory:
__init__(source_path = None):
"""creates a temporary directory and, if
source_path is supplied, copies the directory tree rooted at source_path
to the temporary directory"""

close():

"""deletes the contents of the temp directory if not already
done"""
__del__():
"""deletes the contents of the temp directory if not already
done"""

path():
"""returns the absolute path to the root of the scratch
directory"""

expect_addition(file):
expect_removal(file):
... # as described in your doc

class Tester:

def __init__
# does not create a scratch tree

run_build_system(args, working_dir, ... )
"""runs build system in working_dir..."""

We would need something like this in order to support testing
ALL_LOCATE_TARGET (or whatever the equivalent will be). I realize this
is a big change for you, so please use careful judgement about it. If it
isn't obviously "more right" to you, please say so, and consider
rejecting my suggestion.

-Dave

 


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk