summaryrefslogtreecommitdiffstats
path: root/tests/inherit-bld
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:21:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-11 08:21:29 +0000
commit29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc (patch)
tree63ef546b10a81d461e5cf5ed9e98a68cd7dee1aa /tests/inherit-bld
parentInitial commit. (diff)
downloadkbuild-29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc.tar.xz
kbuild-29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc.zip
Adding upstream version 1:0.1.9998svn3589+dfsg.upstream/1%0.1.9998svn3589+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/inherit-bld')
-rw-r--r--tests/inherit-bld/Config.kmk81
-rw-r--r--tests/inherit-bld/Makefile.kmk116
2 files changed, 197 insertions, 0 deletions
diff --git a/tests/inherit-bld/Config.kmk b/tests/inherit-bld/Config.kmk
new file mode 100644
index 0000000..baa3e28
--- /dev/null
+++ b/tests/inherit-bld/Config.kmk
@@ -0,0 +1,81 @@
+# $Id: Config.kmk 2413 2010-09-11 17:43:04Z bird $
+## @file
+# Tests - Build Type Inheritance.
+#
+# Just to set up some additional build types the correct way.
+#
+
+#
+# Copyright (c) 2008-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+
+
+#
+# Include our parent Config.kmk
+#
+include $(PATH_ROOT)/tests/Config.kmk
+
+
+#
+# For inherit-bld3 - no inheritance.
+#
+KBUILD_BLD_TYPES += dbgbld3
+
+
+#
+# For inherit-bld4 - default inheritance (override).
+#
+KBUILD_BLD_TYPES += dbgbld4
+BLD_TYPE_dbgbld4_EXTENDS = dbgbld3
+
+#
+# For inherit-bld5 - appending inheritance.
+#
+KBUILD_BLD_TYPES += dbgbld5
+BLD_TYPE_dbgbld5_EXTENDS = dbgbld3
+BLD_TYPE_dbgbld5_EXTENDS_BY = appending
+
+#
+# For inherit-bld6 - prepending inheritance.
+#
+KBUILD_BLD_TYPES += dbgbld6
+BLD_TYPE_dbgbld6_EXTENDS = dbgbld3
+BLD_TYPE_dbgbld6_EXTENDS_BY = prepending
+
+#
+# For inherit-bld7 - overriding inheritance.
+#
+KBUILD_BLD_TYPES += dbgbld7
+BLD_TYPE_dbgbld7_EXTENDS = dbgbld3
+BLD_TYPE_dbgbld7_EXTENDS_BY = overriding
+
+#
+# For inherit-bld10 thru 19 - overriding inheritance.
+#
+KBUILD_BLD_TYPES += dbgbld10 dbgbld11
+BLD_TYPE_dbgbld11_EXTENDS = dbgbld10
+
+#
+# For inherit-bld20 thru 29 - prepending inheritance.
+#
+KBUILD_BLD_TYPES += dbgbld20 dbgbld21
+BLD_TYPE_dbgbld21_EXTENDS = dbgbld20
+BLD_TYPE_dbgbld21_EXTENDS_BY = prepending
+
diff --git a/tests/inherit-bld/Makefile.kmk b/tests/inherit-bld/Makefile.kmk
new file mode 100644
index 0000000..919f5c2
--- /dev/null
+++ b/tests/inherit-bld/Makefile.kmk
@@ -0,0 +1,116 @@
+# $Id: Makefile.kmk 2413 2010-09-11 17:43:04Z bird $
+## @file
+# Test - Build Type Inheritance.
+#
+
+#
+# Copyright (c) 2008-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+
+
+DEPTH = ../..
+include $(PATH_KBUILD)/header.kmk
+
+
+# Plain setup just for a reality check.
+PROGRAMS += inherit-bld1
+inherit-bld1_TEMPLATE = TST
+inherit-bld1_DEFS = X=y
+inherit-bld1_SOURCES = ../dummy_defined_X.c
+
+# Test that the BLD_TYPE feature works.
+PROGRAMS += inherit-bld2
+inherit-bld2_TEMPLATE = TST
+inherit-bld2_BLD_TYPE = debug
+inherit-bld2_DEFS.debug = X=y
+inherit-bld2_SOURCES = ../dummy_defined_X.c
+
+# Test that an simple alternative build type works.
+PROGRAMS += inherit-bld3
+inherit-bld3_TEMPLATE = TST
+inherit-bld3_BLD_TYPE = dbgbld3
+inherit-bld3_DEFS.dbgbld3 = X=y
+inherit-bld3_SOURCES = ../dummy_defined_X.c
+
+# Test that default build type inheritance works - dbgbld4 extends dbgbld3.
+PROGRAMS += inherit-bld4
+inherit-bld4_TEMPLATE = TST
+inherit-bld4_BLD_TYPE = dbgbld4
+inherit-bld4_DEFS.dbgbld3 = X=y
+inherit-bld4_SOURCES = ../dummy_defined_X.c
+
+# Test that appending build type inheritance works - dbgbld5 extends dbgbld3.
+PROGRAMS += inherit-bld5
+inherit-bld5_TEMPLATE = TST
+inherit-bld5_BLD_TYPE = dbgbld5
+inherit-bld5_DEFS.dbgbld3 = X=y y=0
+inherit-bld5_DEFS.dbgbld5 = y=42
+inherit-bld5_SOURCES = ../dummy_defined_X.c
+
+# Test that prepending build type inheritance works - dbgbld6 extends dbgbld3.
+PROGRAMS += inherit-bld6
+inherit-bld6_TEMPLATE = TST
+inherit-bld6_BLD_TYPE = dbgbld6
+inherit-bld6_DEFS.dbgbld3 = X=y y=42
+inherit-bld6_DEFS.dbgbld6 = y=0
+inherit-bld6_SOURCES = ../dummy_defined_X.c
+
+
+#
+# Tests where we inherit from a target and force build type which
+# relies on inheritance. These are the fine points...
+#
+PROGRAMS += inherit-bld10
+inherit-bld10_TEMPLATE = TST
+inherit-bld10_BLD_TYPE = dbgbld11
+inherit-bld10_DEFS = X=y
+inherit-bld10_DEFS.dbgbld10 = y=42
+inherit-bld10_SOURCES = ../dummy_defined_X.c
+
+# Tests that target and build inheriting works together.
+PROGRAMS += inherit-bld11
+inherit-bld11_EXTENDS = inherit-bld10
+
+# Tests that dbgbld11 is picked from the target rather than the parent.
+PROGRAMS += inherit-bld12
+inherit-bld12_EXTENDS = inherit-bld10
+inherit-bld12_DEFS = y=0
+inherit-bld12_DEFS.dbgbld11 = X=z z=42
+
+# Tests that prepending works.
+PROGRAMS += inherit-bld20
+inherit-bld20_TEMPLATE = TST
+inherit-bld20_BLD_TYPE = dbgbld21
+inherit-bld20_DEFS = X=y
+inherit-bld20_DEFS.dbgbld20 = y=42
+inherit-bld20_DEFS.dbgbld21 = y=0
+#inherit-bld20_DEFS.dbgbld21 = y=0 y=42 <-- expected result.
+inherit-bld20_SOURCES = ../dummy_defined_X.c
+
+# Tests that prepending + target inheritance works as expected. funky!
+PROGRAMS += inherit-bld21
+inherit-bld21_EXTENDS = inherit-bld20
+inherit-bld21_DEFS.dbgbld20 = Y=y
+#inherit-bld21_DEFS.dbgbld21 = y=0 y=42 Y=y <-- expected result; dbgbld21 from parent + our dbgbld20.
+inherit-bld21_SOURCES = ../dummy_defined_Y.c
+
+
+include $(FILE_KBUILD_FOOTER)
+