Introduce KAS_BUILD_DIR environment variable
This variable can override default build path `${KAS_WORK_DIR}/build`. Signed-off-by: Peter Hatina <peter@hatina.eu> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
30
tests/test_environment_variables.py
Normal file
30
tests/test_environment_variables.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import os
|
||||
import shutil
|
||||
from kas import kas
|
||||
|
||||
|
||||
def test_build_dir_is_placed_inside_work_dir_by_default(changedir, tmpdir):
|
||||
conf_dir = str(tmpdir.mkdir('test_env_variables'))
|
||||
shutil.rmtree(conf_dir, ignore_errors=True)
|
||||
shutil.copytree('tests/test_environment_variables', conf_dir)
|
||||
|
||||
os.chdir(conf_dir)
|
||||
|
||||
kas.kas(['checkout', 'test.yml'])
|
||||
|
||||
assert(os.path.exists(os.path.join(os.getcwd(), 'build', 'conf')))
|
||||
|
||||
|
||||
def test_build_dir_can_be_specified_by_environment_variable(changedir, tmpdir):
|
||||
conf_dir = str(tmpdir.mkdir('test_env_variables'))
|
||||
build_dir = str(tmpdir.mkdir('test_build_dir'))
|
||||
shutil.rmtree(conf_dir, ignore_errors=True)
|
||||
shutil.copytree('tests/test_environment_variables', conf_dir)
|
||||
shutil.rmtree(build_dir, ignore_errors=True)
|
||||
os.chdir(conf_dir)
|
||||
|
||||
os.environ['KAS_BUILD_DIR'] = build_dir
|
||||
kas.kas(['checkout', 'test.yml'])
|
||||
del os.environ['KAS_BUILD_DIR']
|
||||
|
||||
assert(os.path.exists(os.path.join(build_dir, 'conf')))
|
3
tests/test_environment_variables/oe-init-build-env
Executable file
3
tests/test_environment_variables/oe-init-build-env
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
true
|
5
tests/test_environment_variables/test.yml
Normal file
5
tests/test_environment_variables/test.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
header:
|
||||
version: 10
|
||||
|
||||
repos:
|
||||
this:
|
Reference in New Issue
Block a user