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

exercise::test::test_exercise_with_output ... FAILED #542

Closed
alexxroche opened this issue Sep 27, 2020 · 3 comments · Fixed by #574
Closed

exercise::test::test_exercise_with_output ... FAILED #542

alexxroche opened this issue Sep 27, 2020 · 3 comments · Fixed by #574

Comments

@alexxroche
Copy link
Contributor

YJDoc2 reported: when running cargo test without any changes done to the repository gives this output :

running 4 tests
test exercise::test::test_finished_exercise ... ok
test exercise::test::test_pending_state ... ok
test exercise::test::test_clean ... ok
test exercise::test::test_exercise_with_output ... FAILED

failures:

---- exercise::test::test_exercise_with_output stdout ----
thread 'exercise::test::test_exercise_with_output' panicked at 'Failed to run 'run' command: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/exercise.rs:172:19
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    exercise::test::test_exercise_with_output

test result: FAILED. 3 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--bin rustlings'

This error is from exercise.rs, a file which I am not changing, but what is the reason for this?

Originally posted by @YJDoc2 in #375 (comment)

@alexxroche
Copy link
Contributor Author

When src/exercise.rs fn compile(&self) -> Result<CompiledExercise, ExerciseOutput> {} is called with Mode::Test from fn test_exercise_with_output()

Command::new("rustc")
                .args(&["--test", self.path.to_str().unwrap(), "-o", &temp_file()])
                .args(RUSTC_COLOR_ARGS)
                .output()

is not outputting to &temp_file()
but Command::new() is not raising any Err and &cmd.stdout and &cmd.stderr are both blank. Which feels like a bug with std::process::Command, or fn compile needs to be reworked so that Mode::Test uses Command::new().spawn().

When I run run rustc by hand rustc --test "tests/fixture/success/testSuccess.rs" -o "./temp_12345" compiles just fine and ./temp_12345 runs without error.

alexxroche added a commit to alexxroche/rustlings that referenced this issue Sep 27, 2020
Looks like this was copied from the previous test without renaming. This test is currently failing `cargo test` and ticket rust-lang#542 has been raised.
@dzmitry-lahoda
Copy link

I have same error on windows rust nightly. Need to switch to master and check.

@jrvidal
Copy link
Contributor

jrvidal commented Oct 26, 2020

The problem is that tests are run among different threads that all share the same PID 🤦

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

Successfully merging a pull request may close this issue.

3 participants