From 71be873be22d38d1b156b9811fea3ed01781dc55 Mon Sep 17 00:00:00 2001 From: Carlos Bederian Date: Thu, 15 Oct 2020 23:35:39 -0300 Subject: [PATCH] Add CUDA compiler header symbol tests --- .../14 cuda has header symbol/meson.build | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test cases/cuda/14 cuda has header symbol/meson.build diff --git a/test cases/cuda/14 cuda has header symbol/meson.build b/test cases/cuda/14 cuda has header symbol/meson.build new file mode 100644 index 000000000..b29c52e58 --- /dev/null +++ b/test cases/cuda/14 cuda has header symbol/meson.build @@ -0,0 +1,27 @@ +project('cuda has header symbol', 'cuda') + +cuda = meson.get_compiler('cuda') + +# C checks +assert (cuda.has_header_symbol('stdio.h', 'int'), 'base types should always be available') +assert (cuda.has_header_symbol('stdio.h', 'printf'), 'printf function not found') +assert (cuda.has_header_symbol('stdio.h', 'FILE'), 'FILE structure not found') +assert (cuda.has_header_symbol('limits.h', 'INT_MAX'), 'INT_MAX define not found') +assert (not cuda.has_header_symbol('limits.h', 'guint64'), 'guint64 is not defined in limits.h') +assert (not cuda.has_header_symbol('stdlib.h', 'FILE'), 'FILE structure is defined in stdio.h, not stdlib.h') +assert (not cuda.has_header_symbol('stdlol.h', 'printf'), 'stdlol.h shouldn\'t exist') +assert (not cuda.has_header_symbol('stdlol.h', 'int'), 'shouldn\'t be able to find "int" with invalid header') + +# C++ checks +assert (cuda.has_header_symbol('iostream', 'std::iostream'), 'iostream not found in iostream.h') +assert (cuda.has_header_symbol('vector', 'std::vector'), 'vector not found in vector.h') +assert (not cuda.has_header_symbol('limits.h', 'std::iostream'), 'iostream should not be defined in limits.h') + +# CUDA checks +assert (cuda.has_header_symbol('cuda.h', 'CUDA_VERSION'), 'CUDA_VERSION not found in cuda.h') +assert (not cuda.has_header_symbol('cuda.h', 'cublasSaxpy'), 'cublasSaxpy is defined in cublas.h, not cuda.h') +if cuda.version().version_compare('>=4.0') + assert (cuda.has_header_symbol('thrust/device_vector.h', 'thrust::device_vector'), 'thrust::device_vector not found') + assert (not cuda.has_header_symbol('thrust/fill.h', 'thrust::sort'), 'thrust::sort should not be defined in thrust/fill.h') +endif +