⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sourcebuild.texi

📁 理解和实践操作系统的一本好书
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
@option{-DWIDE}.@item gcc.dg/noncompileThis subdirectory contains tests of code that should not compile anddoes not need any special compilation options.  They are run withmultiple optimization options, since sometimes invalid code crashesthe compiler with optimization.@item gcc.dg/specialFIXME: describe this.@item gcc.c-tortureThis contains particular code fragments which have historically broken easily.These tests are run with multiple optimization options, so tests for featureswhich only break at some optimization levels belong here.  This also containstests to check that certain optimizations occur.  It might be worthwhile toseparate the correctness tests cleanly from the code quality tests, butit hasn't been done yet.@item gcc.c-torture/compatFIXME: describe this.This directory should probably not be used for new tests.@item gcc.c-torture/compileThis testsuite contains test cases that should compile, but do notneed to link or run.  These test cases are compiled with severaldifferent combinations of optimization options.  All warnings aredisabled for these test cases, so this directory is not suitable ifyou wish to test for the presence or absence of compiler warnings.While special options can be set, and tests disabled on specificplatforms, by the use of @file{.x} files, mostly these test casesshould not contain platform dependencies.  FIXME: discuss how definessuch as @code{NO_LABEL_VALUES} and @code{STACK_SIZE} are used.@item gcc.c-torture/executeThis testsuite contains test cases that should compile, link and run;otherwise the same comments as for @file{gcc.c-torture/compile} apply.@item gcc.c-torture/execute/ieeeThis contains tests which are specific to IEEE floating point.@item gcc.c-torture/unsortedFIXME: describe this.This directory should probably not be used for new tests.@item gcc.c-torture/misc-testsThis directory contains C tests that require special handling.  Someof these tests have individual expect files, and others sharespecial-purpose expect files:@table @file@item @code{bprob*.c}Test @option{-fbranch-probabilities} using @file{bprob.exp}, whichin turn uses the generic, language-independent framework(@pxref{profopt Testing, , Support for testing profile-directedoptimizations}).@item @code{dg-*.c}Test the testsuite itself using @file{dg-test.exp}.@item @code{gcov*.c}Test @command{gcov} output using @file{gcov.exp}, which in turn uses thelanguage-independent support (@pxref{gcov Testing, , Support for testing gcov}).@item @code{i386-pf-*.c}Test i386-specific support for data prefetch using @file{i386-prefetch.exp}.@end table@end tableFIXME: merge in @file{testsuite/README.gcc} and discuss the format oftest cases and magic comments more.@node libgcj Tests@subsection The Java library testsuites.Runtime tests are executed via @samp{make check} in the@file{@var{target}/libjava/testsuite} directory in the buildtree.  Additional runtime tests can be checked into this testsuite.Regression testing of the core packages in libgcj is also covered by theMauve testsuite.  The @uref{http://sourceware.org/mauve/,,Mauve Project}develops tests for the Java Class Libraries.  These tests are run as partof libgcj testing by placing the Mauve tree within the libjava testsuitesources at @file{libjava/testsuite/libjava.mauve/mauve}, or by specifyingthe location of that tree when invoking @samp{make}, as in@samp{make MAUVEDIR=~/mauve check}.To detect regressions, a mechanism in @file{mauve.exp} compares thefailures for a test run against the list of expected failures in@file{libjava/testsuite/libjava.mauve/xfails} from the source hierarchy.Update this file when adding new failing tests to Mauve, or when fixingbugs in libgcj that had caused Mauve test failures.We encourage developers to contribute test cases to Mauve.@node gcov Testing@subsection Support for testing @command{gcov}Language-independent support for testing @command{gcov}, and for checkingthat branch profiling produces expected values, is provided by theexpect file @file{gcov.exp}.  @command{gcov} tests also rely on proceduresin @file{gcc.dg.exp} to compile and run the test program.  A typical@command{gcov} test contains the following DejaGnu commands within comments:@smallexample@{ dg-options "-fprofile-arcs -ftest-coverage" @}@{ dg-do run @{ target native @} @}@{ dg-final @{ run-gcov sourcefile @} @}@end smallexampleChecks of @command{gcov} output can include line counts, branch percentages,and call return percentages.  All of these checks are requested viacommands that appear in comments in the test's source file.Commands to check line counts are processed by default.Commands to check branch percentages and call return percentages areprocessed if the @command{run-gcov} command has arguments @code{branches}or @code{calls}, respectively.  For example, the following specifieschecking both, as well as passing @option{-b} to @command{gcov}:@smallexample@{ dg-final @{ run-gcov branches calls @{ -b sourcefile @} @} @}@end smallexampleA line count command appears within a comment on the source linethat is expected to get the specified count and has the form@code{count(@var{cnt})}.  A test should only check line counts forlines that will get the same count for any architecture.Commands to check branch percentages (@code{branch}) and callreturn percentages (@code{returns}) are very similar to each other.A beginning command appears on or before the first of a range oflines that will report the percentage, and the ending commandfollows that range of lines.  The beginning command can include alist of percentages, all of which are expected to be found withinthe range.  A range is terminated by the next command of the samekind.  A command @code{branch(end)} or @code{returns(end)} marksthe end of a range without starting a new one.  For example:@smallexampleif (i > 10 && j > i && j < 20)  /* @r{branch(27 50 75)} */                                /* @r{branch(end)} */  foo (i, j);@end smallexampleFor a call return percentage, the value specified is thepercentage of calls reported to return.  For a branch percentage,the value is either the expected percentage or 100 minus thatvalue, since the direction of a branch can differ depending on thetarget or the optimization level.Not all branches and calls need to be checked.  A test should notcheck for branches that might be optimized away or replaced withpredicated instructions.  Don't check for calls inserted by thecompiler or ones that might be inlined or optimized away.A single test can check for combinations of line counts, branchpercentages, and call return percentages.  The command to check aline count must appear on the line that will report that count, butcommands to check branch percentages and call return percentages canbracket the lines that report them.@node profopt Testing@subsection Support for testing profile-directed optimizationsThe file @file{profopt.exp} provides language-independent support forchecking correct execution of a test built with profile-directedoptimization.  This testing requires that a test program be built andexecuted twice.  The first time it is compiled to generate profiledata, and the second time it is compiled to use the data that wasgenerated during the first execution.  The second execution is toverify that the test produces the expected results.To check that the optimization actually generated better code, atest can be built and run a third time with normal optimizations toverify that the performance is better with the profile-directedoptimizations.  @file{profopt.exp} has the beginnings of this kindof support.@file{profopt.exp} provides generic support for profile-directedoptimizations.  Each set of tests that uses it provides informationabout a specific optimization:@table @code@item tooltool being tested, e.g., @command{gcc}@item profile_optionoptions used to generate profile data@item feedback_optionoptions used to optimize using that profile data@item prof_extsuffix of profile data files@item PROFOPT_OPTIONSlist of options with which to run each test, similar to the lists fortorture tests@end table@node compat Testing@subsection Support for testing binary compatibilityThe file @file{compat.exp} provides language-independent support forbinary compatibility testing.  It supports testing interoperability oftwo compilers that follow the same ABI, or of multiple sets ofcompiler options that should not affect binary compatibility.  It isintended to be used for testsuites that complement ABI testsuites.A test supported by this framework has three parts, each in aseparate source file: a main program and two pieces that interactwith each other to split up the functionality being tested.@table @file@item @var{testname}_main.@var{suffix}Contains the main program, which calls a function in file@file{@var{testname}_x.@var{suffix}}.@item @var{testname}_x.@var{suffix}Contains at least one call to a function in@file{@var{testname}_y.@var{suffix}}.@item @var{testname}_y.@var{suffix}Shares data with, or gets arguments from,@file{@var{testname}_x.@var{suffix}}.@end tableWithin each test, the main program and one functional piece arecompiled by the GCC under test.  The other piece can be compiled byan alternate compiler.  If no alternate compiler is specified,then all three source files are all compiled by the GCC under test.You can specify pairs of sets of compiler options.  The first elementof such a pair specifies options used with the GCC under test, and thesecond element of the pair specifies options used with the alternatecompiler.  Each test is compiled with each pair of options.@file{compat.exp} defines default pairs of compiler options.These can be overridden by defining the environment variable@env{COMPAT_OPTIONS} as:@smallexampleCOMPAT_OPTIONS="[list [list @{@var{tst1}@} @{@var{alt1}@}]  @dots{}[list @{@var{tstn}@} @{@var{altn}@}]]"@end smallexamplewhere @var{tsti} and @var{alti} are lists of options, with @var{tsti}used by the compiler under test and @var{alti} used by the alternatecompiler.  For example, with@code{[list [list @{-g -O0@} @{-O3@}] [list @{-fpic@} @{-fPIC -O2@}]]},the test is first built with @option{-g -O0} by the compiler undertest and with @option{-O3} by the alternate compiler.  The test isbuilt a second time using @option{-fpic} by the compiler under testand @option{-fPIC -O2} by the alternate compiler.An alternate compiler is specified by defining an environmentvariable to be the full pathname of an installed compiler; for Cdefine @env{ALT_CC_UNDER_TEST}, and for C++ define@env{ALT_CXX_UNDER_TEST}.  These will be written to the@file{site.exp} file used by DejaGnu.  The default is to build eachtest with the compiler under test using the first of each pair ofcompiler options from @env{COMPAT_OPTIONS}.  When@env{ALT_CC_UNDER_TEST} or@env{ALT_CXX_UNDER_TEST} is @code{same}, each test is built usingthe compiler under test but with combinations of the options from@env{COMPAT_OPTIONS}.To run only the C++ compatibility suite using the compiler under testand another version of GCC using specific compiler options, do thefollowing from @file{@var{objdir}/gcc}:@smallexamplerm site.expmake -k \  ALT_CXX_UNDER_TEST=$@{alt_prefix@}/bin/g++ \  COMPAT_OPTIONS="lists as shown above" \  check-c++ \  RUNTESTFLAGS="compat.exp"@end smallexampleA test that fails when the source files are compiled with differentcompilers, but passes when the files are compiled with the samecompiler, demonstrates incompatibility of the generated code orruntime support.  A test that fails for the alternate compiler butpasses for the compiler under test probably tests for a bug that wasfixed in the compiler under test but is present in the alternatecompiler.The binary compatibility tests support a small number of test frameworkcommands that appear within comments in a test file.@table @code@item dg-require-*These commands can be used in @file{@var{testname}_main.@var{suffix}}to skip the test if specific support is not available on the target.@item dg-optionsThe specified options are used for compiling this particular sourcefile, appended to the options from @env{COMPAT_OPTIONS}.  When thiscommand appears in @file{@var{testname}_main.@var{suffix}} the optionsare also used to link the test program.@item dg-xfail-ifThis command can be used in a secondary source file to specify thatcompilation is expected to fail for particular options on particulartargets.@end table

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -