Crate run_make_support

source ·
Expand description

run-make-support is a support library for run-make tests. It provides command wrappers and convenience utility functions to help test writers reduce duplication. The support library notably is built via cargo: this means that if your test wants some non-trivial utility, such as object or wasmparser, they can be re-exported and be made available through this library.

Re-exports§

Modules§

  • command 🔒
  • drop_bomb 🔒
    This module implements “drop bombs” intended for use by command wrappers to ensure that the constructed commands are eventually executed. This is exactly like rustc_errors::Diag where we force every Diag to be consumed or we emit a bug, but we panic instead.

Macros§

  • Implement common helpers for command wrappers. This assumes that the command wrapper is a struct containing a cmd: Command field. The provided helpers are:

Functions§

  • AR
  • Check that haystack contains needle. Panic otherwise.
  • Check that actual is equal to expected. Panic otherwise.
  • Check that haystack does not contain needle. Panic otherwise.
  • Construct the binary name based on platform.
  • Copy a directory into another.
  • Gathers all files in the current working directory that have the extension ext, and counts the number of lines within that contain a match with the regex pattern re.
  • Creates a new symlink to a path on the filesystem, adjusting for Windows or Unix.
  • Return the current working directory.
  • Use cygpath -w on a path to get a Windows path string back. This assumes that cygpath is available on the platform!
  • Construct the dynamic library name based on the platform.
  • Returns true if the filename at path is not in expected.
  • Returns true if the filename at path has the extension extension.
  • Returns true if the filename at path starts with prefix.
  • Read the contents of a file that cannot simply be read by read_to_string, due to invalid utf8 data, then assert that it contains expected.
  • Read the contents of a file that cannot simply be read by read_to_string, due to invalid utf8 data, then assert that it does not contain expected.
  • Check if target uses macOS.
  • Check if target uses msvc.
  • Check if target is windows-like.
  • Returns true if the filename at path does not contain expected.
  • Returns the path for a local test file.
  • Check that all files in dir1 exist and have the same content in dir2. Panic otherwise.
  • This function is designed for running commands in a temporary directory that is cleared after the function ends.
  • Generate the name a rust library (rlib) would have.
  • Set the runtime library path as needed for running the host rustc/rustdoc/etc.
  • Browse the directory path non-recursively and return all files which respect the parameters outlined by closure.
  • Path to the root rust-lang/rust source checkout.
  • Construct the static library name based on the platform.
  • TARGET
  • Ensure that the path P is read-only while the test runs, and restore original permissions at the end so compiletest can clean up. This will panic on Windows if the path is a directory (as it would otherwise do nothing)
  • Run uname. This assumes that uname is available on the platform!