1#!/usr/local/bin/python3.8 2 3# Copyright 2003, 2004 Vladimir Prus 4# Distributed under the Boost Software License, Version 1.0. 5# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 6 7import BoostBuild 8 9t = BoostBuild.Tester() 10 11# Regression test: when staging V2 used to change suffixes on targets 12# corresponding to real files. 13t.write("jamfile.jam", """ 14import type : register ; 15register A : a1 a2 a3 ; 16stage a : a.a3 ; 17""") 18 19t.write("jamroot.jam", "") 20t.write("a.a3", "") 21 22t.run_build_system() 23t.expect_addition("a/a.a3"); 24 25# Regression test: we should be able to specify empty suffix for derived target 26# type, even if base type has non-empty suffix. 27t.write("a.cpp", "") 28 29t.write("suffixes.jam", """ 30import type ; 31import generators ; 32import common ; 33 34type.register First : first : ; 35type.register Second : "" : First ; 36 37generators.register-standard $(__name__).second : CPP : Second ; 38 39rule second 40{ 41 TOUCH on $(<) = [ common.file-creation-command ] ; 42} 43 44actions second 45{ 46 $(TOUCH) $(<) 47} 48""") 49 50t.write("suffixes.py", """ 51import b2.build.type as type 52import b2.build.generators as generators 53import b2.tools.common as common 54 55from b2.manager import get_manager 56 57type.register("First", ["first"]) 58type.register("Second", [""], "First") 59 60generators.register_standard("suffixes.second", ["CPP"], ["Second"]) 61 62get_manager().engine().register_action("suffixes.second", 63 "%s $(<)" % common.file_creation_command()) 64 65""") 66 67t.write("jamroot.jam", """ 68import suffixes ; 69""") 70 71t.write("jamfile.jam", """ 72second a : a.cpp ; 73""") 74 75t.run_build_system() 76t.expect_addition("bin/a") 77 78t.cleanup() 79