diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/boost/tools/quickbook/test/quickbook-testing.jam | |
parent | Initial commit. (diff) | |
download | ceph-upstream/18.2.2.tar.xz ceph-upstream/18.2.2.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/boost/tools/quickbook/test/quickbook-testing.jam | 185 |
1 files changed, 185 insertions, 0 deletions
diff --git a/src/boost/tools/quickbook/test/quickbook-testing.jam b/src/boost/tools/quickbook/test/quickbook-testing.jam new file mode 100644 index 000000000..a4529497c --- /dev/null +++ b/src/boost/tools/quickbook/test/quickbook-testing.jam @@ -0,0 +1,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)" +} |