Boost logo

Boost-Build :

Subject: [Boost-build] Running commands before and after a test target runs
From: Matthew Chambers (matthew.chambers_at_[hidden])
Date: 2010-01-12 14:39:19


Hi Volodya,

I've modified testing.jam so that I can run a command before and after
the test runs. I want the precommand to send its output before the test
runs so that an observer of the output stream can time the test. This
will be limited to -j1 because otherwise the observer would get all
confused as to which output goes with which test. But I'd at least like
the option of doing this. Per your instructions on IRC, I tried a
modified unit-test rule like:

rule unit-test ( target : source : properties * )
{
    if ! [ on $(target) return $(TEST_PRECOMMAND) ]
    {
       TEST_PRECOMMAND_OUTPUT on $(target) = "> $(.NULL)" ;
    }
    if ! [ on $(target) return $(TEST_POSTCOMMAND) ]
    {
       TEST_POSTCOMMAND_OUTPUT on $(target) = "> $(.NULL)" ;
    }
    local name = $(target:G=) ;
    TEST_NAME on $(target) = $(name:B) ;

    announce $(target) : $(source) : $(properties) ;
    unit-test-really $(target) : $(source) : $(properties) ;
}

actions announce
{
    $(.SHELL_SET)name=$(TEST_NAME)
    $(TEST_PRECOMMAND:E=echo) $(TEST_PRECOMMAND_OUTPUT)
}

rule unit-test-really ( target : source : properties * )
{
    run-path-setup $(target) : $(source) : $(properties) ;
}

actions unit-test-really
{
    $(PATH_SETUP)
    $(LAUNCHER) $(>) $(ARGS)
    $(.SET_STATUS)
    if $(.STATUS_0)
      $(.MAKE_FILE) $(<)
    $(.ENDIF)
    $(.SHELL_SET)name=$(TEST_NAME)
    $(TEST_POSTCOMMAND:E=echo) $(TEST_POSTCOMMAND_OUTPUT)
    exit $(.STATUS)
}

But this still aggregates output.

Thanks,
Matt


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