aboutsummaryrefslogtreecommitdiff
path: root/test cases/cuda
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-10-27 10:19:42 -0400
committerXavier Claessens <xclaesse@gmail.com>2021-10-27 15:29:44 -0400
commit8eaa2be5d9f6b8cd19ee6c0bcd737b4ba3a0afc5 (patch)
treed37bf671e1aba2edd891f0b7f68c1857a681924c /test cases/cuda
parent6ed13326034f5616b4b886d3831a7168841460c4 (diff)
downloadmeson-8eaa2be5d9f6b8cd19ee6c0bcd737b4ba3a0afc5.zip
meson-8eaa2be5d9f6b8cd19ee6c0bcd737b4ba3a0afc5.tar.gz
meson-8eaa2be5d9f6b8cd19ee6c0bcd737b4ba3a0afc5.tar.bz2
Fix crash when getting cuda options
We could have an OptionOverrideProxy of an OptionOverrideProxy, recursively. This fix is a minimal subset of the refactoring I did in https://github.com/mesonbuild/meson/pull/9394. Instead of faking UserOption we can just do a shallow copy of one and set a new value on it. Fixes: #9448
Diffstat (limited to 'test cases/cuda')
-rw-r--r--test cases/cuda/16 multistd/lib.cu3
-rw-r--r--test cases/cuda/16 multistd/main.cu3
-rw-r--r--test cases/cuda/16 multistd/meson.build8
3 files changed, 12 insertions, 2 deletions
diff --git a/test cases/cuda/16 multistd/lib.cu b/test cases/cuda/16 multistd/lib.cu
new file mode 100644
index 0000000..8b5d5a7
--- /dev/null
+++ b/test cases/cuda/16 multistd/lib.cu
@@ -0,0 +1,3 @@
+int do_cuda_stuff() {
+ return 0;
+}
diff --git a/test cases/cuda/16 multistd/main.cu b/test cases/cuda/16 multistd/main.cu
index a2ffba4..7b06570 100644
--- a/test cases/cuda/16 multistd/main.cu
+++ b/test cases/cuda/16 multistd/main.cu
@@ -7,6 +7,7 @@ auto cuda_devices(void) {
return result;
}
+int do_cuda_stuff();
int main(void) {
int n = cuda_devices();
@@ -16,5 +17,5 @@ int main(void) {
}
std::cout << "Found " << n << "Cuda devices.\n";
- return 0;
+ return do_cuda_stuff();
}
diff --git a/test cases/cuda/16 multistd/meson.build b/test cases/cuda/16 multistd/meson.build
index 47f0629..36709d8 100644
--- a/test cases/cuda/16 multistd/meson.build
+++ b/test cases/cuda/16 multistd/meson.build
@@ -2,6 +2,12 @@ project('C++-CUDA multi-std', 'cpp', 'cuda',
version : '1.0.0',
default_options : ['cpp_std=c++17', 'cuda_std=c++14'])
-exe = executable('prog', 'main.cu')
+# Regression test: Passing override_options used to cause a crash.
+# See https://github.com/mesonbuild/meson/issues/9448.
+libcpp11 = static_library('testcpp11', 'lib.cu',
+ override_options: ['cpp_std=c++11']
+)
+
+exe = executable('prog', 'main.cu', link_with: libcpp11)
# The runtimes leak memory, so ignore it.
test('cudatest', exe, env: ['ASAN_OPTIONS=detect_leaks=0'])