tree: d49f032b2d2f0ca137900bc2f317fdc4d9c15ba6
  1. a-b-a-linker-guard/
  2. alloc-no-oom-handling/
  3. alloc-no-rc/
  4. alloc-no-sync/
  5. allocator-shim-circular-deps/
  6. allow-warnings-cmdline-stability/
  7. amdgpu-kd/
  8. apple-c-available-links/
  9. apple-deployment-target/
  10. apple-sdk-version/
  11. archive-corrupt-error/
  12. archive-duplicate-names/
  13. archive-format-error/
  14. arguments-non-c-like-enum/
  15. arm64ec-import-export-static/
  16. artifact-incr-cache/
  17. artifact-incr-cache-no-obj/
  18. atomic-lock-free/
  19. autodiff/
  20. avr-rjmp-offset/
  21. bare-outfile/
  22. bin-emit-no-symbols/
  23. box-struct-no-segfault/
  24. branch-protection-check-IBT/
  25. broken-pipe-no-ice/
  26. c-dynamic-dylib/
  27. c-dynamic-rlib/
  28. c-link-to-rust-dylib/
  29. c-link-to-rust-staticlib/
  30. c-link-to-rust-va-list-fn/
  31. c-static-dylib/
  32. c-static-rlib/
  33. c-unwind-abi-catch-lib-panic/
  34. c-unwind-abi-catch-panic/
  35. cdylib/
  36. cdylib-dylib-linkage/
  37. cdylib-export-c-library-symbols/
  38. cdylib-fewer-symbols/
  39. checksum-freshness/
  40. clear-error-blank-output/
  41. codegen-options-parsing/
  42. comment-section/
  43. compile-stdin/
  44. compiler-lookup-paths/
  45. compiler-lookup-paths-2/
  46. compiler-rt-works-on-mingw/
  47. compiletest-self-test/
  48. compressed-debuginfo/
  49. compressed-debuginfo-zstd/
  50. const-prop-lint/
  51. const-trait-stable-toolchain/
  52. const_fn_mir/
  53. core-no-fp-fmt-parse/
  54. core-no-oom-handling/
  55. cpp-global-destructors/
  56. crate-circular-deps-link/
  57. crate-data-smoke/
  58. crate-hash-rustc-version/
  59. crate-loading/
  60. crate-loading-crate-depends-on-itself/
  61. crate-loading-multiple-candidates/
  62. crate-name-priority/
  63. cross-lang-lto/
  64. cross-lang-lto-clang/
  65. cross-lang-lto-pgo-smoketest-clang/
  66. cross-lang-lto-riscv-abi/
  67. cross-lang-lto-upstream-rlibs/
  68. CURRENT_RUSTC_VERSION/
  69. debug-assertions/
  70. debugger-visualizer-dep-info/
  71. dep-graph/
  72. dep-info/
  73. deref-impl-rustdoc-ice/
  74. diagnostics-traits-from-duplicate-crates/
  75. dirty-incr-due-to-hard-link/
  76. doctests-compilation-time-info/
  77. doctests-junit/
  78. doctests-keep-binaries/
  79. doctests-keep-binaries-2024/
  80. doctests-merge/
  81. doctests-runtool/
  82. dos-device-input/
  83. dump-ice-to-disk/
  84. dump-mono-stats/
  85. duplicate-dependency/
  86. duplicate-dependency-no-disambiguate/
  87. duplicate-output-flavors/
  88. duplicate-profiler-builtins/
  89. dylib-chain/
  90. dylib-soname/
  91. dynamic-loading-cdylib/
  92. embed-metadata/
  93. embed-source-dwarf/
  94. emit/
  95. emit-named-files/
  96. emit-path-unhashed/
  97. emit-shared-files/
  98. emit-stack-sizes/
  99. emit-to-stdout/
  100. env-dep-info/
  101. error-found-staticlib-instead-crate/
  102. error-writing-dependencies/
  103. exit-code/
  104. export/
  105. export-executable-symbols/
  106. extern-diff-internal-name/
  107. extern-flag-disambiguates/
  108. extern-flag-fun/
  109. extern-flag-pathless/
  110. extern-flag-rename-transitive/
  111. extern-fn-explicit-align/
  112. extern-fn-generic/
  113. extern-fn-mangle/
  114. extern-fn-reachable/
  115. extern-fn-slice-no-ice/
  116. extern-fn-struct-passing-abi/
  117. extern-fn-with-extern-types/
  118. extern-fn-with-packed-struct/
  119. extern-fn-with-union/
  120. extern-multiple-copies/
  121. extern-multiple-copies2/
  122. extern-overrides-distribution/
  123. external-crate-panic-handle-no-lint/
  124. extra-filename-with-temp-outputs/
  125. fat-then-thin-lto/
  126. forced-unwind-terminate-pof/
  127. foreign-double-unwind/
  128. foreign-exceptions/
  129. foreign-rust-exceptions/
  130. frontmatter-no-trailing-newline/
  131. glibc-staticlib-args/
  132. glibc-symbols-x86_64-unknown-linux-gnu/
  133. ice-dep-cannot-find-dep/
  134. ice-static-mir/
  135. import-macro-verbatim/
  136. inaccessible-temp-dir/
  137. include-all-symbols-linking/
  138. include-bytes-deps/
  139. incr-add-rust-src-component/
  140. incr-foreign-head-span/
  141. incr-prev-body-beyond-eof/
  142. incr-test-moved-file/
  143. incremental-debugger-visualizer/
  144. incremental-finalize-fail/
  145. incremental-session-fail/
  146. inline-always-many-cgu/
  147. instrument-mcount-link-pg/
  148. interdependent-c-libraries/
  149. intrinsic-unreachable/
  150. invalid-library/
  151. invalid-so/
  152. invalid-staticlib/
  153. invalid-symlink-search-path/
  154. invalid-tmpdir-no-ice/
  155. issue-107495-archive-permissions/
  156. issue-125484-used-dependencies/
  157. issue-149402-suggest-unresolve/
  158. issue-84395-lto-embed-bitcode/
  159. jobserver-error/
  160. json-error-no-offset/
  161. lib-trait-for-trait-no-ice/
  162. libs-through-symlinks/
  163. libstd-no-protected/
  164. libtest-json/
  165. libtest-junit/
  166. libtest-padding/
  167. libtest-thread-limit/
  168. link-arg/
  169. link-args-order/
  170. link-cfg/
  171. link-dedup/
  172. link-eh-frame-terminator/
  173. link-framework/
  174. link-native-static-lib-to-dylib/
  175. link-path-order/
  176. link-under-xcode/
  177. linkage-attr-framework/
  178. linkage-attr-on-static/
  179. linker-plugin-lto-fat/
  180. linker-warning/
  181. llvm-ident/
  182. llvm-location-discriminator-limit-dummy-span/
  183. llvm-outputs/
  184. long-linker-command-lines/
  185. long-linker-command-lines-cmd-exe/
  186. longjmp-across-rust/
  187. ls-metadata/
  188. lto-avoid-object-duplication/
  189. lto-dylib-dep/
  190. lto-empty/
  191. lto-linkage-used-attr/
  192. lto-long-filenames/
  193. lto-long-filenames_cn/
  194. lto-no-link-whole-rlib/
  195. lto-readonly-lib/
  196. lto-smoke/
  197. lto-smoke-c/
  198. macho-link-section/
  199. macos-deployment-target-warning/
  200. macos-fat-archive/
  201. manual-crate-name/
  202. manual-link/
  203. many-crates-but-no-match/
  204. metadata-dep-info/
  205. metadata-flag-frobs-symbols/
  206. metadata-only-crate-no-ice/
  207. min-global-align/
  208. mingw-export-call-convention/
  209. mir-opt-bisect-limit/
  210. mismatching-target-triples/
  211. missing-crate-dependency/
  212. missing-unstable-trait-bound/
  213. mixing-deps/
  214. mixing-formats/
  215. mixing-libs/
  216. moved-src-dir-fingerprint-ice/
  217. msvc-incremental-full-link-info/
  218. msvc-lld-thinlto-imp-symbols/
  219. msvc-wholearchive/
  220. mte-ffi/
  221. multiline-args-value/
  222. multiple-emits/
  223. musl-default-linking/
  224. naked-dead-code-elimination/
  225. naked-symbol-visibility/
  226. native-lib-alt-naming/
  227. native-lib-load-order/
  228. native-link-modifier-bundle/
  229. native-link-modifier-verbatim-linker/
  230. native-link-modifier-verbatim-rustc/
  231. native-link-modifier-whole-archive/
  232. no-alloc-shim/
  233. no-builtins-attribute/
  234. no-builtins-linker-plugin-lto/
  235. no-builtins-lto/
  236. no-cdylib-as-rdylib/
  237. no-duplicate-libs/
  238. no-input-file/
  239. no-intermediate-extras/
  240. non-pie-thread-local/
  241. non-unicode-env/
  242. non-unicode-in-incremental-dir/
  243. notify-all-emit-artifacts/
  244. obey-crate-type-flag/
  245. optimization-remarks-dir/
  246. optimization-remarks-dir-pgo/
  247. option-output-no-space/
  248. output-filename-conflicts-with-directory/
  249. output-filename-overwrites-input/
  250. output-type-permutations/
  251. output-with-hyphens/
  252. override-aliased-flags/
  253. overwrite-input/
  254. panic-abort-eh_frame/
  255. panic-impl-transitive/
  256. parallel-rustc-no-overwrite/
  257. pass-linker-flags/
  258. pass-linker-flags-flavor/
  259. pass-linker-flags-from-dep/
  260. pass-non-c-like-enum-to-c/
  261. pdb-alt-path/
  262. pdb-sobjname/
  263. pgo-branch-weights/
  264. pgo-embed-bc-lto/
  265. pgo-gen/
  266. pgo-gen-lto/
  267. pgo-gen-no-imp-symbols/
  268. pgo-indirect-call-promotion/
  269. pgo-use/
  270. pointer-auth-link-with-c/
  271. pointer-auth-link-with-c-lto-clang/
  272. prefer-dylib/
  273. prefer-rlib/
  274. pretty-print-to-file/
  275. pretty-print-with-dep-file/
  276. print-cfg/
  277. print-check-cfg/
  278. print-crate-root-lint-levels/
  279. print-native-static-libs/
  280. print-request-help-stable-unstable/
  281. print-target-cpus-native/
  282. print-target-list/
  283. print-to-output/
  284. proc-macro-init-order/
  285. proc-macro-three-crates/
  286. prune-link-args/
  287. raw-dylib-alt-calling-convention/
  288. raw-dylib-c/
  289. raw-dylib-cross-compilation/
  290. raw-dylib-custom-dlltool/
  291. raw-dylib-elf/
  292. raw-dylib-elf-extern-types/
  293. raw-dylib-elf-verbatim/
  294. raw-dylib-elf-verbatim-absolute/
  295. raw-dylib-import-name-type/
  296. raw-dylib-inline-cross-dylib/
  297. raw-dylib-link-ordinal/
  298. raw-dylib-stdcall-ordinal/
  299. raw-dylib-whitespace/
  300. raw-fn-pointer-opt-undefined-behavior/
  301. reachable-extern-fn-available-lto/
  302. redundant-libs/
  303. relocation-model/
  304. relro-levels/
  305. remap-path-prefix/
  306. remap-path-prefix-consts/
  307. remap-path-prefix-dwarf/
  308. remap-path-prefix-edge-cases/
  309. remap-path-prefix-std/
  310. remove-dir-all-race/
  311. repr128-dwarf/
  312. reproducible-build/
  313. reproducible-build-2/
  314. reset-codegen-1/
  315. resolve-rename/
  316. return-non-c-like-enum/
  317. return-non-c-like-enum-from-c/
  318. rlib-chain/
  319. rlib-format-packed-bundled-libs/
  320. rlib-format-packed-bundled-libs-2/
  321. rlib-format-packed-bundled-libs-3/
  322. rmeta-preferred/
  323. run-in-tmpdir-self-test/
  324. rust-lld/
  325. rust-lld-custom-target/
  326. rust-lld-link-script-provide/
  327. rust-lld-x86_64-unknown-linux-gnu/
  328. rust-lld-x86_64-unknown-linux-gnu-dist/
  329. rustc-help/
  330. rustc-macro-dep-files/
  331. rustdoc-cfgspec-parsing/
  332. rustdoc-default-output/
  333. rustdoc-dep-info/
  334. rustdoc-determinism/
  335. rustdoc-doctest-output-format/
  336. rustdoc-error-lines/
  337. rustdoc-io-error/
  338. rustdoc-json-external-crate-path/
  339. rustdoc-map-file/
  340. rustdoc-merge-directory/
  341. rustdoc-merge-directory-alias/
  342. rustdoc-merge-no-input-finalize/
  343. rustdoc-output-path/
  344. rustdoc-output-stdout/
  345. rustdoc-scrape-examples-dep-info/
  346. rustdoc-scrape-examples-invalid-expr/
  347. rustdoc-scrape-examples-macros/
  348. rustdoc-scrape-examples-multiple/
  349. rustdoc-scrape-examples-ordering/
  350. rustdoc-scrape-examples-remap/
  351. rustdoc-scrape-examples-test/
  352. rustdoc-scrape-examples-whitespace/
  353. rustdoc-search-load-itemtype/
  354. rustdoc-shared-flags/
  355. rustdoc-target-modifiers/
  356. rustdoc-target-spec-json-path/
  357. rustdoc-tempdir-removal/
  358. rustdoc-test-args/
  359. rustdoc-test-builder/
  360. rustdoc-themes/
  361. rustdoc-verify-output-files/
  362. rustdoc-with-out-dir-option/
  363. rustdoc-with-output-option/
  364. rustdoc-with-short-out-dir-option/
  365. sanitizer-cdylib-link/
  366. sanitizer-dylib-link/
  367. sanitizer-staticlib-link/
  368. separate-link/
  369. separate-link-fail/
  370. share-generics-dylib/
  371. share-generics-export-again/
  372. short-ice/
  373. silly-file-names/
  374. simd-ffi/
  375. split-debuginfo/
  376. stable-symbol-names/
  377. static-dylib-by-default/
  378. static-extern-type/
  379. static-pie/
  380. static-unwinding/
  381. staticlib-blank-lib/
  382. staticlib-broken-bitcode/
  383. staticlib-dylib-linkage/
  384. staticlib-thin-archive/
  385. std-core-cycle/
  386. stdin-rustc/
  387. stdin-rustdoc/
  388. strip/
  389. suspicious-library/
  390. symbol-mangling-hashed/
  391. symbol-visibility/
  392. symbols-all-mangled/
  393. symbols-include-type-name/
  394. symlinked-extern/
  395. symlinked-libraries/
  396. symlinked-rlib/
  397. sysroot-crates-are-unstable/
  398. target-cpu-native/
  399. target-specs/
  400. target-without-atomic-cas/
  401. test-benches/
  402. test-harness/
  403. textrel-on-minimal-lib/
  404. thumb-interworking/
  405. track-path-dep-info/
  406. track-pgo-dep-info/
  407. type-mismatch-same-crate-name/
  408. unknown-mod-stdin/
  409. unstable-feature-usage-metrics/
  410. unstable-feature-usage-metrics-incremental/
  411. unstable-flag-required/
  412. use-suggestions-rust-2018/
  413. used/
  414. used-cdylib-macos/
  415. used-proc-macro/
  416. version-check/
  417. version-verbose-commit-hash/
  418. volatile-intrinsics/
  419. wasm-custom-section/
  420. wasm-custom-sections-opt/
  421. wasm-emscripten-cdylib/
  422. wasm-exceptions-nostd/
  423. wasm-export-all-symbols/
  424. wasm-import-module/
  425. wasm-override-linker/
  426. wasm-panic-small/
  427. wasm-spurious-import/
  428. wasm-stringify-ints-small/
  429. wasm-symbols-different-module/
  430. wasm-symbols-not-exported/
  431. wasm-symbols-not-imported/
  432. wasm-unexpected-features/
  433. weird-output-filenames/
  434. windows-binary-no-external-deps/
  435. windows-gnu-corrupt-drective/
  436. windows-safeseh/
  437. windows-spawn/
  438. windows-ws2_32/
  439. zero-extend-abi-param-passing/
  440. README.md
