destroy_task_on_error_test.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2012-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. *
  5. * StarPU is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * StarPU is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. static void
  17. good_0(void)
  18. {
  19. struct starpu_task *task;
  20. task = starpu_task_create();
  21. int ret = starpu_task_submit(task);
  22. if (ret == -ENODEV)
  23. {
  24. fprintf(stderr, "fail\n");
  25. starpu_task_destroy(task);
  26. }
  27. }
  28. static void
  29. bad_0(void)
  30. {
  31. struct starpu_task *task1, *task2;
  32. task1 = starpu_task_create();
  33. int ret = starpu_task_submit(task1);
  34. if (ret == -ENODEV)
  35. {
  36. fprintf(stderr, "Fail\n");
  37. }
  38. task2 = starpu_task_create();
  39. ret = starpu_task_submit(task2);
  40. if (ret == -ENODEV)
  41. {
  42. fprintf(stderr, "Fail\n");
  43. }
  44. }
  45. static void
  46. bad_unlikely(void)
  47. {
  48. struct starpu_task *task;
  49. task = starpu_task_create();
  50. int ret = starpu_task_submit(task);
  51. if (STARPU_UNLIKELY(ret == -ENODEV))
  52. {
  53. error();
  54. return 1;
  55. }
  56. starpu_task_destroy(task);
  57. }