summaryrefslogtreecommitdiff
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-07-19 13:09:43 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-09-14 07:11:32 +0200
commitf3f0370f1054f4e49aa8f5ea70485d673e8e94b6 (patch)
tree11d44920353aea9bf4301eb267f8c831e622520e /testsuites
parent9f096f47243ab19db617ec990188dbef71166e41 (diff)
build: Alternative build system based on waf
Update #3818.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/build/.doorstop.skip0
-rw-r--r--testsuites/build/bad-integer.ini2
-rwxr-xr-xtestsuites/build/bin/fake-rtems5-ar31
-rwxr-xr-xtestsuites/build/bin/fake-rtems5-gcc43
-rwxr-xr-xtestsuites/build/bin/fake-rtems5-ld31
-rw-r--r--testsuites/build/fake-good.ini1
-rw-r--r--testsuites/build/fake-inherit-good.ini2
-rw-r--r--testsuites/build/fake-inherit-loop.ini4
-rw-r--r--testsuites/build/fake-inherit-none.ini2
-rw-r--r--testsuites/build/fake-none.ini1
-rw-r--r--testsuites/build/good-integer.ini2
-rw-r--r--testsuites/build/not-power-of-two.ini2
-rw-r--r--testsuites/build/spec/bsp.yml16
-rw-r--r--testsuites/build/spec/config-file.yml19
-rw-r--r--testsuites/build/spec/config-header.yml18
-rw-r--r--testsuites/build/spec/gcc.yml41
-rw-r--r--testsuites/build/spec/integer-option.yml25
-rw-r--r--testsuites/build/spec/string-option.yml24
-rw-r--r--testsuites/build/spec/top-level-group.yml17
-rw-r--r--testsuites/build/spec2/config-file.yml16
-rw-r--r--testsuites/build/spec2/gcc.yml41
-rw-r--r--testsuites/build/spec2/top-level-group.yml16
-rwxr-xr-xtestsuites/build/test.py200
-rw-r--r--testsuites/build/too-big.ini2
-rw-r--r--testsuites/build/too-small.ini2
25 files changed, 558 insertions, 0 deletions
diff --git a/testsuites/build/.doorstop.skip b/testsuites/build/.doorstop.skip
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuites/build/.doorstop.skip
diff --git a/testsuites/build/bad-integer.ini b/testsuites/build/bad-integer.ini
new file mode 100644
index 0000000000..7bc5b72bc1
--- /dev/null
+++ b/testsuites/build/bad-integer.ini
@@ -0,0 +1,2 @@
+[fake/good]
+INTEGER = bad
diff --git a/testsuites/build/bin/fake-rtems5-ar b/testsuites/build/bin/fake-rtems5-ar
new file mode 100755
index 0000000000..1561e69e27
--- /dev/null
+++ b/testsuites/build/bin/fake-rtems5-ar
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (C) 2019 embedded brains GmbH
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import sys
+
+print(sys.argv)
+exit(0)
diff --git a/testsuites/build/bin/fake-rtems5-gcc b/testsuites/build/bin/fake-rtems5-gcc
new file mode 100755
index 0000000000..f2ae2d92c5
--- /dev/null
+++ b/testsuites/build/bin/fake-rtems5-gcc
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (C) 2019 embedded brains GmbH
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import argparse
+import sys
+
+sys.argv = list(filter(lambda a: a != '-', sys.argv))
+
+parser = argparse.ArgumentParser()
+parser.add_argument('-E', action='count')
+parser.add_argument('-dM', action='count')
+args = parser.parse_args()
+
+if args.E > 0:
+ print("#define __GNUC__ 7")
+ print("#define __GNUC_MINOR__ 4")
+ print("#define __GNUC_PATCHLEVEL__ 0")
+
+exit(0)
diff --git a/testsuites/build/bin/fake-rtems5-ld b/testsuites/build/bin/fake-rtems5-ld
new file mode 100755
index 0000000000..1561e69e27
--- /dev/null
+++ b/testsuites/build/bin/fake-rtems5-ld
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (C) 2019 embedded brains GmbH
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import sys
+
+print(sys.argv)
+exit(0)
diff --git a/testsuites/build/fake-good.ini b/testsuites/build/fake-good.ini
new file mode 100644
index 0000000000..44c5aad131
--- /dev/null
+++ b/testsuites/build/fake-good.ini
@@ -0,0 +1 @@
+[fake/good]
diff --git a/testsuites/build/fake-inherit-good.ini b/testsuites/build/fake-inherit-good.ini
new file mode 100644
index 0000000000..c0e00ccc30
--- /dev/null
+++ b/testsuites/build/fake-inherit-good.ini
@@ -0,0 +1,2 @@
+[fake/very]
+INHERIT = good
diff --git a/testsuites/build/fake-inherit-loop.ini b/testsuites/build/fake-inherit-loop.ini
new file mode 100644
index 0000000000..e995b527d4
--- /dev/null
+++ b/testsuites/build/fake-inherit-loop.ini
@@ -0,0 +1,4 @@
+[fake/one]
+INHERIT = two
+[fake/two]
+INHERIT = one
diff --git a/testsuites/build/fake-inherit-none.ini b/testsuites/build/fake-inherit-none.ini
new file mode 100644
index 0000000000..aa7b0b5f38
--- /dev/null
+++ b/testsuites/build/fake-inherit-none.ini
@@ -0,0 +1,2 @@
+[fake/none]
+INHERIT = none2
diff --git a/testsuites/build/fake-none.ini b/testsuites/build/fake-none.ini
new file mode 100644
index 0000000000..fa9a6d7f5b
--- /dev/null
+++ b/testsuites/build/fake-none.ini
@@ -0,0 +1 @@
+[fake/none]
diff --git a/testsuites/build/good-integer.ini b/testsuites/build/good-integer.ini
new file mode 100644
index 0000000000..470d498a10
--- /dev/null
+++ b/testsuites/build/good-integer.ini
@@ -0,0 +1,2 @@
+[fake/good]
+INTEGER = 0x08
diff --git a/testsuites/build/not-power-of-two.ini b/testsuites/build/not-power-of-two.ini
new file mode 100644
index 0000000000..dad6115be9
--- /dev/null
+++ b/testsuites/build/not-power-of-two.ini
@@ -0,0 +1,2 @@
+[fake/good]
+INTEGER = 3
diff --git a/testsuites/build/spec/bsp.yml b/testsuites/build/spec/bsp.yml
new file mode 100644
index 0000000000..5b37a84dbc
--- /dev/null
+++ b/testsuites/build/spec/bsp.yml
@@ -0,0 +1,16 @@
+active: true
+arch: fake
+bsp: good
+build-type: bsp
+derived: true
+enabled-by: []
+family: good
+header: ''
+level: 1.0
+links: []
+normative: true
+order: 0
+ref: ''
+reviewed: null
+text: ''
+type: build
diff --git a/testsuites/build/spec/config-file.yml b/testsuites/build/spec/config-file.yml
new file mode 100644
index 0000000000..48a5a0bc55
--- /dev/null
+++ b/testsuites/build/spec/config-file.yml
@@ -0,0 +1,19 @@
+active: true
+build-type: config-file
+content: |
+ $$
+ a$$z
+ ${ABC}
+ 0$${NIX}1
+derived: false
+enabled-by: []
+header: ''
+level: 1.0
+links: []
+normative: true
+order: 0
+ref: ''
+reviewed: null
+target: config-file.txt
+text: ''
+type: build
diff --git a/testsuites/build/spec/config-header.yml b/testsuites/build/spec/config-header.yml
new file mode 100644
index 0000000000..22971c127f
--- /dev/null
+++ b/testsuites/build/spec/config-header.yml
@@ -0,0 +1,18 @@
+active: true
+build-type: config-header
+derived: false
+enabled-by: []
+header: ''
+level: 1.0
+links:
+- string-option: null
+- integer-option: null
+normative: true
+order: 0
+ref: ''
+reviewed: null
+target: config-header.h
+guard: CONFIG_HEADER_H
+include-headers: []
+text: ''
+type: build
diff --git a/testsuites/build/spec/gcc.yml b/testsuites/build/spec/gcc.yml
new file mode 100644
index 0000000000..18bf857ee1
--- /dev/null
+++ b/testsuites/build/spec/gcc.yml
@@ -0,0 +1,41 @@
+actions:
+- set-value: ${ARCH}-rtems5-gcc
+- substitute: null
+- find-program: null
+- env-assign: AS
+- env-assign: CC
+- env-assign: LINK_CC
+- set-value: ${ARCH}-rtems5-g++
+- substitute: null
+- find-program: null
+- env-assign: CXX
+- env-assign: LINK_CXX
+- set-value: ${ARCH}-rtems5-ar
+- substitute: null
+- find-program: null
+- env-assign: AR
+- set-value: ${ARCH}-rtems5-ld
+- substitute: null
+- find-program: null
+- env-assign: LD
+- script: |
+ load = "ar g++ gas gcc"
+ if not is_windows_host:
+ load += " gccdeps"
+ conf.load(load)
+active: true
+build-type: option
+default: null
+default-by-variant: []
+derived: false
+enabled-by: []
+header: ''
+level: 1.39
+links: []
+name: GCC
+normative: true
+order: -900
+ref: ''
+reviewed: oRRzhna6a47p0_QjPWqYLful9JgHGbxMqy-q7mSiZiU=
+text: ''
+type: build
diff --git a/testsuites/build/spec/integer-option.yml b/testsuites/build/spec/integer-option.yml
new file mode 100644
index 0000000000..bacdb2a83f
--- /dev/null
+++ b/testsuites/build/spec/integer-option.yml
@@ -0,0 +1,25 @@
+active: true
+build-type: option
+derived: false
+enabled-by: []
+format: '{:#010x}'
+header: ''
+level: 1.0
+links: []
+name: INTEGER
+normative: true
+order: 0
+ref: ''
+reviewed: null
+text: ''
+type: build
+default: 1
+default-by-variant: []
+actions:
+- get-integer: null
+- assert-in-interval:
+ - 1
+ - 16
+- assert-power-of-two: null
+- env-assign: null
+- format-and-define: null
diff --git a/testsuites/build/spec/string-option.yml b/testsuites/build/spec/string-option.yml
new file mode 100644
index 0000000000..c97c078868
--- /dev/null
+++ b/testsuites/build/spec/string-option.yml
@@ -0,0 +1,24 @@
+active: true
+build-type: option
+derived: false
+enabled-by: []
+format: '{}'
+header: ''
+level: 1.0
+links: []
+name: ABC
+normative: true
+order: 0
+ref: ''
+reviewed: null
+text: ''
+type: build
+default: ZYZ
+default-by-variant:
+- value: DEF
+ variants:
+ - .*go.*d
+actions:
+- get-string: null
+- env-assign: null
+- define: null
diff --git a/testsuites/build/spec/top-level-group.yml b/testsuites/build/spec/top-level-group.yml
new file mode 100644
index 0000000000..89b6c457f2
--- /dev/null
+++ b/testsuites/build/spec/top-level-group.yml
@@ -0,0 +1,17 @@
+active: true
+build-type: group
+derived: false
+enabled-by: []
+header: ''
+level: 1.82
+links:
+- config-header: null
+- config-file: null
+- gcc: null
+normative: true
+order: 0
+ref: ''
+reviewed: null
+text: ''
+top-level: true
+type: build
diff --git a/testsuites/build/spec2/config-file.yml b/testsuites/build/spec2/config-file.yml
new file mode 100644
index 0000000000..7aac892f2c
--- /dev/null
+++ b/testsuites/build/spec2/config-file.yml
@@ -0,0 +1,16 @@
+active: true
+build-type: config-file
+content: |
+ ${OPEN
+derived: false
+enabled-by: []
+header: ''
+level: 1.0
+links: []
+normative: true
+order: 0
+ref: ''
+reviewed: null
+target: config-file.txt
+text: ''
+type: build
diff --git a/testsuites/build/spec2/gcc.yml b/testsuites/build/spec2/gcc.yml
new file mode 100644
index 0000000000..18bf857ee1
--- /dev/null
+++ b/testsuites/build/spec2/gcc.yml
@@ -0,0 +1,41 @@
+actions:
+- set-value: ${ARCH}-rtems5-gcc
+- substitute: null
+- find-program: null
+- env-assign: AS
+- env-assign: CC
+- env-assign: LINK_CC
+- set-value: ${ARCH}-rtems5-g++
+- substitute: null
+- find-program: null
+- env-assign: CXX
+- env-assign: LINK_CXX
+- set-value: ${ARCH}-rtems5-ar
+- substitute: null
+- find-program: null
+- env-assign: AR
+- set-value: ${ARCH}-rtems5-ld
+- substitute: null
+- find-program: null
+- env-assign: LD
+- script: |
+ load = "ar g++ gas gcc"
+ if not is_windows_host:
+ load += " gccdeps"
+ conf.load(load)
+active: true
+build-type: option
+default: null
+default-by-variant: []
+derived: false
+enabled-by: []
+header: ''
+level: 1.39
+links: []
+name: GCC
+normative: true
+order: -900
+ref: ''
+reviewed: oRRzhna6a47p0_QjPWqYLful9JgHGbxMqy-q7mSiZiU=
+text: ''
+type: build
diff --git a/testsuites/build/spec2/top-level-group.yml b/testsuites/build/spec2/top-level-group.yml
new file mode 100644
index 0000000000..3cefcbdfe9
--- /dev/null
+++ b/testsuites/build/spec2/top-level-group.yml
@@ -0,0 +1,16 @@
+active: true
+build-type: group
+derived: false
+enabled-by: []
+header: ''
+level: 1.82
+links:
+- config-file: null
+- gcc: null
+normative: true
+order: 0
+ref: ''
+reviewed: null
+text: ''
+top-level: true
+type: build
diff --git a/testsuites/build/test.py b/testsuites/build/test.py
new file mode 100755
index 0000000000..e8b50983dd
--- /dev/null
+++ b/testsuites/build/test.py
@@ -0,0 +1,200 @@
+#!/usr/bin/env python
+
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (C) 2019 embedded brains GmbH
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import os
+import subprocess
+import unittest
+
+try:
+ os.symlink("../../wscript", "wscript")
+except FileExistsError:
+ pass
+try:
+ os.symlink("fake-rtems5-gcc", "bin/fake-rtems5-g++")
+except FileExistsError:
+ pass
+exec(open("../../wscript", "r").read())
+
+
+class TestWscript(unittest.TestCase):
+ def test_is_enabled(self):
+ self.assertTrue(_is_enabled([], None))
+ self.assertTrue(_is_enabled([], []))
+ self.assertFalse(_is_enabled([], ["A"]))
+ self.assertTrue(_is_enabled(["A"], "A"))
+ self.assertFalse(_is_enabled(["B"], "A"))
+ self.assertTrue(_is_enabled(["A"], ["A"]))
+ self.assertFalse(_is_enabled(["B"], ["A"]))
+ self.assertTrue(_is_enabled(["A"], ["A", "B"]))
+ self.assertTrue(_is_enabled(["B"], ["A", "B"]))
+ self.assertFalse(_is_enabled(["C"], ["A", "B"]))
+ self.assertFalse(_is_enabled(["A"], {"not": "A"}))
+ self.assertTrue(_is_enabled(["B"], {"not": "A"}))
+ self.assertFalse(_is_enabled(["A"], {"and": ["A", "B"]}))
+ self.assertTrue(_is_enabled(["A", "B"], {"and": ["A", "B"]}))
+ self.assertTrue(_is_enabled(["A", "B", "C"], {"and": ["A", "B"]}))
+ self.assertTrue(
+ _is_enabled(["A", "B"], {"and": ["A", "B", {"not": "C"}]})
+ )
+ self.assertFalse(
+ _is_enabled(["A", "B", "C"], {"and": ["A", "B", {"not": "C"}]})
+ )
+ self.assertFalse(_is_enabled(["A"], {"and": "A", "x": "y"}))
+ self.assertFalse(_is_enabled(["A"], {"x": "A"}))
+ self.assertTrue(_is_enabled([], {"not": {"and": ["A", {"not": "A"}]}}))
+
+
+class TestWaf(unittest.TestCase):
+ @staticmethod
+ def waf(args, returncode):
+ cmd = f"../../waf {args}"
+ print(cmd)
+ cp = subprocess.run(
+ cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
+ )
+ if returncode != None and cp.returncode != returncode:
+ raise AssertionError(f"command failed: {cmd}")
+ return cp
+
+ def setUp(self):
+ self.waf("distclean", None)
+ self.tools = f"--rtems-tools={os.getcwd()}"
+ self.specs = "--rtems-specs=spec"
+
+ def test_specs_no_such_directory(self):
+ cp = self.waf("configure --rtems-specs=nix", 1)
+ self.assertIn(b"Cannot list build specification directory:", cp.stderr)
+
+ def test_specs_not_a_directory(self):
+ cp = self.waf("configure --rtems-specs=test.py", 1)
+ self.assertIn(b"Cannot list build specification directory:", cp.stderr)
+
+ def test_configure_no_bsp(self):
+ cp = self.waf(
+ f"configure {self.tools} {self.specs} --rtems-config=fake-none.ini",
+ 1,
+ )
+ self.assertIn(b"No such base BSP: 'fake/none'", cp.stderr)
+
+ def test_configure_inherit_loop(self):
+ cp = self.waf(
+ f"configure {self.tools} {self.specs} --rtems-config=fake-inherit-loop.ini",
+ 1,
+ )
+ self.assertIn(
+ b"Recursion in BSP options inheritance: fake/one -> fake/two -> fake/one",
+ cp.stderr,
+ )
+
+ def test_configure_inherit_none(self):
+ cp = self.waf(
+ f"configure {self.tools} {self.specs} --rtems-config=fake-inherit-none.ini",
+ 1,
+ )
+ self.assertIn(
+ b"BSP variant 'fake/none' cannot inherit options from not existing variant 'fake/none2'",
+ cp.stderr,
+ )
+
+ def test_configure_inherit_good(self):
+ self.waf(
+ f"configure {self.tools} {self.specs} --rtems-config=fake-inherit-good.ini",
+ 0,
+ )
+
+ def test_configure_good(self):
+ cp = self.waf(
+ f"configure {self.tools} {self.specs} --rtems-config=fake-good.ini",
+ 0,
+ )
+ content = """$
+a$z
+DEF
+0${NIX}1
+"""
+ with open("build/fake/good/config-file.txt", "r") as f:
+ self.assertEqual(content, f.read())
+
+ def test_bad_config_file(self):
+ cp = self.waf(
+ f"configure {self.tools} {self.specs}2 --rtems-config=fake-good.ini",
+ 1,
+ )
+ self.assertIn(
+ b"""In item 'config-file' substitution in '${OPEN
+' failed: Invalid placeholder in string: line 1, col 1
+""",
+ cp.stderr,
+ )
+
+ def test_ini_bad_integer(self):
+ cp = self.waf(
+ f"configure {self.tools} {self.specs} --rtems-config=bad-integer.ini",
+ 1,
+ )
+ self.assertIn(
+ b"Value 'bad' for option 'INTEGER' is an invalid integer", cp.stderr
+ )
+
+ def test_ini_too_small(self):
+ cp = self.waf(
+ f"configure {self.tools} {self.specs} --rtems-config=too-small.ini",
+ 1,
+ )
+ self.assertIn(
+ b"Value '-1' for option 'INTEGER' is not in closed interval [1, 16]",
+ cp.stderr,
+ )
+
+ def test_ini_too_big(self):
+ cp = self.waf(
+ f"configure {self.tools} {self.specs} --rtems-config=too-big.ini",
+ 1,
+ )
+ self.assertIn(
+ b"Value '100' for option 'INTEGER' is not in closed interval [1, 16]",
+ cp.stderr,
+ )
+
+ def test_ini_not_power_of_two(self):
+ cp = self.waf(
+ f"configure {self.tools} {self.specs} --rtems-config=not-power-of-two.ini",
+ 1,
+ )
+ self.assertIn(
+ b"Value '3' for option 'INTEGER' is not a power of two", cp.stderr
+ )
+
+ def test_good_integer(self):
+ self.waf(
+ f"configure {self.tools} {self.specs} --rtems-config=good-integer.ini",
+ 0,
+ )
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/testsuites/build/too-big.ini b/testsuites/build/too-big.ini
new file mode 100644
index 0000000000..3d0fba4671
--- /dev/null
+++ b/testsuites/build/too-big.ini
@@ -0,0 +1,2 @@
+[fake/good]
+INTEGER = 100
diff --git a/testsuites/build/too-small.ini b/testsuites/build/too-small.ini
new file mode 100644
index 0000000000..55464db1cf
--- /dev/null
+++ b/testsuites/build/too-small.ini
@@ -0,0 +1,2 @@
+[fake/good]
+INTEGER = -1