summaryrefslogtreecommitdiff
path: root/testsuite.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2015-06-07 16:57:46 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2015-06-07 17:46:11 +0200
commitd56e9c1d4c3e6f560382ac71fa2419b2a9bef1cb (patch)
tree6f63cb1c1ed473480789a926244dad353a083694 /testsuite.py
parent8de05809108aef5adbc9081975f530344c8bce62 (diff)
Do not require $srctree to be set for non-kernel projects.
(It was never required if you explicitly passed a 'base_dir', but it's a bit silly to have to do that too.) This is a bug. I expected os.path.expandvars() to replace references non-set environment variables with nothing, but it leaves them as is. Work around it by letting base_dir = None be special and the default. It uses $srctree if set and the current directory otherwise. This has the following advantages: - It avoids having to reimplement a different version of os.path.expandvars() and special-casing "" to mean the current directory. - It means '$' can appear in paths. (Though it probably never will.) Maybe the expansion behavior could be removed too, but keep it for now to be backwards compatible.
Diffstat (limited to 'testsuite.py')
-rw-r--r--testsuite.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/testsuite.py b/testsuite.py
index 3407e0a..3a2ee0b 100644
--- a/testsuite.py
+++ b/testsuite.py
@@ -1234,6 +1234,15 @@ def run_selftests():
verify_value("UNAME_RELEASE", os.uname()[2])
+ # Expansion of environment variables in Config.__init__'s base_dir
+ # parameter. Just make sure we don't crash when Kbase_dir 'source's a file
+ # from the same directory.
+
+ os.environ["EnV_VaR1"] = "Kconfigl"
+ os.environ["EnV_VaR2"] = "ib/tests"
+ kconfiglib.Config("Kconfiglib/tests/Kbase_dir",
+ base_dir = "$EnV_VaR1$EnV_VaR2/")
+
#
# .config reading and writing
#