| [29] | 1 | # |
|---|
| 2 | # Copyright (c) 2005 João Abecasis |
|---|
| 3 | # |
|---|
| 4 | # Distributed under the Boost Software License, Version 1.0. (See |
|---|
| 5 | # accompanying file LICENSE_1_0.txt or copy at |
|---|
| 6 | # http://www.boost.org/LICENSE_1_0.txt) |
|---|
| 7 | # |
|---|
| 8 | |
|---|
| 9 | import feature ; |
|---|
| 10 | import generators ; |
|---|
| 11 | import modules ; |
|---|
| 12 | import project ; |
|---|
| 13 | import targets ; |
|---|
| 14 | import testing ; |
|---|
| 15 | import toolset ; |
|---|
| 16 | import type ; |
|---|
| 17 | |
|---|
| 18 | feature.feature quickbook-testing.quickbook-command : : free dependency ; |
|---|
| 19 | |
|---|
| 20 | type.register QUICKBOOK_INPUT : quickbook ; |
|---|
| 21 | type.register QUICKBOOK_OUTPUT ; |
|---|
| 22 | |
|---|
| 23 | generators.register-standard quickbook-testing.process-quickbook : QUICKBOOK_INPUT : QUICKBOOK_OUTPUT ; |
|---|
| 24 | |
|---|
| 25 | ################################################################################ |
|---|
| 26 | exe line-compare-tool : src/text_diff.cpp ; |
|---|
| 27 | |
|---|
| 28 | # |
|---|
| 29 | # quickbook-test - generates a test for quickbook itself. A quickbook-test is |
|---|
| 30 | # actually made up of two tests: |
|---|
| 31 | # $(target-name).boostbook : |
|---|
| 32 | # generate boostbook from $(input) or $(target-name).quickbook |
|---|
| 33 | # |
|---|
| 34 | # $(target-name): |
|---|
| 35 | # compare generated boostbook to $(reference-output) or |
|---|
| 36 | # $(input).gold or $(target-name).gold |
|---|
| 37 | # |
|---|
| 38 | rule quickbook-test ( target-name : input ? : reference-output ? : requirements * ) |
|---|
| 39 | { |
|---|
| 40 | input ?= $(target-name).quickbook ; |
|---|
| 41 | reference-output ?= $(input:S=.gold) ; |
|---|
| 42 | |
|---|
| 43 | local project = [ project.current ] ; |
|---|
| 44 | |
|---|
| 45 | local t = |
|---|
| 46 | [ targets.create-typed-target QUICKBOOK_OUTPUT |
|---|
| 47 | : $(project) |
|---|
| 48 | : $(target-name).boostbook |
|---|
| 49 | : $(input) |
|---|
| 50 | : $(requirements) |
|---|
| 51 | <location-prefix>$(target-name).test |
|---|
| 52 | <quickbook-testing.quickbook-command>..//quickbook |
|---|
| 53 | ] |
|---|
| 54 | |
|---|
| 55 | [ targets.create-typed-target RUN |
|---|
| 56 | : $(project) |
|---|
| 57 | : $(target-name) |
|---|
| 58 | : .//line-compare-tool |
|---|
| 59 | : $(requirements) |
|---|
| 60 | <location-prefix>$(target-name).test |
|---|
| 61 | <testing.input-file>$(reference-output) |
|---|
| 62 | <testing.input-file>$(target-name).boostbook |
|---|
| 63 | ] |
|---|
| 64 | ; |
|---|
| 65 | |
|---|
| 66 | modules.poke testing : .all-tests : \$\(all-tests\) $(t) ; |
|---|
| 67 | |
|---|
| 68 | return $(t) ; |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | ################################################################################ |
|---|
| 72 | toolset.flags quickbook-testing.process-quickbook quickbook-command <quickbook-testing.quickbook-command> ; |
|---|
| 73 | rule process-quickbook ( target : source : properties * ) |
|---|
| 74 | { |
|---|
| 75 | DEPENDS $(target) : [ on $(target) return $(quickbook-command) ] ; |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | actions process-quickbook bind quickbook-command |
|---|
| 79 | { |
|---|
| 80 | $(quickbook-command) $(>) --output-file=$(<) --debug |
|---|
| 81 | } |
|---|