aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorNicolas Schneider <nioncode+git@gmail.com>2016-03-12 17:41:42 +0100
committerNicolas Schneider <nioncode+git@gmail.com>2016-03-12 17:41:42 +0100
commit5482a239363c21162526b6f2787b686678ba8bd6 (patch)
tree87f9dd49942048622f08fbdbd74ea3cb2724d7be /test cases
parent118e043143a2dd13a9862ede278e1584ca194e72 (diff)
downloadmeson-5482a239363c21162526b6f2787b686678ba8bd6.zip
meson-5482a239363c21162526b6f2787b686678ba8bd6.tar.gz
meson-5482a239363c21162526b6f2787b686678ba8bd6.tar.bz2
enhance test framework to read meson arguments from a file per test
A 'test_args.txt' file in the same directory as the test case will be parsed by the test framework and the content will be passed as arguments to meson during configuration. The arguments are put before any 'extra_args' to make them overwritable from the command line.
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/109 testframework options/meson.build5
-rw-r--r--test cases/common/109 testframework options/meson_options.txt3
-rw-r--r--test cases/common/109 testframework options/test_args.txt4
3 files changed, 12 insertions, 0 deletions
diff --git a/test cases/common/109 testframework options/meson.build b/test cases/common/109 testframework options/meson.build
new file mode 100644
index 0000000..2773730
--- /dev/null
+++ b/test cases/common/109 testframework options/meson.build
@@ -0,0 +1,5 @@
+project('options', 'c')
+
+assert(get_option('testoption') == 'A string with spaces', 'Incorrect value for testoption option.')
+assert(get_option('other_one') == true, 'Incorrect value for other_one option.')
+assert(get_option('combo_opt') == 'one', 'Incorrect value for combo_opt option.')
diff --git a/test cases/common/109 testframework options/meson_options.txt b/test cases/common/109 testframework options/meson_options.txt
new file mode 100644
index 0000000..653dd75
--- /dev/null
+++ b/test cases/common/109 testframework options/meson_options.txt
@@ -0,0 +1,3 @@
+option('testoption', type : 'string', value : 'optval', description : 'An option to do something')
+option('other_one', type : 'boolean', value : false)
+option('combo_opt', type : 'combo', choices : ['one', 'two', 'combo'], value : 'combo')
diff --git a/test cases/common/109 testframework options/test_args.txt b/test cases/common/109 testframework options/test_args.txt
new file mode 100644
index 0000000..a667e3a
--- /dev/null
+++ b/test cases/common/109 testframework options/test_args.txt
@@ -0,0 +1,4 @@
+# This file is not read by meson itself, but by the test framework.
+# It is not possible to pass arguments to meson from a file.
+['--werror', '-D', 'testoption=A string with spaces', '-D', 'other_one=true', \
+ '-D', 'combo_opt=one']