1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
#
# 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 ;
feature.feature <quickbook-test-define> : : free ;
feature.feature <quickbook-test-include> : : free path ;
feature.feature <quickbook-xinclude-base> : : free ;
type.register QUICKBOOK_INPUT : quickbook ;
type.register QUICKBOOK_OUTPUT ;
type.register QUICKBOOK_HTML_OUTPUT ;
generators.register-standard quickbook-testing.process-quickbook : QUICKBOOK_INPUT : QUICKBOOK_OUTPUT ;
generators.register-standard quickbook-testing.process-quickbook-html : QUICKBOOK_INPUT : QUICKBOOK_HTML_OUTPUT ;
################################################################################
#
# 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) ;
reference-output-html = $(input:S=.gold-html) ;
local project = [ project.current ] ;
local boost-root = [ modules.peek : BOOST_ROOT ] ;
local t1 =
[ targets.create-typed-target QUICKBOOK_OUTPUT
: $(project)
: $(target-name).boostbook
: $(input)
: $(requirements)
<location-prefix>$(target-name).test
<quickbook-testing.quickbook-command>$(boost-root)/tools/quickbook/src//quickbook
] ;
local t2 =
[ targets.create-typed-target RUN
: $(project)
: $(target-name)
: $(boost-root)/tools/quickbook/test/src/text_diff.cpp
: $(requirements)
<location-prefix>$(target-name).test2
<testing.input-file>$(reference-output)
<testing.input-file>$(target-name).boostbook
<preserve-test-targets>on
] ;
local t1-html =
[ targets.create-typed-target QUICKBOOK_HTML_OUTPUT
: $(project)
: $(target-name).html
: $(input)
: $(requirements)
<location-prefix>$(target-name).test-html
<quickbook-testing.quickbook-command>$(boost-root)/tools/quickbook/src//quickbook
] ;
local t2-html =
[ targets.create-typed-target RUN
: $(project)
: $(target-name)-compare-html
: $(boost-root)/tools/quickbook/test/src/text_diff.cpp
: $(requirements)
<location-prefix>$(target-name).test-html
<testing.input-file>$(reference-output-html)
<testing.input-file>$(target-name).html
<preserve-test-targets>on
] ;
local all-tests = [ modules.peek testing : .all-tests ] ;
all-tests += $(t2) $(t2-html) ;
modules.poke testing : .all-tests : $(all-tests) ;
return $(t1) $(t2) $(t1-html) $(t2-html) ;
}
rule quickbook-fail-test ( target-name : input ? : requirements * )
{
input ?= $(target-name).quickbook ;
local project = [ project.current ] ;
local boost-root = [ modules.peek : BOOST_ROOT ] ;
local t =
[ targets.create-typed-target RUN_FAIL
: $(project)
: $(target-name)
: $(boost-root)/tools/quickbook/src//quickbook
: $(requirements)
<testing.input-file>$(input)
<preserve-test-targets>on
<dependency>$(input)
]
;
local all-tests = [ modules.peek testing : .all-tests ] ;
all-tests += $(t) ;
modules.poke testing : .all-tests : $(all-tests) ;
return $(t) ;
}
rule quickbook-error-test ( target-name : input ? : requirements * )
{
input ?= $(target-name).quickbook ;
local project = [ project.current ] ;
local boost-root = [ modules.peek : BOOST_ROOT ] ;
local t =
[ targets.create-typed-target RUN
: $(project)
: $(target-name)
: $(boost-root)/tools/quickbook/src//quickbook
: $(requirements)
<testing.input-file>$(input)
<testing.arg>--expect-errors
<preserve-test-targets>on
<dependency>$(input)
]
;
local all-tests = [ modules.peek testing : .all-tests ] ;
all-tests += $(t) ;
modules.poke testing : .all-tests : $(all-tests) ;
return $(t) ;
}
################################################################################
toolset.flags quickbook-testing.process-quickbook quickbook-command <quickbook-testing.quickbook-command> ;
toolset.flags quickbook-testing.process-quickbook QB-DEFINES <quickbook-test-define> ;
toolset.flags quickbook-testing.process-quickbook XINCLUDE <quickbook-xinclude-base> ;
toolset.flags quickbook-testing.process-quickbook INCLUDES <quickbook-test-include> ;
toolset.flags quickbook-testing.process-quickbook-html quickbook-command <quickbook-testing.quickbook-command> ;
toolset.flags quickbook-testing.process-quickbook-html QB-DEFINES <quickbook-test-define> ;
toolset.flags quickbook-testing.process-quickbook-html XINCLUDE <quickbook-xinclude-base> ;
toolset.flags quickbook-testing.process-quickbook-html INCLUDES <quickbook-test-include> ;
rule process-quickbook ( target : source : properties * )
{
DEPENDS $(target) : [ on $(target) return $(quickbook-command) ] ;
}
actions process-quickbook bind quickbook-command
{
$(quickbook-command) $(>) --output-file=$(<) --debug -D"$(QB-DEFINES)" -I"$(INCLUDES)" --xinclude-base="$(XINCLUDE)"
}
rule process-quickbook-html ( target : source : properties * )
{
DEPENDS $(target) : [ on $(target) return $(quickbook-command) ] ;
}
actions process-quickbook-html bind quickbook-command
{
$(quickbook-command) $(>) --output-format=onehtml --output-file=$(<) --debug -D"$(QB-DEFINES)" -I"$(INCLUDES)" --xinclude-base="$(XINCLUDE)"
}
|