Skip to content

Logs from FileSystemHandler are not captured in tests #9

@inetic

Description

@inetic

When a println! line is inserted into a function inside an implementation of the FileSystemHandler and a test is run, the println! line is not captured by the test but is printed out right when the test is run.

For example, if we add println!("<<< hello from handler >>>") above this line, and then run the (currently failing) test cargo test can_find_files. The output is

running 1 test
<<< hello from handler >>>
test usage_tests::can_find_files ... FAILED

failures:

---- usage_tests::can_find_files stdout ----
thread 'usage_tests::can_find_files' panicked at dokan\src\usage_tests.rs:1144:9:
assertion `left == right` failed
  left: 16
 right: 128
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    usage_tests::can_find_files

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

error: test failed, to rerun pass `-p dokan --lib`

Notice that the "<<< hello from handler >>>" line appears above the "---- usage_tests::can_find_files stdout ----" line.

This would normally not be too big of a problem, but it becomes one when tests run ok individually and only start misbehaving when they are run all at once.

My theory is that the FileSystemHandler functions are being called from insider the driver and this somehow circumvents the stdout output that the test is capturing. But I know next to nothing about Windows driver development, so I might very well be wrong.

Perhaps there is a flag that I missed that could fix this? Or maybe someone could suggest a fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions