aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/unit/49 testsetup default
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /meson/test cases/unit/49 testsetup default
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/unit/49 testsetup default')
-rw-r--r--meson/test cases/unit/49 testsetup default/envcheck.py11
-rw-r--r--meson/test cases/unit/49 testsetup default/meson.build23
2 files changed, 34 insertions, 0 deletions
diff --git a/meson/test cases/unit/49 testsetup default/envcheck.py b/meson/test cases/unit/49 testsetup default/envcheck.py
new file mode 100644
index 000000000..6ba3093ff
--- /dev/null
+++ b/meson/test cases/unit/49 testsetup default/envcheck.py
@@ -0,0 +1,11 @@
+#!/usr/bin/env python3
+
+import os
+
+assert('ENV_A' in os.environ)
+assert('ENV_B' in os.environ)
+assert('ENV_C' in os.environ)
+
+print('ENV_A is', os.environ['ENV_A'])
+print('ENV_B is', os.environ['ENV_B'])
+print('ENV_C is', os.environ['ENV_C'])
diff --git a/meson/test cases/unit/49 testsetup default/meson.build b/meson/test cases/unit/49 testsetup default/meson.build
new file mode 100644
index 000000000..bdd35b807
--- /dev/null
+++ b/meson/test cases/unit/49 testsetup default/meson.build
@@ -0,0 +1,23 @@
+project('testsetup default', 'c')
+
+envcheck = find_program('envcheck.py')
+
+# Defining ENV_A in test-env should overwrite ENV_A from test setup
+env_1 = environment()
+env_1.set('ENV_A', '1')
+test('test-env', envcheck, env: env_1)
+
+# Defining default env which is used unless --setup is given or the
+# env variable is defined in the test.
+env_2 = environment()
+env_2.set('ENV_A', '2')
+env_2.set('ENV_B', '2')
+env_2.set('ENV_C', '2')
+add_test_setup('mydefault', env: env_2, is_default: true)
+
+# Defining a test setup that will update some of the env variables
+# from the default test setup.
+env_3 = env_2
+env_3.set('ENV_A', '3')
+env_3.set('ENV_B', '3')
+add_test_setup('other', env: env_3)