[predef] Announce: Build time configuration for Predef defs.
Following on the concept by Peter Dimov of using the BBv2 config feature combined with tests I'm pleased to announce that Predef now has a similar feature. In the develop branch of Predef you can now do the following: import ../libs/predef/check/predef : require : predef-require ; run macos_only_test.cpp : : : [ predef-require "BOOST_OS_MACOS" ] ; run vc15_only_test.cpp : : : [ predef-require "BOOST_COMP_MSVC >= 15.0.0" ] ; The expression(s) to check can use any of the definitions that Predef has. The general for is: "<DEF> <OP> <VERSION>". Where <OP> is any of the usual C/C++ relational operators. And <VERSION> is a partial or complete triplet of integers. You can specify multiple checked expressions that are all required. Also part of this is a more general "check" rule that allows for custom build requirements. For example: import ../libs/predef/check/predef : require check : predef-require predef-check ; run macos_only_test.cpp : : : [ predef-require "BOOST_OS_MACOS" ] ; run vc15_only_test.cpp : : : [ predef-check "BOOST_COMP_MSVC >= 15.0.0" : <define>THIS_IS_MSVC : <build>no ] ; I'll put this into master as soon as I have appropriate documentation. Enjoy. -- -- Rene Rivera -- Grafik - Don't Assume Anything -- Robot Dreams - http://robot-dreams.net -- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail
On 1/27/2015 4:29 PM, Rene Rivera wrote:
Following on the concept by Peter Dimov of using the BBv2 config feature combined with tests I'm pleased to announce that Predef now has a similar feature.
In the develop branch of Predef you can now do the following:
import ../libs/predef/check/predef : require : predef-require ; run macos_only_test.cpp : : : [ predef-require "BOOST_OS_MACOS" ] ; run vc15_only_test.cpp : : : [ predef-require "BOOST_COMP_MSVC >= 15.0.0" ] ;
The expression(s) to check can use any of the definitions that Predef has. The general for is: "<DEF> <OP> <VERSION>". Where <OP> is any of the usual C/C++ relational operators. And <VERSION> is a partial or complete triplet of integers. You can specify multiple checked expressions that are all required. Also part of this is a more general "check" rule that allows for custom build requirements. For example:
import ../libs/predef/check/predef : require check : predef-require predef-check ; run macos_only_test.cpp : : : [ predef-require "BOOST_OS_MACOS" ] ; run vc15_only_test.cpp : : : [ predef-check "BOOST_COMP_MSVC >= 15.0.0" : <define>THIS_IS_MSVC : <build>no ] ;
I'll put this into master as soon as I have appropriate documentation.
Enjoy.
Excellent and thank you ! Now we have yet another way of specifying which tests can be run for what environments. With John Maddock's improvements with configuration targets, Peter Dimov's suggestions regarding features.subfeatures, and your current improvements using Predef to choose a particular environment, we now have many more options for configuring Boost Build tests.
On Tue, Jan 27, 2015 at 5:47 PM, Edward Diener
On 1/27/2015 4:29 PM, Rene Rivera wrote:
Following on the concept by Peter Dimov of using the BBv2 config feature combined with tests I'm pleased to announce that Predef now has a similar feature.
In the develop branch of Predef you can now do the following:
import ../libs/predef/check/predef : require : predef-require ; run macos_only_test.cpp : : : [ predef-require "BOOST_OS_MACOS" ] ; run vc15_only_test.cpp : : : [ predef-require "BOOST_COMP_MSVC >= 15.0.0" ] ;
The expression(s) to check can use any of the definitions that Predef has. The general for is: "<DEF> <OP> <VERSION>". Where <OP> is any of the usual C/C++ relational operators. And <VERSION> is a partial or complete triplet of integers. You can specify multiple checked expressions that are all required. Also part of this is a more general "check" rule that allows for custom build requirements. For example:
import ../libs/predef/check/predef : require check : predef-require predef-check ; run macos_only_test.cpp : : : [ predef-require "BOOST_OS_MACOS" ] ; run vc15_only_test.cpp : : : [ predef-check "BOOST_COMP_MSVC >= 15.0.0" : <define>THIS_IS_MSVC : <build>no ] ;
I'll put this into master as soon as I have appropriate documentation.
Enjoy.
Excellent and thank you !
You are welcome!
Now we have yet another way of specifying which tests can be run for what environments. With John Maddock's improvements with configuration targets, Peter Dimov's suggestions regarding features.subfeatures, and your current improvements using Predef to choose a particular environment, we now have many more options for configuring Boost Build tests.
I think we are the point now that we can now replace the explicit markup. With a setup that can do considerably more. I'm also thinking of more additions to Boost Build itself (I used one of them to implement the Predef support) that could be used to further of my goal of improving the testing system. So if people have suggestions I'd love to hear them. PS. And yes, I'm already aware of the desire for master/develop split testing. We'll get there eventually. -- -- Rene Rivera -- Grafik - Don't Assume Anything -- Robot Dreams - http://robot-dreams.net -- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail
On Tue, Jan 27, 2015 at 3:29 PM, Rene Rivera
Following on the concept by Peter Dimov of using the BBv2 config feature combined with tests I'm pleased to announce that Predef now has a similar feature.
And of course I totally forgot to mention John's work. Sorry about that John :-( -- -- Rene Rivera -- Grafik - Don't Assume Anything -- Robot Dreams - http://robot-dreams.net -- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail
Rene Rivera wrote:
On Tue, Jan 27, 2015 at 3:29 PM, Rene Rivera
wrote: Following on the concept by Peter Dimov of using the BBv2 config feature combined with tests I'm pleased to announce that Predef now has a similar feature.
And of course I totally forgot to mention John's work. Sorry about that John :-(
I wondered why you were giving me credit since I've done basically nothing at all. :-) Regarding predef-require, is it possible to combine several conditions using and/or? I see that you've said
You can specify multiple checked expressions that are all required.
which probably means "and" (predef-require probably returns <build>no when the condition doesn't hold, so I see how it can be repeated). But what if I want to run a test on MSVC and GCC? predef-require BOOST_COMP_MSVC _or_ BOOST_COMP_GCC?
Regarding predef-require, is it possible to combine several conditions using and/or? I see that you've said
You can specify multiple checked expressions that are all required.
which probably means "and" (predef-require probably returns <build>no when the condition doesn't hold, so I see how it can be repeated).
Looking at the code, I see that what you meant was [ predef-require "BOOST_COMP_MSVC <= 15.0.0 BOOST_COMP_MSVC >= 12.0.0" ] that is, multiple expressions can be specified in the string itself, and all of them need to hold. Not, as I thought, [ predef-require "BOOST_COMP_MSVC <= 15.0.0" ] [ predef-require BOOST_COMP_MSVC >= 12.0.0" ] although this should also work, I think. But there seems to be no way to specify logical or. Although it could probably be done by duplicating the run rule. run msvc-or-gcc-test.cpp : : : [ predef-require "BOOST_COMP_MSVC" ] ; run msvc-or-gcc-test.cpp : : : [ predef-require "BOOST_COMP_GCC" ] ; If you're taking (feature &~ pull) requests, I would venture that it would be more intuitive if it supported [ predef-require "BOOST_COMP_MSVC <= 15.0.0 && BOOST_COMP_MSVC >= 12.0.0" ] and [ predef-require "BOOST_COMP_MSVC || BOOST_COMP_GCC" ] though :-)
On Wed, Jan 28, 2015 at 5:26 AM, Peter Dimov
Regarding predef-require, is it possible to combine several conditions
using and/or? I see that you've said
You can specify multiple checked expressions that are all required.
which probably means "and" (predef-require probably returns <build>no when the condition doesn't hold, so I see how it can be repeated).
Looking at the code, I see that what you meant was
[ predef-require "BOOST_COMP_MSVC <= 15.0.0 BOOST_COMP_MSVC >= 12.0.0" ]
that is, multiple expressions can be specified in the string itself, and all of them need to hold.
Actually it would be "multiple expressions can be specified as individual string arguments".. [ predef-require "BOOST_COMP_MSVC <= 15.0.0" "BOOST_COMP_MSVC >= 12.0.0" ]
Not, as I thought,
[ predef-require "BOOST_COMP_MSVC <= 15.0.0" ] [ predef-require BOOST_COMP_MSVC >= 12.0.0" ]
although this should also work, I think.
Yes it will also work. But there seems to be no way to specify logical or. Correct.
Although it could probably be done by duplicating the run rule.
run msvc-or-gcc-test.cpp : : : [ predef-require "BOOST_COMP_MSVC" ] ; run msvc-or-gcc-test.cpp : : : [ predef-require "BOOST_COMP_GCC" ] ;
I don't think so.. As it would create to duplicate target names and BBv2 would complain about that. If you're taking (feature &~ pull) requests, I would venture that it would
be more intuitive if it supported
[ predef-require "BOOST_COMP_MSVC <= 15.0.0 && BOOST_COMP_MSVC >= 12.0.0" ]
[ predef-require "BOOST_COMP_MSVC <= 15.0.0" && "BOOST_COMP_MSVC >= 12.0.0" ] and
[ predef-require "BOOST_COMP_MSVC || BOOST_COMP_GCC" ]
[ predef-require BOOST_COMP_MSVC || BOOST_COMP_GCC ] Subtle change on that one :-) though :-) Well.. I actually considered doing logical composition also. But it has one drawback. Currently each individual expression is cached so that the result can be reused across all targets that use it. For example: "BOOST_COMP_MSVC <= 15.0.0" and "BOOST_COMP_MSVC >= 12.0.0" could each be used dozens of times. But only two config checks would be done (and cached for future invocations). Supporting logical-or would mean that each full expression would be considered. Having said that.. I'm willing to add more complex expression support if there's enough demand :-) -- -- Rene Rivera -- Grafik - Don't Assume Anything -- Robot Dreams - http://robot-dreams.net -- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail
Rene Rivera wrote:
Actually it would be "multiple expressions can be specified as individual string arguments"..
[ predef-require "BOOST_COMP_MSVC <= 15.0.0" "BOOST_COMP_MSVC >= 12.0.0" ]
Right, I misinterpreted your code.
Having said that.. I'm willing to add more complex expression support if there's enough demand :-)
To replace the explicit failures markup, we need a way to say "do not run this test on gcc-4.4, gcc-4.5, gcc-4.6, msvc-8.0, msvc-10.0", and it seems that we're either going to need logical operations for that, or a rule that is the opposite of predef-require, something like [ predef-disable-if "BOOST_COMP_GCC == 4.4" "BOOST_COMP_GCC == 4.5" "BOOST_COMP_GCC == 4.6" "BOOST_COMP_MSVC == x.0" "BOOST_COMP_MSVC == y.0" ] where x is whatever corresponds to msvc-8.0 and y - to msvc-10.0 :-)
On Wed, Jan 28, 2015 at 10:19 AM, Peter Dimov
Rene Rivera wrote:
Actually it would be "multiple expressions can be specified as individual string arguments"..
[ predef-require "BOOST_COMP_MSVC <= 15.0.0" "BOOST_COMP_MSVC >= 12.0.0" ]
Right, I misinterpreted your code.
Having said that.. I'm willing to add more complex expression support if
there's enough demand :-)
To replace the explicit failures markup, we need a way to say "do not run this test on gcc-4.4, gcc-4.5, gcc-4.6, msvc-8.0, msvc-10.0", and it seems that we're either going to need logical operations for that, or a rule that is the opposite of predef-require, something like
[ predef-disable-if "BOOST_COMP_GCC == 4.4" "BOOST_COMP_GCC == 4.5" "BOOST_COMP_GCC == 4.6" "BOOST_COMP_MSVC == x.0" "BOOST_COMP_MSVC == y.0" ]
where x is whatever corresponds to msvc-8.0 and y - to msvc-10.0 :-)
There's a check rule that you can use to customize the results: rule check ( expressions + : language ? : true-properties * : false-properties * ) But to get what you want you just need to convert the logical expression to: [ predef-resuire "BOOST_COMP_GCC != 4.4" "BOOST_COMP_GCC != 4.5" "BOOST_COMP_GCC != 4.6" "BOOST_COMP_MSVC != x.0" "BOOST_COMP_MSVC != y.0" ] HTH -- -- Rene Rivera -- Grafik - Don't Assume Anything -- Robot Dreams - http://robot-dreams.net -- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail
Rene Rivera wrote:
But to get what you want you just need to convert the logical expression to:
[ predef-require "BOOST_COMP_GCC != 4.4" "BOOST_COMP_GCC != 4.5" "BOOST_COMP_GCC != 4.6" "BOOST_COMP_MSVC != x.0" "BOOST_COMP_MSVC != y.0" ]
De Morgan to the rescue! But I'm not sure even he can solve everything. What if I want to disable the test for all gcc <= 4.6 and for all msvc <= 10.0, which is actually the more common case? [ predef-check "BOOST_COMP_GCC <= 4.6" "BOOST_COMP_MSVC <= y.0" : : <build>no ], I suppose.
AMDG On 01/28/2015 08:52 AM, Rene Rivera wrote:
On Wed, Jan 28, 2015 at 5:26 AM, Peter Dimov
wrote: [ predef-require "BOOST_COMP_MSVC <= 15.0.0 && BOOST_COMP_MSVC >= 12.0.0" ]
[ predef-require "BOOST_COMP_MSVC <= 15.0.0" && "BOOST_COMP_MSVC >= 12.0.0" ]
and
[ predef-require "BOOST_COMP_MSVC || BOOST_COMP_GCC" ]
[ predef-require BOOST_COMP_MSVC || BOOST_COMP_GCC ]
Subtle change on that one :-)
though :-)
&& and || are Jam keywords. In Christ, Steven Watanabe
On Wed, Jan 28, 2015 at 3:33 PM, Steven Watanabe
AMDG
On 01/28/2015 08:52 AM, Rene Rivera wrote:
On Wed, Jan 28, 2015 at 5:26 AM, Peter Dimov
wrote: [ predef-require "BOOST_COMP_MSVC <= 15.0.0 && BOOST_COMP_MSVC >= 12.0.0" ]
[ predef-require "BOOST_COMP_MSVC <= 15.0.0" && "BOOST_COMP_MSVC >= 12.0.0" ]
and
[ predef-require "BOOST_COMP_MSVC || BOOST_COMP_GCC" ]
[ predef-require BOOST_COMP_MSVC || BOOST_COMP_GCC ]
Subtle change on that one :-)
though :-)
&& and || are Jam keywords.
Yeah.. If I implemented this I would rather use "and' and "or". -- -- Rene Rivera -- Grafik - Don't Assume Anything -- Robot Dreams - http://robot-dreams.net -- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail
OK, here's the doc for this feature < https://rawgit.com/boostorg/predef/develop/doc/html/predef/check_utilities.h...
.
And.. I think I figured out a way to implement and/or without the drawback I mentioned earlier. Not implementing that now though. -- -- Rene Rivera -- Grafik - Don't Assume Anything -- Robot Dreams - http://robot-dreams.net -- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail
participants (4)
-
Edward Diener
-
Peter Dimov
-
Rene Rivera
-
Steven Watanabe