I have a DB integration test that I'm running using Boost Build. The test needs some commandline args (DB username, password). What's the best way to set that via Boost Build in a way that's configurable by the user (via environment variables, bjam commandline, user-config.jam)?
I know I can do this with variables:
import os ;
local DB_PASS = [ os.environ DB_PASS ] ;
run dbtest : test.cpp : --dbpass $(DB_PASS) ;
This can be set via a the commandline (bjam -s DB_PASS=pass
) or via an environment variable.
On the other hand, Boost Build tends to do most of its configuration via the feature mechanism. I could probably define a new feature and get the configuration data to the right place that way.
What's the pros and cons of each approach? Which one should I take? If features: how would I do that?
NB: The actual test is within a Jamfile that's used by the Jamroot, so not directly in the root file.
I would just use your suggestion of variables. They provide a great deal of flexibility. I don't see how a "feature" in this case would help things.