| 1 | // Test clang driver bails out after one error during CUDA compilation. |
| 2 | |
| 3 | // REQUIRES: clang-driver |
| 4 | // REQUIRES: powerpc-registered-target |
| 5 | // REQUIRES: nvptx-registered-target |
| 6 | |
| 7 | #ifdef FORCE_ERROR |
| 8 | #error compilation failed |
| 9 | #endif |
| 10 | |
| 11 | // RUN: not %clang -target powerpc64le-ibm-linux-gnu -fsyntax-only -nocudalib \ |
| 12 | // RUN: -nocudainc -DFORCE_ERROR %s 2>&1 | FileCheck %s |
| 13 | // RUN: not %clang -target powerpc64le-ibm-linux-gnu -fsyntax-only -nocudalib \ |
| 14 | // RUN: -nocudainc -DFORCE_ERROR --cuda-gpu-arch=sm_35 --cuda-gpu-arch=sm_60 \ |
| 15 | // RUN: %s 2>&1 | FileCheck %s |
| 16 | // RUN: not %clang -target powerpc64le-ibm-linux-gnu -fsyntax-only -nocudalib \ |
| 17 | // RUN: -nocudainc -DFORCE_ERROR --cuda-gpu-arch=sm_35 --cuda-gpu-arch=sm_60 \ |
| 18 | // RUN: --cuda-device-only %s 2>&1 | FileCheck %s |
| 19 | |
| 20 | #if defined(ERROR_HOST) && !defined(__CUDA_ARCH__) |
| 21 | #error compilation failed |
| 22 | #endif |
| 23 | |
| 24 | #if defined(ERROR_SM35) && (__CUDA_ARCH__ == 350) |
| 25 | #error compilation failed |
| 26 | #endif |
| 27 | |
| 28 | #if defined(ERROR_SM60) && (__CUDA_ARCH__ == 600) |
| 29 | #error compilation failed |
| 30 | #endif |
| 31 | |
| 32 | // RUN: not %clang -target powerpc64le-ibm-linux-gnu -fsyntax-only -nocudalib \ |
| 33 | // RUN: -nocudainc -DERROR_HOST --cuda-gpu-arch=sm_35 --cuda-gpu-arch=sm_60 \ |
| 34 | // RUN: %s 2>&1 | FileCheck %s |
| 35 | // RUN: not %clang -target powerpc64le-ibm-linux-gnu -fsyntax-only -nocudalib \ |
| 36 | // RUN: -nocudainc -DERROR_SM35 --cuda-gpu-arch=sm_35 --cuda-gpu-arch=sm_60 \ |
| 37 | // RUN: --cuda-device-only %s 2>&1 | FileCheck %s |
| 38 | // RUN: not %clang -target powerpc64le-ibm-linux-gnu -fsyntax-only -nocudalib \ |
| 39 | // RUN: -nocudainc -DERROR_SM60 --cuda-gpu-arch=sm_35 --cuda-gpu-arch=sm_60 \ |
| 40 | // RUN: --cuda-device-only %s 2>&1 | FileCheck %s |
| 41 | |
| 42 | // RUN: not %clang -target powerpc64le-ibm-linux-gnu -fsyntax-only -nocudalib \ |
| 43 | // RUN: -nocudainc -DERROR_HOST -DERROR_SM35 --cuda-gpu-arch=sm_35 \ |
| 44 | // RUN: --cuda-gpu-arch=sm_60 %s 2>&1 | FileCheck %s |
| 45 | // RUN: not %clang -target powerpc64le-ibm-linux-gnu -fsyntax-only -nocudalib \ |
| 46 | // RUN: -nocudainc -DERROR_HOST -DERROR_SM60 --cuda-gpu-arch=sm_35 \ |
| 47 | // RUN: --cuda-gpu-arch=sm_60 %s 2>&1 | FileCheck %s |
| 48 | // RUN: not %clang -target powerpc64le-ibm-linux-gnu -fsyntax-only -nocudalib \ |
| 49 | // RUN: -nocudainc -DERROR_SM35 -DERROR_SM60 --cuda-gpu-arch=sm_35 \ |
| 50 | // RUN: --cuda-gpu-arch=sm_60 %s 2>&1 | FileCheck %s |
| 51 | |
| 52 | |
| 53 | // CHECK: error: compilation failed |
| 54 | // CHECK-NOT: error: compilation failed |
| 55 | |