cilk-plus-dg.exp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # Copyright (C) 2014-2015 Free Software Foundation, Inc.
  2. # This program is free software; you can redistribute it and/or modify
  3. # it under the terms of the GNU General Public License as published by
  4. # the Free Software Foundation; either version 3 of the License, or
  5. # (at your option) any later version.
  6. #
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License
  13. # along with GCC; see the file COPYING3. If not see
  14. # <http://www.gnu.org/licenses/>.
  15. #
  16. # cilkplus_link_flags -- compute library path and flags to find libcilkrts.
  17. # (originally from g++.exp)
  18. #
  19. proc cilkplus_link_flags { paths } {
  20. global srcdir
  21. global ld_library_path
  22. global shlib_ext
  23. set gccpath ${paths}
  24. set flags ""
  25. set shlib_ext [get_shlib_extension]
  26. if { $gccpath != "" } {
  27. if { [file exists "${gccpath}/libcilkrts/.libs/libcilkrts.a"]
  28. || [file exists "${gccpath}/libcilkrts/.libs/libcilkrts.${shlib_ext}"] } {
  29. append flags " -B${gccpath}/libcilkrts/ "
  30. append flags " -L${gccpath}/libcilkrts/.libs"
  31. append ld_library_path ":${gccpath}/libcilkrts/.libs"
  32. }
  33. } else {
  34. global tool_root_dir
  35. set libcilkrts [lookfor_file ${tool_root_dir} libcilkrts]
  36. if { $libcilkrts != "" } {
  37. append flags "-L${libcilkrts} "
  38. append ld_library_path ":${libcilkrts}"
  39. }
  40. }
  41. set_ld_library_path_env_vars
  42. return "$flags"
  43. }
  44. #
  45. # cilkplus_init -- called at the start of each subdir of tests
  46. #
  47. proc cilkplus_init { args } {
  48. global TEST_ALWAYS_FLAGS
  49. global ALWAYS_CXXFLAGS
  50. global TOOL_OPTIONS
  51. global cilkplus_saved_TEST_ALWAYS_FLAGS
  52. set link_flags ""
  53. if ![is_remote host] {
  54. if [info exists TOOL_OPTIONS] {
  55. set link_flags "[cilkplus_link_flags [get_multilibs ${TOOL_OPTIONS}]]"
  56. } else {
  57. set link_flags "[cilkplus_link_flags [get_multilibs]]"
  58. }
  59. }
  60. if [info exists TEST_ALWAYS_FLAGS] {
  61. set cilkplus_saved_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS
  62. }
  63. if [info exists ALWAYS_CXXFLAGS] {
  64. set ALWAYS_CXXFLAGS [concat "{ldflags=$link_flags}" $ALWAYS_CXXFLAGS]
  65. } else {
  66. if [info exists TEST_ALWAYS_FLAGS] {
  67. set TEST_ALWAYS_FLAGS "$link_flags $TEST_ALWAYS_FLAGS"
  68. } else {
  69. set TEST_ALWAYS_FLAGS "$link_flags"
  70. }
  71. }
  72. if { $link_flags != "" } {
  73. return 1
  74. }
  75. return 0
  76. }
  77. #
  78. # cilkplus_finish -- called at the end of each subdir of tests
  79. #
  80. proc cilkplus_finish { args } {
  81. global TEST_ALWAYS_FLAGS
  82. global cilkplus_saved_TEST_ALWAYS_FLAGS
  83. if [info exists cilkplus_saved_TEST_ALWAYS_FLAGS] {
  84. set TEST_ALWAYS_FLAGS $cilkplus_saved_TEST_ALWAYS_FLAGS
  85. } else {
  86. unset TEST_ALWAYS_FLAGS
  87. }
  88. }