(target)
| 216 | # - relative location of all source from the project root. |
| 217 | # |
| 218 | def dump_test(target): |
| 219 | type = target.type() |
| 220 | name = target.name() |
| 221 | project = target.project() |
| 222 | |
| 223 | project_root = project.get('project-root') |
| 224 | library = get_library_name(os.path.abspath(project.get('location'))) |
| 225 | if library: |
| 226 | name = library + "/" + name |
| 227 | |
| 228 | sources = target.sources() |
| 229 | source_files = [] |
| 230 | for s in sources: |
| 231 | if isinstance(s, targets.FileReference): |
| 232 | location = os.path.abspath(os.path.join(s.location(), s.name())) |
| 233 | source_files.append(os.path.relpath(location, os.path.abspath(project_root))) |
| 234 | |
| 235 | target_name = project.get('location') + "//" + target.name() + ".test" |
| 236 | |
| 237 | test_info = target.requirements().get('test-info') |
| 238 | test_info = " ".join('"' + ti + '"' for ti in test_info) |
| 239 | |
| 240 | # If the user requested XML output on the command-line, add the test info to |
| 241 | # that XML file rather than dumping them to stdout. |
| 242 | #if $(.out-xml) |
| 243 | #{ |
| 244 | # local nl = " |
| 245 | #" ; |
| 246 | # .contents on $(.out-xml) += |
| 247 | # "$(nl) <test type=\"$(type)\" name=\"$(name)\">" |
| 248 | # "$(nl) <target><![CDATA[$(target-name)]]></target>" |
| 249 | # "$(nl) <info><![CDATA[$(test-info)]]></info>" |
| 250 | # "$(nl) <source><![CDATA[$(source-files)]]></source>" |
| 251 | # "$(nl) </test>" |
| 252 | # ; |
| 253 | # } |
| 254 | # else |
| 255 | |
| 256 | source_files = " ".join('"' + s + '"' for s in source_files) |
| 257 | if test_info: |
| 258 | print 'boost-test(%s) "%s" [%s] : %s' % (type, name, test_info, source_files) |
| 259 | else: |
| 260 | print 'boost-test(%s) "%s" : %s' % (type, name, source_files) |
| 261 | |
| 262 | # Register generators. Depending on target type, either 'expect-success' or |
| 263 | # 'expect-failure' rule will be used. |
no test coverage detected