mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 13:05:32 +09:00
chore(repo): remove dead code and useless tests (#3375)
This commit is contained in:
1 parent
7e177a1c90
commit
1cd62eb661
1391 files changed
+783
-120415
No files matched your search
@@ -1032,28 +1032,6 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reports_available_nvenc_when_compiled_and_runtime_ready() {
|
||||
let capability =
|
||||
describe_capability(CapabilityPlatform::Linux, true, Some(runtime_ready()));
|
||||
|
||||
assert!(capability.available);
|
||||
assert_eq!(capability.backend, "nvenc");
|
||||
assert!(capability.compiled);
|
||||
assert!(capability.runtime);
|
||||
assert_eq!(capability.codecs, vec!["h264", "h265"]);
|
||||
assert!(capability.zero_copy);
|
||||
assert_eq!(capability.native_inputs, vec!["dmabuf"]);
|
||||
assert_eq!(capability.reason, None);
|
||||
assert!(
|
||||
capability
|
||||
.detail
|
||||
.as_deref()
|
||||
.unwrap_or_default()
|
||||
.contains("h264, h265")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reports_h264_only_when_hevc_guid_is_absent() {
|
||||
let capability = describe_capability(
|
||||
@@ -1070,61 +1048,6 @@ mod tests {
|
||||
assert!(capability.zero_copy);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reports_windows_nvenc_without_linux_zero_copy_inputs() {
|
||||
let capability =
|
||||
describe_capability(CapabilityPlatform::Windows, true, Some(runtime_ready()));
|
||||
|
||||
assert!(capability.available);
|
||||
assert_eq!(capability.backend, "nvenc");
|
||||
assert!(capability.compiled);
|
||||
assert!(capability.runtime);
|
||||
assert_eq!(capability.codecs, vec!["h264", "h265"]);
|
||||
assert!(!capability.zero_copy);
|
||||
assert_eq!(capability.native_inputs, Vec::<String>::new());
|
||||
assert_eq!(capability.reason, None);
|
||||
let detail = capability.detail.as_deref().unwrap_or_default();
|
||||
assert!(detail.contains("nvcuda.dll"), "{detail}");
|
||||
assert!(detail.contains("native zero-copy inputs: none"), "{detail}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reports_windows_nvenc_runtime_dll_names_when_missing() {
|
||||
let capability = describe_capability(CapabilityPlatform::Windows, true, None);
|
||||
|
||||
assert!(!capability.available);
|
||||
assert_eq!(
|
||||
capability.reason.as_deref(),
|
||||
Some("runtime_prerequisite_missing")
|
||||
);
|
||||
let detail = capability.detail.as_deref().unwrap_or_default();
|
||||
assert!(detail.contains("nvcuda.dll"), "{detail}");
|
||||
if cfg!(target_pointer_width = "32") {
|
||||
assert!(detail.contains("nvEncodeAPI.dll"), "{detail}");
|
||||
} else {
|
||||
assert!(detail.contains("nvEncodeAPI64.dll"), "{detail}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reports_windows_nvenc_publish_backend_not_compiled() {
|
||||
let capability = describe_capability(CapabilityPlatform::Windows, false, None);
|
||||
|
||||
assert!(!capability.available);
|
||||
assert_eq!(capability.reason.as_deref(), Some("nvenc_not_compiled"));
|
||||
let detail = capability.detail.as_deref().unwrap_or_default();
|
||||
assert!(
|
||||
detail.contains("Windows NVENC publishing is not compiled"),
|
||||
"{detail}"
|
||||
);
|
||||
let error =
|
||||
require_publish_codec_runtime_support_for_capability("h265", &capability).unwrap_err();
|
||||
assert!(
|
||||
error.contains("Windows NVENC publishing is not compiled"),
|
||||
"{error}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn publish_codec_runtime_gate_only_requires_hardware_for_h265() {
|
||||
let unavailable = describe_capability(CapabilityPlatform::Linux, false, None);
|
||||
@@ -1169,192 +1092,6 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reports_not_compiled_before_runtime_missing() {
|
||||
let capability = describe_capability(
|
||||
CapabilityPlatform::Linux,
|
||||
false,
|
||||
Some(NvencRuntimeProbe {
|
||||
libcuda: false,
|
||||
libnvidia_encode: false,
|
||||
get_max_supported_version: false,
|
||||
driver_version_compatible: false,
|
||||
create_instance: false,
|
||||
cuda_init: false,
|
||||
cuda_device_count: None,
|
||||
cuda_device: false,
|
||||
cuda_context: false,
|
||||
checked_cuda_devices: 0,
|
||||
supported_cuda_devices: 0,
|
||||
open_encode_session: false,
|
||||
query_encode_guids: false,
|
||||
supports_h264: false,
|
||||
supports_h265: false,
|
||||
last_open_encode_session_status: None,
|
||||
}),
|
||||
);
|
||||
|
||||
assert!(!capability.available);
|
||||
assert_eq!(capability.backend, "none");
|
||||
assert!(!capability.compiled);
|
||||
assert!(!capability.runtime);
|
||||
assert_eq!(capability.codecs, Vec::<String>::new());
|
||||
assert!(!capability.zero_copy);
|
||||
assert_eq!(capability.native_inputs, Vec::<String>::new());
|
||||
assert_eq!(capability.reason.as_deref(), Some("nvenc_not_compiled"));
|
||||
assert!(
|
||||
capability
|
||||
.detail
|
||||
.as_deref()
|
||||
.unwrap_or_default()
|
||||
.contains("vendored CUDA Driver API header")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reports_missing_runtime_prerequisites_when_compiled() {
|
||||
let capability = describe_capability(
|
||||
CapabilityPlatform::Linux,
|
||||
true,
|
||||
Some(NvencRuntimeProbe {
|
||||
libcuda: true,
|
||||
libnvidia_encode: true,
|
||||
get_max_supported_version: true,
|
||||
driver_version_compatible: true,
|
||||
create_instance: true,
|
||||
cuda_init: true,
|
||||
cuda_device_count: Some(1),
|
||||
cuda_device: true,
|
||||
cuda_context: true,
|
||||
checked_cuda_devices: 1,
|
||||
supported_cuda_devices: 0,
|
||||
open_encode_session: false,
|
||||
query_encode_guids: false,
|
||||
supports_h264: false,
|
||||
supports_h265: false,
|
||||
last_open_encode_session_status: Some(2),
|
||||
}),
|
||||
);
|
||||
|
||||
assert!(!capability.available);
|
||||
assert_eq!(capability.backend, "none");
|
||||
assert!(capability.compiled);
|
||||
assert!(!capability.runtime);
|
||||
assert!(!capability.zero_copy);
|
||||
assert_eq!(capability.native_inputs, Vec::<String>::new());
|
||||
assert_eq!(capability.reason.as_deref(), Some("no_supported_devices"));
|
||||
assert!(
|
||||
capability
|
||||
.detail
|
||||
.as_deref()
|
||||
.unwrap_or_default()
|
||||
.contains("NVENC encode session")
|
||||
);
|
||||
assert!(
|
||||
capability
|
||||
.detail
|
||||
.as_deref()
|
||||
.unwrap_or_default()
|
||||
.contains("NV_ENC_ERR_UNSUPPORTED_DEVICE")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reports_missing_runtime_prerequisites_when_probe_is_absent() {
|
||||
let capability = describe_capability(CapabilityPlatform::Linux, true, None);
|
||||
|
||||
assert!(!capability.available);
|
||||
assert_eq!(capability.backend, "none");
|
||||
assert!(capability.compiled);
|
||||
assert!(!capability.runtime);
|
||||
assert!(!capability.zero_copy);
|
||||
assert_eq!(capability.native_inputs, Vec::<String>::new());
|
||||
assert_eq!(
|
||||
capability.reason.as_deref(),
|
||||
Some("runtime_prerequisite_missing")
|
||||
);
|
||||
let detail = capability.detail.as_deref().unwrap_or_default();
|
||||
assert!(detail.contains("libcuda.so.1"), "{detail}");
|
||||
assert!(detail.contains("libnvidia-encode.so.1"), "{detail}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reports_driver_sdk_incompatibility_before_encode_session() {
|
||||
let capability = describe_capability(
|
||||
CapabilityPlatform::Linux,
|
||||
true,
|
||||
Some(NvencRuntimeProbe {
|
||||
driver_version_compatible: false,
|
||||
create_instance: false,
|
||||
cuda_init: false,
|
||||
cuda_device: false,
|
||||
cuda_context: false,
|
||||
open_encode_session: false,
|
||||
..runtime_ready()
|
||||
}),
|
||||
);
|
||||
|
||||
assert!(!capability.available);
|
||||
assert_eq!(capability.backend, "none");
|
||||
assert!(capability.compiled);
|
||||
assert!(!capability.runtime);
|
||||
assert!(!capability.zero_copy);
|
||||
assert_eq!(capability.native_inputs, Vec::<String>::new());
|
||||
assert_eq!(capability.reason.as_deref(), Some("outdated_driver"));
|
||||
let detail = capability.detail.as_deref().unwrap_or_default();
|
||||
assert!(
|
||||
detail.contains("NVENC driver support for the compiled SDK version"),
|
||||
"{detail}"
|
||||
);
|
||||
assert!(!detail.contains("NVENC encode session"), "{detail}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reports_no_cuda_devices_using_obs_style_reason() {
|
||||
let capability = describe_capability(
|
||||
CapabilityPlatform::Linux,
|
||||
true,
|
||||
Some(NvencRuntimeProbe {
|
||||
cuda_device_count: Some(0),
|
||||
cuda_device: false,
|
||||
cuda_context: false,
|
||||
open_encode_session: false,
|
||||
..runtime_ready()
|
||||
}),
|
||||
);
|
||||
|
||||
assert!(!capability.available);
|
||||
assert_eq!(capability.reason.as_deref(), Some("no_devices"));
|
||||
assert!(
|
||||
capability
|
||||
.detail
|
||||
.as_deref()
|
||||
.unwrap_or_default()
|
||||
.contains("CUDA devices")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reports_available_videotoolbox_with_h264_and_h265() {
|
||||
let capability = describe_videotoolbox_capability(Some(videotoolbox_ready()));
|
||||
|
||||
assert!(capability.available);
|
||||
assert_eq!(capability.backend, "videotoolbox");
|
||||
assert!(capability.compiled);
|
||||
assert!(capability.runtime);
|
||||
assert_eq!(capability.codecs, vec!["h264", "h265"]);
|
||||
assert!(!capability.zero_copy);
|
||||
assert_eq!(capability.native_inputs, Vec::<String>::new());
|
||||
assert_eq!(capability.reason, None);
|
||||
assert!(
|
||||
capability
|
||||
.detail
|
||||
.as_deref()
|
||||
.unwrap_or_default()
|
||||
.contains("h264, h265")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reports_videotoolbox_h264_only_when_hevc_session_is_unavailable() {
|
||||
let capability = describe_videotoolbox_capability(Some(VideoToolboxRuntimeProbe {
|
||||
@@ -1368,53 +1105,4 @@ mod tests {
|
||||
assert_eq!(capability.codecs, vec!["h264"]);
|
||||
assert_eq!(capability.reason, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reports_videotoolbox_unavailable_with_status_details() {
|
||||
let capability = describe_videotoolbox_capability(Some(VideoToolboxRuntimeProbe {
|
||||
h264_create_status: Some(-12909),
|
||||
h264_prepare_status: None,
|
||||
h265_create_status: Some(-12915),
|
||||
h265_prepare_status: None,
|
||||
}));
|
||||
|
||||
assert!(!capability.available);
|
||||
assert_eq!(capability.backend, "none");
|
||||
assert!(!capability.runtime);
|
||||
assert_eq!(capability.codecs, Vec::<String>::new());
|
||||
assert_eq!(capability.reason.as_deref(), Some("no_supported_codecs"));
|
||||
let detail = capability.detail.as_deref().unwrap_or_default();
|
||||
assert!(
|
||||
detail.contains("kVTCouldNotFindVideoEncoderErr"),
|
||||
"{detail}"
|
||||
);
|
||||
assert!(
|
||||
detail.contains("kVTVideoEncoderNotAvailableNowErr"),
|
||||
"{detail}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reports_unsupported_platforms_clearly() {
|
||||
let capability = describe_capability(
|
||||
CapabilityPlatform::Unsupported("macos"),
|
||||
true,
|
||||
Some(runtime_ready()),
|
||||
);
|
||||
|
||||
assert!(!capability.available);
|
||||
assert_eq!(capability.backend, "none");
|
||||
assert!(!capability.compiled);
|
||||
assert!(!capability.runtime);
|
||||
assert!(!capability.zero_copy);
|
||||
assert_eq!(capability.native_inputs, Vec::<String>::new());
|
||||
assert_eq!(capability.reason.as_deref(), Some("unsupported_platform"));
|
||||
assert!(
|
||||
capability
|
||||
.detail
|
||||
.as_deref()
|
||||
.unwrap_or_default()
|
||||
.contains("macos")
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user