Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing --test test_ranges locally #865

Closed
alerque opened this issue Jun 7, 2024 · 4 comments
Closed

Failing --test test_ranges locally #865

alerque opened this issue Jun 7, 2024 · 4 comments

Comments

@alerque
Copy link
Contributor

alerque commented Jun 7, 2024

I'm having some trouble with my feature fork in #839 locally failing an unrelated test. The weird thing is that it wasn't failing for me locally just a few days ago.

  • I also checked the main branch and it is failing the same tests.
  • Then I tried --locked to make sure it wasn't some dependency, that didn't help.
  • Then I tried building with different Rust versions to see if nightly vs. stable was related, it wasn't.

Any idea what gives here?

$ git checkout v0.20.0
HEAD is now at c6e8619 v0.20.0
$ cargo +stable test --locked --test test_ranges
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.07s
     Running tests/test_ranges.rs (/home/caleb/.local/share/cargo/debug/deps/test_ranges-4034f8149668c366)

running 19 tests
test test_nested_range_function_call ... ok
test test_nested_range_do ... ok
test test_dont_modify_eof ... ok
test test_incomplete_range ... ok
test test_default ... ok
test test_nested_range_generic_for ... ok
test test_nested_range_function_call_table ... ok
test test_nested_range_binop ... ok
test test_nested_range ... ok
test test_nested_range_else_if ... ok
test test_large_example ... ok
test test_nested_range_repeat ... ok
test test_nested_range_table_1 ... ok
test test_no_range_start ... ok
test test_no_range_end ... ok
test test_nested_range_while ... ok
test test_nested_range_local_function ... ok
test test_nested_range_table_2 ... ok
test test_ignore_last_stmt ... FAILED

failures:

---- test_ignore_last_stmt stdout ----
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Snapshot Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Snapshot: ignore_last_stmt
Source: tests/test_ranges.rs:44
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Expression: format(
    r###"||f||unction foo()
    return bar
end"###,
)
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
-old snapshot
+new results
────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
    0       │-function foo()
          0 │+function  foo()
    1     1 │     return bar
    2     2 │ end
────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
To update snapshots run `cargo insta review`
Stopped on the first failure. Run `cargo insta test` to run all snapshots.
thread 'test_ignore_last_stmt' panicked at /home/caleb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/insta-1.34.0/src/runtime.rs:563:9:
snapshot assertion for 'ignore_last_stmt' failed in line 44
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    test_ignore_last_stmt

test result: FAILED. 18 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s

error: test failed, to rerun pass `--test test_ranges`
@JohnnyMorganz
Copy link
Owner

Unfortunately I can't repro this issue locally, and it seems CI is fine with it too.

insta's inline snapshot testing can be a bit odd with multiline string literals, I wonder if that is causing issues

@alerque
Copy link
Contributor Author

alerque commented Jun 10, 2024

I've been messing with this for over a week across several machines now and I'm beginning to think I'm actually changing a bug in cargo itself. Something is messed up with dependency tracking and linking in debug builds. I'm getting results generated by my own experimental of full_moon even when installing and running stylua directly from a Git remote that definitely does not reference my full_moon fork in its dependencies. This seems to be a bug in handling a global build cache.

@alerque
Copy link
Contributor Author

alerque commented Jun 11, 2024

I can reproduce this back and forth now but in requires an aggressive amount of blowing away not just Cargo's build artifacts but also it's fetch registry. The trouble seems to come with Cargo >= 1.78. Using 1.77.2 or earlier with an aggressive nuking of all Rust crate download and build artifacts produces a working binary, but using 1.78 or newer (including nigthly) will produce this error. The awkward part is it won't produce it even using nightly if you're downloaded and built some dependencies on an earlier version of Rust.

This more or less confirms that there is a Cargo bug in handling build artifacts, but also that there is some problem with this project (or full_moon?) using newer Cargo versions.

@alerque
Copy link
Contributor Author

alerque commented Jun 28, 2024

I'm going to work on reporting this further upstream, I've confirmed a few more bits and the issue is not in this project, it's actually in Cargo.

@alerque alerque closed this as not planned Won't fix, can't repro, duplicate, stale Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants