Boost logo

Boost-Build :

From: Joel de Guzman (joel_at_[hidden])
Date: 2006-12-20 18:15:10


Joel de Guzman wrote:

[snip]

Hmm... Maybe I'm not clear enough. Let me explain.

Quickbook has a regression testing facility in tools/quickbook/test.
There's a bjam file there that is set to compile text_diff.cpp into
text_diff.exe. This tool is used to check the output of quickbook
against a set of files that are known to be ok. There are a couple
of quickbook files on which this compare tool is run to test for errors.

Everything was running ok before, but recently, our testing facility has
been broken. It seems that text_diff.exe is being erased after the first
test case. Is there anything we can do to fix this problem? Our
temporary fix is to comment out "targets-to-remove = $(source) ;"
in build/v2/tools/testing.jam line 375. Is there a better way?

Here's what the bjam file contains:

import quickbook-testing : quickbook-test ;

test-suite quickbook.test :
     [ quickbook-test quickbook-manual ]
     [ quickbook-test code-block-1 ]
     [ quickbook-test code-block-2 ]
     [ quickbook-test code-snippet ]
     [ quickbook-test preformatted ]
     [ quickbook-test link-side-by-side ]
     [ quickbook-test escape ]
     [ quickbook-test templates ]
     [ quickbook-test xinclude ]
     [ quickbook-test import ]
     ;

I'm attaching quickbook-testing.jam.

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

#
# Copyright (c) 2005 João Abecasis
#
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#

import feature ;
import generators ;
import modules ;
import project ;
import targets ;
import testing ;
import toolset ;
import type ;

feature.feature quickbook-testing.quickbook-command : : free dependency ;

type.register QUICKBOOK_INPUT : quickbook ;
type.register QUICKBOOK_OUTPUT ;

generators.register-standard quickbook-testing.process-quickbook : QUICKBOOK_INPUT : QUICKBOOK_OUTPUT ;

################################################################################
exe line-compare-tool : src/text_diff.cpp ;

#
# quickbook-test - generates a test for quickbook itself. A quickbook-test is
# actually made up of two tests:
# $(target-name).boostbook :
# generate boostbook from $(input) or $(target-name).quickbook
#
# $(target-name):
# compare generated boostbook to $(reference-output) or
# $(input).gold or $(target-name).gold
#
rule quickbook-test ( target-name : input ? : reference-output ? : requirements * )
{
    input ?= $(target-name).quickbook ;
    reference-output ?= $(input:S=.gold) ;

    local project = [ project.current ] ;

    local t =
        [ targets.create-typed-target QUICKBOOK_OUTPUT
            : $(project)
            : $(target-name).boostbook
            : $(input)
            : $(requirements)
                <location-prefix>$(target-name).test
                <quickbook-testing.quickbook-command>..//quickbook
        ]

        [ targets.create-typed-target RUN
            : $(project)
            : $(target-name)
            : .//line-compare-tool
            : $(requirements)
                <location-prefix>$(target-name).test
                <testing.input-file>$(reference-output)
                <testing.input-file>$(target-name).boostbook
        ]
        ;

    modules.poke testing : .all-tests : \$\(all-tests\) $(t) ;

    return $(t) ;
}

################################################################################
toolset.flags quickbook-testing.process-quickbook quickbook-command <quickbook-testing.quickbook-command> ;
rule process-quickbook ( target : source : properties * )
{
    DEPENDS $(target) : [ on $(target) return $(quickbook-command) ] ;
}

actions process-quickbook bind quickbook-command
{
    $(quickbook-command) $(>) --output-file=$(<) --debug
}


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