[PATCH] D39502: [Driver] Make clang/cc conforms to UNIX standard

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 6 14:08:12 PST 2017


tra added a comment.

In https://reviews.llvm.org/D39502#917097, @steven_wu wrote:

> Also, the reason I don't know how to craft a testcase is not because I have
>  trouble with CUDA driver, but how to write a test to check when did the driver
>  bailed out. Let me know if you have any suggestions.


Here's one way to do it: Run 'cc -v', positively match cc1 invocations that worked and CHECK-NOT for cc1 invocations that would happen after bail-out point. 
Use preprocessor to induce the failure during particular compilation phase:

  # if __CUDA_ARCH__ == 350
  #error Error during compilation for sm_35
  #endif
  
  #ifndef __CUDA_ARCH__
  #error Error during host compilation
  #endif


https://reviews.llvm.org/D39502





More information about the cfe-commits mailing list