summaryrefslogtreecommitdiff
path: root/test cases/unit
diff options
context:
space:
mode:
authorEvgenii Shatokhin <eugene.shatokhin@rosalab.ru>2018-02-25 16:02:10 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2018-03-06 21:07:16 +0200
commit19718a8d9c5cb6d9ac2c2cbb5459178906a3a007 (patch)
tree60ae3fa4084c7ffe0f1b8c97d5ab58b80c2cf509 /test cases/unit
parent048508c989081f8bcf54d76f5b13138cc3f47738 (diff)
downloadmeson-19718a8d9c5cb6d9ac2c2cbb5459178906a3a007.tar.gz
Allow passing a compiler object to run_command()
Sometimes it is needed to run the current compiler with specific options not to compile a file but rather to obtain additional info. For example, GCC has several -print-* options to query it about the paths to different libraries and development files. One use case is to get the location of development files for GCC plugins, which is not easily obtainable by other means: gcc -print-file-name=plugin For this purpose, it would be convenient if the compiler object returned by meson.get_compiler(lang) could be used in run_command() directly. This commit implements it. Signed-off-by: Evgenii Shatokhin <eshatokhin@virtuozzo.com>
Diffstat (limited to 'test cases/unit')
-rw-r--r--test cases/unit/23 compiler run_command/meson.build10
1 files changed, 10 insertions, 0 deletions
diff --git a/test cases/unit/23 compiler run_command/meson.build b/test cases/unit/23 compiler run_command/meson.build
new file mode 100644
index 000000000..6d9e0b969
--- /dev/null
+++ b/test cases/unit/23 compiler run_command/meson.build
@@ -0,0 +1,10 @@
+project('compiler_object_in_run_command', 'c')
+cc = meson.get_compiler('c')
+
+# This test only checks that the compiler object can be passed to
+# run_command(). If the compiler has been launched, it is expected
+# to output something either to stdout or to stderr.
+result = run_command(cc, '--version')
+if result.stdout() == '' and result.stderr() == ''
+ error('No output in stdout and stderr. Did the compiler run at all?')
+endif