Boost logo

Boost-Build :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-01-10 18:55:27


----- Original Message -----
From: "peter_nordlundse" <peter.l.nordlund_at_[hidden]>
To: <jamboost_at_[hidden]>
Sent: Thursday, January 10, 2002 6:43 PM
Subject: [jamboost] Newbie question (on unit-test suite)

> Hi all,
>
> Here comes a newbie question:
>
> I am trying to put together a Jamfile ...
>
> If I run a target
> unit-test mtest2 ;
>
> I get the following output:
> ...
> Run
>
/work1/pkg/c++/boost/1.26.0/boost/../install/libs/mystuff/test/bin/mtest2/gc
c/debug/runtime-link-dynamic/mtest2
> ...
>
> Next I try to write some other jam-rules and then
> I manage to produce a variable that contains:
> <libs!mystuff!test/mtest2/gcc/debug/runtime-link-dynamic>mtest2
>
> I now gess that it is possible to convert this value to the first
> path that was output during the unit-test somehow, that is:
>
/work1/pkg/c++/boost/1.26.0/boost/../install/libs/mystuff/test/bin/mtest2/gc
c/debug/runtime-link-dynamic/mtest2
>
> How do I do that?

try $(gLOCATE($(target-name)))

where in this case,

target-name =
<libs!mystuff!test/mtest2/gcc/debug/runtime-link-dynamic>mtest2

BTW, unit-test is not the best rule to use, since it deletes the executable
if the test returns a nonzero exit code. You might consider hijacking some
of the rules in status/Jamfile. Joerg (I think) has accepted the challenge
of factoring them into a separate .jam file and rewriting unit-test to
dispatch to them.

> Maybe I should also explain my original problem:
>
> I have 13 test-programs, that I want to run in a shellscript,
> some of them with different input arguments.
>
> With a bad compiler maybe not all test-programs will compile,
> so the test suite must handle the case where a few test-programs
> are missing.
> My idea is to just let the summary of the tests show how many
> of the tests that actually were run, thus showing if the compilation
> succeded.
>
>
> I have followed the directory layout of boost/libs/python
> for where I located my test directory and the rest of my code.
>
> My plan is to redirect the output from the tests to file,
> next I compare the output
> with expected output that is located in files.
> (I should now have 1 log-file and 1 expected-file per test).
> There is at least 1 reason for running the tests in a shellscript,
> instead of just relying on the unit-test target:
> I want to sum up the number of performed tests and the
> number of tests that passed and print the summary to stdout.
> Depending on the counts I output different messages.

You could just run a shell script which does the comparison and prints the
result as the final build action.

> Below is how the output looked before I started to try to
> convert my stuff to using a boost Jamfile instad of my old
> Makefile ...
>
> Compiled files with flags:"-I. -Wall -ansi -pedantic -fstrict-aliasing"
> ./test.sh: -------------------------------------
> ./test.sh: Starting test:Mon Mar 27 12:46:53 2000
> ./test.sh: Test 1 OK, command:mtest
> ./test.sh: Test 2 OK, command:mtest 2
> ./test.sh: Test 3 OK, command:mtest 2 3
> ./test.sh: Test 4 OK, command:mtest 2 3 4
> ./test.sh: Test 5 OK, command:mtest 2 3 4 5
> ./test.sh: Test 6 OK, command:nmtest
> ./test.sh: Test 7 OK, command:smtest
> ./test.sh: Test 8 OK, command:dmtest
> ./test.sh: Test 9 OK, command:sdmtest
> ./test.sh: Test 10 OK, command:nmtest 2
> ./test.sh: Test 11 OK, command:smtest 2
> ./test.sh: Test 12 OK, command:dmtest 2
> ./test.sh: Test 13 OK, command:sdmtest 2
> ./test.sh: Test 14 OK, command:bad1test
> ./test.sh: Test 15 OK, command:bad1test 2
> ./test.sh: Test 16 OK, command:bad2test
> ./test.sh: Test 17 OK, command:pmtest persistentstore
> ./test.sh: Test 18 OK, command:pmtest persistentstore
> ./test.sh: Test 19 OK, command:pmtest persistentstore
> ./test.sh: Test 20 OK, command:pmtest persistentstore
> ./test.sh: Test 21 OK, command:nmnttest
> ./test.sh: Test 22 OK, command:nmnttest 2
> ./test.sh: Test summary:------------------------
> ./test.sh: 22 out of 22 tests were performed.
> ./test.sh: ********* All tests passed! *********
> ./test.sh: -------------------------------------
>
>
> My plan is now to get hold of all paths to the excutable test-programs
> and use them as input arguments to my shellscript.
> If you think this idea is stupid, do you have any better suggestion?

It's not stupid; there are lots of possible approaches, and it's hard to say
which one is best for you.

> By the way, do you know of any over-commented easy-to-understand
> Jamfile-examples? I have not found any, when browsing around
> the Boost and Perforce Jam docs.

look at status/Jamfile. It's got pretty good comments, and quite a few
sophisticated rules, too.

-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