aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-06-10 01:49:16 +0300
committerGitHub <noreply@github.com>2019-06-10 01:49:16 +0300
commit06df6e463f3d7f62676f8f9ce0cf81fbb4058eaf (patch)
treed6e80b4aa73a30e31861d35aa00127fd625fcca8 /test cases
parent6b4b601eafc5320e62060f39da5acad7c3007942 (diff)
parent6d6af46edcb765d7046533fdad4d03b0c0c9cd64 (diff)
downloadmeson-06df6e463f3d7f62676f8f9ce0cf81fbb4058eaf.zip
meson-06df6e463f3d7f62676f8f9ce0cf81fbb4058eaf.tar.gz
meson-06df6e463f3d7f62676f8f9ce0cf81fbb4058eaf.tar.bz2
Merge pull request #4010 from Ericson2314/purge-cross-conditional-preview
Purge much `is_cross` and `<things>_cross` without changing user interfaces---includes on #5263
Diffstat (limited to 'test cases')
-rw-r--r--test cases/unit/55 pkg_config_path option/meson.build7
-rwxr-xr-xtest cases/unit/58 identity cross/build_wrapper.py5
-rwxr-xr-xtest cases/unit/58 identity cross/host_wrapper.py5
-rw-r--r--test cases/unit/58 identity cross/meson.build15
-rw-r--r--test cases/unit/58 identity cross/stuff.h27
5 files changed, 53 insertions, 6 deletions
diff --git a/test cases/unit/55 pkg_config_path option/meson.build b/test cases/unit/55 pkg_config_path option/meson.build
index 3af6164..f9ceead 100644
--- a/test cases/unit/55 pkg_config_path option/meson.build
+++ b/test cases/unit/55 pkg_config_path option/meson.build
@@ -3,10 +3,5 @@ project('pkg_config_path option')
build = dependency('totally_made_up_dep', native: true, method : 'pkg-config')
host = dependency('totally_made_up_dep', native: false, method : 'pkg-config')
-# TODO always test we can do this separately
-if meson.is_cross_build()
- assert(build.version() == '4.5.6', 'wrong version for build machine dependency')
-else
- assert(host.version() == '1.2.3', 'wrong version for host machine dependency')
-endif
+assert(build.version() == '4.5.6', 'wrong version for build machine dependency')
assert(host.version() == '1.2.3', 'wrong version for host machine dependency')
diff --git a/test cases/unit/58 identity cross/build_wrapper.py b/test cases/unit/58 identity cross/build_wrapper.py
new file mode 100755
index 0000000..22e8b5d
--- /dev/null
+++ b/test cases/unit/58 identity cross/build_wrapper.py
@@ -0,0 +1,5 @@
+#!/usr/bin/env python
+
+import subprocess, sys
+
+subprocess.call(["cc", "-DEXTERNAL_BUILD"] + sys.argv[1:])
diff --git a/test cases/unit/58 identity cross/host_wrapper.py b/test cases/unit/58 identity cross/host_wrapper.py
new file mode 100755
index 0000000..5b4eed8
--- /dev/null
+++ b/test cases/unit/58 identity cross/host_wrapper.py
@@ -0,0 +1,5 @@
+#!/usr/bin/env python
+
+import subprocess, sys
+
+subprocess.call(["cc", "-DEXTERNAL_HOST"] + sys.argv[1:])
diff --git a/test cases/unit/58 identity cross/meson.build b/test cases/unit/58 identity cross/meson.build
new file mode 100644
index 0000000..950137a
--- /dev/null
+++ b/test cases/unit/58 identity cross/meson.build
@@ -0,0 +1,15 @@
+project('identity cross test', 'c')
+
+assert(meson.get_compiler('c', native: true).get_define(
+ 'GOT',
+ args : [ '-DARG_BUILD' ],
+ prefix : '#include "stuff.h"',
+ include_directories: include_directories('.'),
+) == 'BUILD', 'did not get BUILD from native: true compiler')
+
+assert(meson.get_compiler('c', native: false).get_define(
+ 'GOT',
+ args : [ '-DARG_HOST' ],
+ prefix : '#include "stuff.h"',
+ include_directories: include_directories('.'),
+) == 'HOST', 'did not get HOST from native: false compiler')
diff --git a/test cases/unit/58 identity cross/stuff.h b/test cases/unit/58 identity cross/stuff.h
new file mode 100644
index 0000000..62f1cc9
--- /dev/null
+++ b/test cases/unit/58 identity cross/stuff.h
@@ -0,0 +1,27 @@
+#ifdef EXTERNAL_BUILD
+ #ifndef ARG_BUILD
+ #error "External is build but arg_build is not set."
+ #elif defined(ARG_HOST)
+ #error "External is build but arg_host is set."
+ #else
+ #define GOT BUILD
+ #endif
+#endif
+
+#ifdef EXTERNAL_HOST
+ #ifndef ARG_HOST
+ #error "External is host but arg_host is not set."
+ #elif defined(ARG_BUILD)
+ #error "External is host but arg_build is set."
+ #else
+ #define GOT HOST
+ #endif
+#endif
+
+#if defined(EXTERNAL_BUILD) && defined(EXTERNAL_HOST)
+ #error "Both external build and external host set."
+#endif
+
+#if !defined(EXTERNAL_BUILD) && !defined(EXTERNAL_HOST)
+ #error "Neither external build nor external host is set."
+#endif