[test-suite] r281700 - [CUDA] [test-suite] Add test that assert(false)'s.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 15 21:07:36 PDT 2016


Author: jlebar
Date: Thu Sep 15 23:07:35 2016
New Revision: 281700

URL: http://llvm.org/viewvc/llvm-project?rev=281700&view=rev
Log:
[CUDA] [test-suite] Add test that assert(false)'s.

This is mostly so that we know that our other tests are working.

Added:
    test-suite/trunk/External/CUDA/assert.cu
    test-suite/trunk/External/CUDA/assert.reference_output
Modified:
    test-suite/trunk/External/CUDA/CMakeLists.txt

Modified: test-suite/trunk/External/CUDA/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/CUDA/CMakeLists.txt?rev=281700&r1=281699&r2=281700&view=diff
==============================================================================
--- test-suite/trunk/External/CUDA/CMakeLists.txt (original)
+++ test-suite/trunk/External/CUDA/CMakeLists.txt Thu Sep 15 23:07:35 2016
@@ -43,6 +43,7 @@ endmacro()
 
 # Create targets for CUDA tests that are part of the test suite.
 macro(create_local_cuda_tests VariantSuffix)
+  create_one_local_test(assert assert.cu)
   create_one_local_test(axpy axpy.cu)
   create_one_local_test(cmath cmath.cu)
   create_one_local_test(math_h math_h.cu)

Added: test-suite/trunk/External/CUDA/assert.cu
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/CUDA/assert.cu?rev=281700&view=auto
==============================================================================
--- test-suite/trunk/External/CUDA/assert.cu (added)
+++ test-suite/trunk/External/CUDA/assert.cu Thu Sep 15 23:07:35 2016
@@ -0,0 +1,18 @@
+#undef NDEBUG
+
+#include <assert.h>
+#include <stdio.h>
+
+__global__ void kernel() {
+  // Our reference output contains the line number of this assert() call; be
+  // careful when modifying the parts of this file above this line.
+  assert(false);
+}
+
+int main() {
+  kernel<<<1,1>>>();
+  cudaError_t err = cudaDeviceSynchronize();
+  if (err != cudaErrorAssert)
+    return err;
+  return 0;
+}

Added: test-suite/trunk/External/CUDA/assert.reference_output
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/CUDA/assert.reference_output?rev=281700&view=auto
==============================================================================
--- test-suite/trunk/External/CUDA/assert.reference_output (added)
+++ test-suite/trunk/External/CUDA/assert.reference_output Thu Sep 15 23:07:35 2016
@@ -0,0 +1,2 @@
+../External/CUDA/assert.cu:7: void kernel(): block: [0,0,0], thread: [0,0,0] Assertion `false` failed.
+exit 0




More information about the llvm-commits mailing list