tests/run-make/README.md

The run-make test suite

The run-make test suite contains tests which are the most flexible out of all the rust-lang/rust test suites. run-make tests can basically contain arbitrary code, and are supported by the run_make_support library.

Infrastructure

A run-make test is a test recipe source file rmake.rs accompanied by its parent directory (e.g. tests/run-make/foo/rmake.rs is the foo run-make test).

The implementation for collecting and building the rmake.rs recipes are in src/tools/compiletest/src/runtest.rs, in run_rmake_test.

The setup for the rmake.rs can be summarized as a 3-stage process:

  1. First, we build the run_make_support library in bootstrap as a tool lib.

  2. Then, we compile the rmake.rs “recipe” linking the support library and its dependencies in, and provide a bunch of env vars. We setup a directory structure within build/<target>/test/run-make/

    <test-name>/
        rmake.exe              # recipe binary
        rmake_out/             # sources from test sources copied over
    

    and copy non-rmake.rs input support files over to rmake_out/. The support library is made available as an extern prelude.

  3. Finally, we run the recipe binary and set rmake_out/ as the working directory.

External dependencies

compiletest passes tool paths and target-specific flags to rmake.rs through environment variables. Prefer using the helpers in run_make_support over reading these variables directly. The helpers keep command construction consistent across hosts and targets, and avoid relying on whichever tools happen to be first in PATH.

