testFail.c 676 B

123456789101112131415161718192021222324
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing#kwsys for details. */
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. int testFail(int argc, char* argv[])
  7. {
  8. char* env = getenv("DASHBOARD_TEST_FROM_CTEST");
  9. int oldCtest = 0;
  10. if (env) {
  11. if (strcmp(env, "1") == 0) {
  12. oldCtest = 1;
  13. }
  14. printf("DASHBOARD_TEST_FROM_CTEST = %s\n", env);
  15. }
  16. printf("%s: This test intentionally fails\n", argv[0]);
  17. if (oldCtest) {
  18. printf("The version of ctest is not able to handle intentionally failing "
  19. "tests, so pass.\n");
  20. return 0;
  21. }
  22. return argc;
  23. }