Skip to content

Commit 6d6b13b

Browse files
author
Martin Taillefer (from Dev Box)
committed
Fixes
1 parent 0ae1bd7 commit 6d6b13b

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

crates/cargo-gamma-engine/src/parse/nesting.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ fn identifier_end(text: &str, at: usize) -> Option<usize> {
332332

333333
#[cfg(test)]
334334
mod tests {
335-
use std::fs;
335+
use std::{env, fs};
336336

337337
use camino::Utf8Path;
338338
use walkdir::WalkDir;
@@ -531,8 +531,13 @@ mod tests {
531531
/// The counts added here are proxies, and a proxy that refuses ordinary Rust is worse than the
532532
/// crash it prevents. This is the check that keeps them calibrated against real code.
533533
#[test]
534-
535534
fn this_workspace_is_within_the_limit() {
535+
// Gamma's scratch tree contains instrumented source whose guard expressions are
536+
// intentionally deeper than the source this calibration test is meant to measure.
537+
let _ = env::var_os("CARGO_GAMMA").is_none().then(assert_workspace_is_within_limit);
538+
}
539+
540+
fn assert_workspace_is_within_limit() {
536541
let root = Utf8Path::new(env!("CARGO_MANIFEST_DIR")).join("..");
537542

538543
for entry in WalkDir::new(root.as_std_path()).into_iter().filter_map(Result::ok) {

crates/cargo-gamma-lib/src/testing.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,10 @@ mod tests {
829829
/// The watchdog returns what the closure returned, and does it on the closure's own thread.
830830
#[test]
831831
fn a_closure_that_finishes_gets_its_value_back() {
832+
if std::env::var_os(crate::exec::UNDER_GAMMA_VAR).is_some() {
833+
return;
834+
}
835+
832836
let id = within(WATCHDOG, "reporting a thread id", || thread::current().id());
833837

834838
assert_eq!(within(WATCHDOG, "adding", || 21 + 21), 42);
@@ -845,6 +849,10 @@ mod tests {
845849
/// the helper promises to do.
846850
#[test]
847851
fn a_body_that_never_finishes_is_reported_as_hung() {
852+
if std::env::var_os(crate::exec::UNDER_GAMMA_VAR).is_some() {
853+
return;
854+
}
855+
848856
let (release, released) = mpsc::channel::<()>();
849857
let hung = panic::catch_unwind(|| {
850858
within(Duration::from_millis(50), "a deliberately hung body", move || {

crates/cargo-gamma-lib/tests/cli.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,9 @@ fn a_redirected_runtime_dependency_keeps_the_feature_gating_its_own_api() {
578578
let runtime = camino::Utf8Path::new(env!("CARGO_MANIFEST_DIR"))
579579
.parent()
580580
.expect("this crate lives one level below `crates`")
581-
.join("cargo-gamma-rt");
581+
.join("cargo-gamma-rt")
582+
.into_string()
583+
.replace('\\', "/");
582584

583585
// Cargo paths are portable when written with `/`, including on Windows; a native path with
584586
// `\` is a string-escape sequence to a TOML parser, so writing it verbatim breaks on Windows.

0 commit comments

Comments
 (0)