Commonly used helpers include:

  • rustc() and rustdoc() for the compiler and rustdoc under test, from RUSTC and RUSTDOC.
  • cc() and cxx() for the target C and C++ compilers, from CC/CXX plus CC_DEFAULT_FLAGS/CXX_DEFAULT_FLAGS.
  • gcc() for tests that specifically need gcc; unlike cc(), this assumes a suitable gcc is available in PATH and does not add CC_DEFAULT_FLAGS.
  • llvm_ar(), llvm_nm(), llvm_objdump(), llvm_readobj(), and similar LLVM tools from LLVM_BIN_DIR; llvm_filecheck() uses LLVM_FILECHECK.
  • python_command() for the Python interpreter selected by bootstrap, from PYTHON.
  • clang() for tests that explicitly require clang-based testing, from CLANG.
  • cargo() for in-tree cargo, from CARGO; this is only available in the run-make-cargo and build-std suites, not in plain run-make.
  • htmldocck() for the in-tree src/etc/htmldocck.py script, invoked through python_command().

Some of these variables are only set when the configured builder can provide the corresponding tool. Tests that require optional tools or LLVM target components should declare the matching compiletest directive, such as //@ needs-force-clang-based-tests or //@ needs-llvm-components: x86, instead of failing later in the recipe. If a test needs a tool that is not represented by run_make_support::external_deps, add a small helper there rather than open coding the lookup in individual tests.