summaryrefslogtreecommitdiff
path: root/test/conftest.py
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-06-04 10:47:01 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-06-09 12:20:05 +0200
commit6eb6998a2ba3eb314916df80bf42590e63bbfd3d (patch)
tree47084b1ae534ec642842ab030f95aca0913d7d37 /test/conftest.py
parent848c4c61c5b469910df2471c659b005f9f4538b9 (diff)
downloadbarebox-6eb6998a2ba3eb314916df80bf42590e63bbfd3d.tar.gz
test: add first sample tests
The test can be run manually with e.g. labgrid-pytest --lg-env test/arm/qemu_virt64_defconfig.yaml test/py Acked-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210604084704.17410-11-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'test/conftest.py')
-rw-r--r--test/conftest.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/conftest.py b/test/conftest.py
new file mode 100644
index 0000000000..1a043a91fa
--- /dev/null
+++ b/test/conftest.py
@@ -0,0 +1,27 @@
+import pytest
+import os
+from .py import helper
+
+
+@pytest.fixture(scope='function')
+def barebox(strategy, target):
+ strategy.transition('barebox')
+ return target.get_driver('BareboxDriver')
+
+@pytest.fixture(scope="session")
+def barebox_config(strategy, target):
+ strategy.transition('barebox')
+ command = target.get_driver("BareboxDriver")
+ return helper.get_config(command)
+
+def pytest_configure(config):
+ if 'LG_BUILDDIR' not in os.environ:
+ if 'KBUILD_OUTPUT' in os.environ:
+ os.environ['LG_BUILDDIR'] = os.environ['KBUILD_OUTPUT']
+ elif os.path.isdir('build'):
+ os.environ['LG_BUILDDIR'] = os.path.realpath('build')
+ else:
+ os.environ['LG_BUILDDIR'] = os.getcwd()
+
+ if os.environ['LG_BUILDDIR'] is not None:
+ os.environ['LG_BUILDDIR'] = os.path.realpath(os.environ['LG_BUILDDIR'])