@@ -39,6 +39,7 @@ mod book_tests;
3939mod bootstrap_self_tests;
4040mod devtool_tests;
4141mod miri_tests;
42+ mod rustdoc_tests;
4243mod test_helpers;
4344mod tidy;
4445
@@ -58,6 +59,9 @@ pub(crate) use compiletest_suites::{
5859pub ( crate ) use devtool_tests:: { Cargo , Clippy , RustAnalyzer , Rustfmt } ;
5960pub ( crate ) use doc_tool_tests:: { HtmlCheck , Linkcheck } ;
6061pub ( crate ) use miri_tests:: { CargoMiri , Miri } ;
62+ pub ( crate ) use rustdoc_tests:: { CrateRustdoc , CrateRustdocJsonTypes , RustdocTheme } ;
63+ pub ( crate ) use std_tests:: TestFloatParse ;
64+ pub ( crate ) use test_helpers:: Crate ;
6165pub ( crate ) use tidy:: Tidy ;
6266
6367const ADB_TEST_DIR : & str = "/data/local/tmp/work" ;
@@ -1759,167 +1763,6 @@ impl Step for Crate {
17591763 }
17601764}
17611765
1762- /// Rustdoc is special in various ways, which is why this step is different from `Crate`.
1763- #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1764- pub struct CrateRustdoc {
1765- host : TargetSelection ,
1766- }
1767-
1768- impl Step for CrateRustdoc {
1769- type Output = ( ) ;
1770- const DEFAULT : bool = true ;
1771- const ONLY_HOSTS : bool = true ;
1772-
1773- fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
1774- run. paths ( & [ "src/librustdoc" , "src/tools/rustdoc" ] )
1775- }
1776-
1777- fn make_run ( run : RunConfig < ' _ > ) {
1778- let builder = run. builder ;
1779-
1780- builder. ensure ( CrateRustdoc { host : run. target } ) ;
1781- }
1782-
1783- fn run ( self , builder : & Builder < ' _ > ) {
1784- let target = self . host ;
1785-
1786- let compiler = if builder. download_rustc ( ) {
1787- builder. compiler ( builder. top_stage , target)
1788- } else {
1789- // Use the previous stage compiler to reuse the artifacts that are
1790- // created when running compiletest for tests/rustdoc. If this used
1791- // `compiler`, then it would cause rustdoc to be built *again*, which
1792- // isn't really necessary.
1793- builder. compiler_for ( builder. top_stage , target, target)
1794- } ;
1795- // NOTE: normally `ensure(Rustc)` automatically runs `ensure(Std)` for us. However, when
1796- // using `download-rustc`, the rustc_private artifacts may be in a *different sysroot* from
1797- // the target rustdoc (`ci-rustc-sysroot` vs `stage2`). In that case, we need to ensure this
1798- // explicitly to make sure it ends up in the stage2 sysroot.
1799- builder. ensure ( compile:: Std :: new ( compiler, target) ) ;
1800- builder. ensure ( compile:: Rustc :: new ( compiler, target) ) ;
1801-
1802- let mut cargo = tool:: prepare_tool_cargo (
1803- builder,
1804- compiler,
1805- Mode :: ToolRustc ,
1806- target,
1807- builder. kind ,
1808- "src/tools/rustdoc" ,
1809- SourceType :: InTree ,
1810- & [ ] ,
1811- ) ;
1812- if self . host . contains ( "musl" ) {
1813- cargo. arg ( "'-Ctarget-feature=-crt-static'" ) ;
1814- }
1815-
1816- // This is needed for running doctests on librustdoc. This is a bit of
1817- // an unfortunate interaction with how bootstrap works and how cargo
1818- // sets up the dylib path, and the fact that the doctest (in
1819- // html/markdown.rs) links to rustc-private libs. For stage1, the
1820- // compiler host dylibs (in stage1/lib) are not the same as the target
1821- // dylibs (in stage1/lib/rustlib/...). This is different from a normal
1822- // rust distribution where they are the same.
1823- //
1824- // On the cargo side, normal tests use `target_process` which handles
1825- // setting up the dylib for a *target* (stage1/lib/rustlib/... in this
1826- // case). However, for doctests it uses `rustdoc_process` which only
1827- // sets up the dylib path for the *host* (stage1/lib), which is the
1828- // wrong directory.
1829- //
1830- // Recall that we special-cased `compiler_for(top_stage)` above, so we always use stage1.
1831- //
1832- // It should be considered to just stop running doctests on
1833- // librustdoc. There is only one test, and it doesn't look too
1834- // important. There might be other ways to avoid this, but it seems
1835- // pretty convoluted.
1836- //
1837- // See also https://github.com/rust-lang/rust/issues/13983 where the
1838- // host vs target dylibs for rustdoc are consistently tricky to deal
1839- // with.
1840- //
1841- // Note that this set the host libdir for `download_rustc`, which uses a normal rust distribution.
1842- let libdir = if builder. download_rustc ( ) {
1843- builder. rustc_libdir ( compiler)
1844- } else {
1845- builder. sysroot_target_libdir ( compiler, target) . to_path_buf ( )
1846- } ;
1847- let mut dylib_path = dylib_path ( ) ;
1848- dylib_path. insert ( 0 , PathBuf :: from ( & * libdir) ) ;
1849- cargo. env ( dylib_path_var ( ) , env:: join_paths ( & dylib_path) . unwrap ( ) ) ;
1850-
1851- run_cargo_test (
1852- cargo,
1853- & [ ] ,
1854- & [ "rustdoc:0.0.0" . to_string ( ) ] ,
1855- "rustdoc" ,
1856- "rustdoc" ,
1857- target,
1858- builder,
1859- ) ;
1860- }
1861- }
1862-
1863- #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1864- pub struct CrateRustdocJsonTypes {
1865- host : TargetSelection ,
1866- }
1867-
1868- impl Step for CrateRustdocJsonTypes {
1869- type Output = ( ) ;
1870- const DEFAULT : bool = true ;
1871- const ONLY_HOSTS : bool = true ;
1872-
1873- fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
1874- run. path ( "src/rustdoc-json-types" )
1875- }
1876-
1877- fn make_run ( run : RunConfig < ' _ > ) {
1878- let builder = run. builder ;
1879-
1880- builder. ensure ( CrateRustdocJsonTypes { host : run. target } ) ;
1881- }
1882-
1883- fn run ( self , builder : & Builder < ' _ > ) {
1884- let target = self . host ;
1885-
1886- // Use the previous stage compiler to reuse the artifacts that are
1887- // created when running compiletest for tests/rustdoc. If this used
1888- // `compiler`, then it would cause rustdoc to be built *again*, which
1889- // isn't really necessary.
1890- let compiler = builder. compiler_for ( builder. top_stage , target, target) ;
1891- builder. ensure ( compile:: Rustc :: new ( compiler, target) ) ;
1892-
1893- let cargo = tool:: prepare_tool_cargo (
1894- builder,
1895- compiler,
1896- Mode :: ToolRustc ,
1897- target,
1898- builder. kind ,
1899- "src/rustdoc-json-types" ,
1900- SourceType :: InTree ,
1901- & [ ] ,
1902- ) ;
1903-
1904- // FIXME: this looks very wrong, libtest doesn't accept `-C` arguments and the quotes are fishy.
1905- let libtest_args = if self . host . contains ( "musl" ) {
1906- [ "'-Ctarget-feature=-crt-static'" ] . as_slice ( )
1907- } else {
1908- & [ ]
1909- } ;
1910-
1911- run_cargo_test (
1912- cargo,
1913- libtest_args,
1914- & [ "rustdoc-json-types" . to_string ( ) ] ,
1915- "rustdoc-json-types" ,
1916- "rustdoc-json-types" ,
1917- target,
1918- builder,
1919- ) ;
1920- }
1921- }
1922-
19231766/// Some test suites are run inside emulators or on remote devices, and most
19241767/// of our test binaries are linked dynamically which means we need to ship
19251768/// the standard library and such to the emulator ahead of time. This step
0 commit comments