aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/common/26 find program
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/common/26 find program
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/common/26 find program')
-rw-r--r--meson/test cases/common/26 find program/meson.build35
-rw-r--r--meson/test cases/common/26 find program/print-version-with-prefix.py8
-rw-r--r--meson/test cases/common/26 find program/print-version.py8
-rw-r--r--meson/test cases/common/26 find program/scripts/test_subdir.py3
-rw-r--r--meson/test cases/common/26 find program/source.in3
5 files changed, 57 insertions, 0 deletions
diff --git a/meson/test cases/common/26 find program/meson.build b/meson/test cases/common/26 find program/meson.build
new file mode 100644
index 000000000..3b59caa93
--- /dev/null
+++ b/meson/test cases/common/26 find program/meson.build
@@ -0,0 +1,35 @@
+project('find program', 'c')
+
+if build_machine.system() == 'windows'
+ # Things Windows does not provide:
+ # - an executable to copy files without prompting
+ # - working command line quoting
+ # - anything that you might actually need
+ # Because of these reasons we only check that
+ # the program can be found.
+ cp = find_program('xcopy')
+else
+ cp = find_program('donotfindme', 'cp')
+ gen = generator(cp, \
+ output : '@BASENAME@.c', \
+ arguments : ['@INPUT@', '@OUTPUT@'])
+
+ generated = gen.process('source.in')
+ e = executable('prog', generated)
+ test('external exe', e)
+endif
+
+prog = find_program('print-version.py', version : '>=2.0', required : false)
+assert(not prog.found(), 'Version should be too old')
+
+prog = find_program('print-version.py', version : '>=1.0')
+assert(prog.found(), 'Program version should match')
+
+prog = find_program('print-version-with-prefix.py', version : '>=1.0')
+assert(prog.found(), 'Program version should match')
+
+prog = find_program('test_subdir.py', required : false)
+assert(not prog.found(), 'Program should not be found')
+
+prog = find_program('test_subdir.py', dirs : ['/donotexist', meson.current_source_dir() / 'scripts'])
+assert(prog.found(), 'Program should be found')
diff --git a/meson/test cases/common/26 find program/print-version-with-prefix.py b/meson/test cases/common/26 find program/print-version-with-prefix.py
new file mode 100644
index 000000000..520e0ba8c
--- /dev/null
+++ b/meson/test cases/common/26 find program/print-version-with-prefix.py
@@ -0,0 +1,8 @@
+#!/usr/bin/env python3
+
+import sys
+
+if len(sys.argv) != 2 or sys.argv[1] != '--version':
+ exit(1)
+
+print('Version: 1.0')
diff --git a/meson/test cases/common/26 find program/print-version.py b/meson/test cases/common/26 find program/print-version.py
new file mode 100644
index 000000000..4a78e5b85
--- /dev/null
+++ b/meson/test cases/common/26 find program/print-version.py
@@ -0,0 +1,8 @@
+#!/usr/bin/env python3
+
+import sys
+
+if len(sys.argv) != 2 or sys.argv[1] != '--version':
+ exit(1)
+
+print('1.0')
diff --git a/meson/test cases/common/26 find program/scripts/test_subdir.py b/meson/test cases/common/26 find program/scripts/test_subdir.py
new file mode 100644
index 000000000..947ffe408
--- /dev/null
+++ b/meson/test cases/common/26 find program/scripts/test_subdir.py
@@ -0,0 +1,3 @@
+#!/usr/bin/env python3
+
+exit(0)
diff --git a/meson/test cases/common/26 find program/source.in b/meson/test cases/common/26 find program/source.in
new file mode 100644
index 000000000..03b2213bb
--- /dev/null
+++ b/meson/test cases/common/26 find program/source.in
@@ -0,0 +1,3 @@
+int main(void) {
+ return 0;
+}