Makefile.am 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. ## Makefile for the testsuite subdirectory of the GNU C++ Standard library.
  2. ##
  3. ## Copyright (C) 2001-2022 Free Software Foundation, Inc.
  4. ##
  5. ## This file is part of the libstdc++ version 3 distribution.
  6. ## Process this file with automake to produce Makefile.in.
  7. ## This file is part of the GNU ISO C++ Library. This library is free
  8. ## software; you can redistribute it and/or modify it under the
  9. ## terms of the GNU General Public License as published by the
  10. ## Free Software Foundation; either version 3, or (at your option)
  11. ## any later version.
  12. ## This library is distributed in the hope that it will be useful,
  13. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ## GNU General Public License for more details.
  16. ## You should have received a copy of the GNU General Public License along
  17. ## with this library; see the file COPYING3. If not see
  18. ## <http://www.gnu.org/licenses/>.
  19. AUTOMAKE_OPTIONS = nostdinc
  20. RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
  21. EXPECT = expect
  22. include $(top_srcdir)/fragment.am
  23. # Generated lists of files to run. All of these names are valid make
  24. # targets, if you wish to generate a list manually.
  25. lists_of_files = \
  26. testsuite_files \
  27. testsuite_files_interactive \
  28. testsuite_files_performance \
  29. testsuite_files_simd
  30. # This rule generates all of the testsuite_files* lists at once.
  31. ${lists_of_files}:
  32. ${glibcxx_srcdir}/scripts/create_testsuite_files \
  33. ${glibcxx_srcdir}/testsuite `${PWD_COMMAND}`
  34. # We need more things in site.exp, but automake completely controls the
  35. # creation of that file; there's no way to append to it without messing up
  36. # the dependancy chains. So we overrule automake. This rule is exactly
  37. # what it would have generated, plus our own additions.
  38. site.exp: Makefile
  39. @echo 'Making a new site.exp file...'
  40. @echo '## these variables are automatically generated by make ##' >site.tmp
  41. @echo '# Do not edit here. If you wish to override these values' >>site.tmp
  42. @echo '# edit the last section' >>site.tmp
  43. @echo 'set tool libstdc++' >>site.tmp
  44. @echo 'set srcdir $(srcdir)' >>site.tmp
  45. @echo "set objdir `pwd`" >>site.tmp
  46. @echo 'set build_alias "$(build_alias)"' >>site.tmp
  47. @echo 'set build_triplet $(build_triplet)' >>site.tmp
  48. @echo 'set host_alias "$(host_alias)"' >>site.tmp
  49. @echo 'set host_triplet $(host_triplet)' >>site.tmp
  50. @echo 'set target_alias "$(target_alias)"' >>site.tmp
  51. @echo 'set target_triplet $(target_triplet)' >>site.tmp
  52. @echo 'set libiconv "$(LIBICONV)"' >>site.tmp
  53. @echo 'set baseline_dir "$(baseline_dir)"' >> site.tmp
  54. @echo 'set baseline_subdir_switch "$(baseline_subdir_switch)"' >> site.tmp
  55. @echo 'set TEST_GCC_EXEC_PREFIX "$(libdir)/gcc/"' >> site.tmp
  56. @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
  57. @test ! -f site.exp || \
  58. sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
  59. @-rm -f site.bak
  60. @test ! -f site.exp || mv site.exp site.bak
  61. @mv site.tmp site.exp
  62. extract_symvers = $(glibcxx_builddir)/scripts/extract_symvers
  63. baseline_subdir := $(shell $(CXX) $(baseline_subdir_switch))
  64. baseline_symbols:
  65. -@(output=${baseline_dir}/${baseline_subdir}/baseline_symbols.txt; \
  66. if test ! -f $${output}; then \
  67. echo "Baseline file doesn't exist."; \
  68. echo "Try 'make new-abi-baseline' to create it."; \
  69. exit 1; \
  70. fi; true)
  71. new-abi-baseline:
  72. -@$(mkinstalldirs) ${baseline_dir}/${baseline_subdir}
  73. -@(output=${baseline_dir}/${baseline_subdir}/baseline_symbols.txt; \
  74. if test -f $${output}; then \
  75. output=$${output}.new; \
  76. t=`echo $${output} | sed 's=.*config/abi/=='`; \
  77. echo "Baseline file already exists, writing to $${t} instead."; \
  78. fi; \
  79. ${extract_symvers} ../src/.libs/libstdc++.so $${output})
  80. %/site.exp: site.exp
  81. -@test -d $* || mkdir $*
  82. @srcdir=`cd $(srcdir); ${PWD_COMMAND}`;
  83. @objdir=`${PWD_COMMAND}`/$*; \
  84. sed -e "s|^set srcdir .*$$|set srcdir $$srcdir|" \
  85. -e "s|^set objdir .*$$|set objdir $$objdir|" \
  86. site.exp > $*/site.exp.tmp
  87. @-rm -f $*/site.bak
  88. @test ! -f $*/site.exp || mv $*/site.exp $*/site.bak
  89. @mv $*/site.exp.tmp $*/site.exp
  90. check_p_numbers0:=1 2 3 4 5 6 7 8 9
  91. check_p_numbers1:=0 $(check_p_numbers0)
  92. check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1)))
  93. check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2)
  94. check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3)))
  95. check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4)
  96. check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5)))
  97. check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6)
  98. check_p_subdirs=$(wordlist 1,$(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),128),$(check_p_numbers))
  99. check_DEJAGNU_normal_targets = $(addprefix check-DEJAGNUnormal,$(check_p_subdirs))
  100. $(check_DEJAGNU_normal_targets): check-DEJAGNUnormal%: normal%/site.exp
  101. # Run the testsuite in normal mode.
  102. check-DEJAGNU $(check_DEJAGNU_normal_targets): check-DEJAGNU%: site.exp
  103. $(if $*,@)AR="$(AR)"; export AR; \
  104. RANLIB="$(RANLIB)"; export RANLIB; \
  105. if [ -z "$*" ] && [ -n "$(filter -j%, $(MFLAGS))" ]; then \
  106. rm -rf normal-parallel || true; \
  107. mkdir normal-parallel; \
  108. $(MAKE) $(AM_MAKEFLAGS) $(check_DEJAGNU_normal_targets); \
  109. rm -rf normal-parallel || true; \
  110. for idx in $(check_p_subdirs); do \
  111. if [ -d normal$$idx ]; then \
  112. mv -f normal$$idx/libstdc++.sum normal$$idx/libstdc++.sum.sep; \
  113. mv -f normal$$idx/libstdc++.log normal$$idx/libstdc++.log.sep; \
  114. fi; \
  115. done; \
  116. $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh \
  117. normal[0-9]*/libstdc++.sum.sep > libstdc++.sum; \
  118. $(SHELL) $(srcdir)/../../contrib/dg-extract-results.sh -L \
  119. normal[0-9]*/libstdc++.log.sep > libstdc++.log; \
  120. exit 0; \
  121. fi; \
  122. srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
  123. EXPECT=$(EXPECT); export EXPECT; \
  124. runtest=$(RUNTEST); \
  125. if [ -z "$$runtest" ]; then runtest=runtest; fi; \
  126. tool=libstdc++; \
  127. if [ -n "$*" ]; then \
  128. if [ -f normal-parallel/finished ]; then rm -rf "$*"; exit 0; fi; \
  129. GCC_RUNTEST_PARALLELIZE_DIR=`${PWD_COMMAND}`/normal-parallel; \
  130. export GCC_RUNTEST_PARALLELIZE_DIR; \
  131. cd "$*"; \
  132. fi; \
  133. if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
  134. $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) \
  135. $(RUNTESTFLAGS); \
  136. if [ -n "$*" ]; then \
  137. touch $$GCC_RUNTEST_PARALLELIZE_DIR/finished; \
  138. fi; \
  139. else \
  140. echo "WARNING: could not find \`runtest'" 1>&2; :;\
  141. fi
  142. check-am:
  143. $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU
  144. .PHONY: check-DEJAGNU
  145. # Use 'new-abi-baseline' to create an initial symbol file. Then run
  146. # 'check-abi' to test for changes against that file.
  147. check-abi: site.exp baseline_symbols
  148. -@runtest $(AM_RUNTESTFLAGS) --tool libstdc++ $(RUNTESTFLAGS) abi.exp
  149. # Runs the testsuite, but in compile only mode.
  150. # Can be used to test sources with non-GNU FE's at various warning
  151. # levels and for checking compile time across releases.
  152. # See script.
  153. compile_script=${glibcxx_srcdir}/scripts/check_compile
  154. check-compile: testsuite_files ${compile_script}
  155. -@(chmod + ${compile_script}; \
  156. ${compile_script} ${glibcxx_srcdir} ${glibcxx_builddir})
  157. # Runs the testsuite/performance tests.
  158. # Some of these tests create large (~75MB) files, allocate huge
  159. # ammounts of memory, or otherwise tie up machine resources. Thus,
  160. # running this is off by default.
  161. # XXX Need to add dependency on libtestc++.a
  162. check_performance_script=${glibcxx_srcdir}/scripts/check_performance
  163. check-performance: testsuite_files_performance ${performance_script}
  164. -@(chmod + ${check_performance_script}; \
  165. CXXFLAGS='$(CXXFLAGS)'; export CXXFLAGS; \
  166. ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir})
  167. # Runs the simd tests.
  168. check-simd: $(srcdir)/experimental/simd/generate_makefile.sh \
  169. ${glibcxx_srcdir}/scripts/check_simd \
  170. testsuite_files_simd \
  171. ${glibcxx_builddir}/scripts/testsuite_flags
  172. @rm -f .simd.summary
  173. @echo "Generating simd testsuite subdirs and Makefiles ..."
  174. @${glibcxx_srcdir}/scripts/check_simd "${glibcxx_srcdir}" "${glibcxx_builddir}" "$(CXXFLAGS)" | \
  175. while read subdir; do \
  176. $(MAKE) -C "$${subdir}"; \
  177. tail -n20 $${subdir}/simd_testsuite.sum | \
  178. grep -A20 -B1 'Summary ===' >> .simd.summary; \
  179. done; \
  180. cat .simd.summary && rm .simd.summary
  181. # Runs the testsuite in debug mode.
  182. debug_flags = "unix/-D_GLIBCXX_DEBUG"
  183. # Runs the testsuite in parallel mode.
  184. libgomp_dir=${glibcxx_builddir}/../libgomp
  185. libgomp_flags=-B${glibcxx_builddir}/../libgomp \
  186. -I${glibcxx_builddir}/../libgomp \
  187. -L${glibcxx_builddir}/../libgomp/.libs -lgomp
  188. atomic_flags=$(ATOMIC_FLAGS)
  189. parallel_flags="unix/-D_GLIBCXX_PARALLEL/-fopenmp"
  190. check-debug: site.exp
  191. outputdir=debug; export outputdir; \
  192. if test ! -d $${outputdir}; then \
  193. mkdir $${outputdir}; \
  194. fi; \
  195. srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
  196. EXPECT=$(EXPECT); export EXPECT; \
  197. $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(debug_flags)" check-DEJAGNU;
  198. check-parallel: site.exp
  199. -@(if test ! -d $${libgomp_dir}; then \
  200. echo "Testing parallel mode failed as libgomp not present."; \
  201. exit 1; \
  202. fi; \
  203. outputdir=parallel; export outputdir; \
  204. if test ! -d $${outputdir}; then \
  205. mkdir $${outputdir}; \
  206. fi; \
  207. srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
  208. EXPECT=$(EXPECT); export EXPECT; \
  209. $(MAKE) CXXFLAGS="$(atomic_flags) $(libgomp_flags)" RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(parallel_flags)" check-DEJAGNU; )
  210. check-performance-parallel: testsuite_files_performance ${performance_script}
  211. -@(chmod + ${check_performance_script}; \
  212. CXXFLAGS="-D_GLIBCXX_PARALLEL -fopenmp $(atomic_flags) $(libgomp_flags)"; export CXXFLAGS; \
  213. ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir})
  214. .PHONY: baseline_symbols new-abi-baseline \
  215. check-abi check-compile check-performance check-parallel
  216. # By adding these files here, automake will remove them for 'make clean'
  217. CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
  218. testsuite_* site.exp abi_check baseline_symbols *TEST* *.dat \
  219. *.ii *.s *.o *.cc *.x *.a *.so *.xml *.raw *.out *.gdb
  220. # To remove directories.
  221. clean-local:
  222. rm -rf de fr debug parallel binaries normal* simd