diff --git a/appveyor.yml b/appveyor.yml index 04d86b3..518af10 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,6 +3,7 @@ branches: - master environment: + DOKAN_CONSOLE_DEBUG_LOG: 1 RUST_BACKTRACE: 1 AccessTokenDokanDoc: secure: Z5/daTZ6OJaDbslmhxSxxB6leKaqHTnTbISy153Y4cdJm/oTAbDHaofb9TqvKXV1 diff --git a/dokan/src/usage_tests.rs b/dokan/src/usage_tests.rs index e39e555..2f1b9f0 100644 --- a/dokan/src/usage_tests.rs +++ b/dokan/src/usage_tests.rs @@ -868,6 +868,20 @@ impl<'a> TestDriveContext<'a> { } } +// Errors might happen on CICD only. To facilitate debugging, output debug messages on console. +pub fn test_flags() -> MountFlags { + let mut flags = + MountFlags::CURRENT_SESSION | MountFlags::FILELOCK_USER_MODE | MountFlags::ALT_STREAM; + + let enable_console_debug_log = + std::env::var_os("DOKAN_CONSOLE_DEBUG_LOG").map_or(false, |x| &x != "0"); + if enable_console_debug_log { + flags = flags | MountFlags::DEBUG | MountFlags::STDERR; + } + + flags +} + #[allow(unused_must_use)] pub fn with_test_drive(scope: Scope) { let _guard = TEST_DRIVE_LOCK.lock(); @@ -885,9 +899,7 @@ pub fn with_test_drive(scope: Scope) { let mount_point = convert_str("Z:\\"); let handler = TestHandler::new(tx_signal); let options = MountOptions { - flags: MountFlags::CURRENT_SESSION - | MountFlags::FILELOCK_USER_MODE - | MountFlags::ALT_STREAM, + flags: test_flags(), timeout: Duration::from_secs(15), allocation_unit_size: 1024, sector_size: 1024, @@ -1484,9 +1496,7 @@ fn can_get_operation_info() { no_cache: false, write_to_eof: false, single_thread: false, - mount_flags: MountFlags::CURRENT_SESSION - | MountFlags::FILELOCK_USER_MODE - | MountFlags::ALT_STREAM, + mount_flags: test_flags(), mount_point: Some(convert_str("Z:\\")), unc_name: None, timeout: Duration::from_secs(15),