mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15: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
-81
@@ -83,22 +83,6 @@ dependencies = [
|
||||
"crypto-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
|
||||
|
||||
[[package]]
|
||||
name = "find-msvc-tools"
|
||||
version = "0.1.12"
|
||||
@@ -123,7 +107,6 @@ dependencies = [
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
"objc2-metal",
|
||||
"tempfile",
|
||||
"windows",
|
||||
]
|
||||
|
||||
@@ -215,17 +198,6 @@ dependencies = [
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"r-efi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hybrid-array"
|
||||
version = "0.4.15"
|
||||
@@ -251,12 +223,6 @@ dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.8.3"
|
||||
@@ -373,12 +339,6 @@ dependencies = [
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.21.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.17"
|
||||
@@ -403,31 +363,12 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "r-efi"
|
||||
version = "6.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "2.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.28"
|
||||
@@ -479,19 +420,6 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"getrandom",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.20.1"
|
||||
@@ -611,15 +539,6 @@ dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.61.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-threading"
|
||||
version = "0.2.1"
|
||||
|
||||
@@ -29,6 +29,3 @@ windows = {version = "0.62.2", features = [
|
||||
|
||||
[build-dependencies]
|
||||
napi-build = "2.4.3"
|
||||
|
||||
[dev-dependencies]
|
||||
tempfile = "3.27"
|
||||
@@ -24,6 +24,6 @@
|
||||
],
|
||||
"scripts": {
|
||||
"build": "cargo run --locked --quiet --manifest-path ../../../tools/ci/Cargo.toml -- build-desktop-native-addon",
|
||||
"test": "cargo test --manifest-path Cargo.toml && node --test test/*.test.mjs"
|
||||
"test": "cargo test --manifest-path Cargo.toml"
|
||||
}
|
||||
}
|
||||
@@ -193,28 +193,6 @@ mod dxgi_helpers {
|
||||
pub fn luid_string(high_part: i32, low_part: u32) -> String {
|
||||
format!("{:08x}:{low_part:08x}", high_part as u32)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn luid_format_matches_legacy_contract() {
|
||||
assert_eq!("ffffffff:1234abcd", luid_string(-1, 0x1234_abcd));
|
||||
assert_eq!("00000002:00000001", luid_string(2, 1));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn utf16_description_trims_at_first_nul() {
|
||||
let mut raw = [0u16; 128];
|
||||
raw[0] = 'G' as u16;
|
||||
raw[1] = 'P' as u16;
|
||||
raw[2] = 'U' as u16;
|
||||
raw[3] = 0;
|
||||
raw[4] = 'X' as u16;
|
||||
assert_eq!("GPU", utf16_description(&raw));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
@@ -429,81 +407,6 @@ mod platform {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::fs::{create_dir_all, write};
|
||||
use std::os::unix::fs::symlink;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn uevent_value_matches_exact_keys() {
|
||||
let blob = "PCI_ID=8086:46A6\nDRIVER=i915\nNOT_DRIVER=bad\n";
|
||||
assert_eq!(Some("i915"), uevent_value(blob, "DRIVER"));
|
||||
assert_eq!(Some("8086:46A6"), uevent_value(blob, "PCI_ID"));
|
||||
assert_eq!(None, uevent_value(blob, "MISSING"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn card_sort_key_keeps_card_order_numeric() {
|
||||
let mut names = ["card10".to_owned(), "card2".to_owned(), "card0".to_owned()];
|
||||
names.sort_unstable_by_key(|name| card_sort_key(name));
|
||||
assert_eq!(["card0", "card2", "card10"], names);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn linux_sysfs_fixture_ports_legacy_gpu_contract() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let root = tmp.path();
|
||||
let pci0 = root.join("devices/pci0000:00/0000:00:02.0");
|
||||
let pci1 = root.join("devices/pci0000:01/0000:01:00.0");
|
||||
create_dir_all(root.join("card0")).unwrap();
|
||||
create_dir_all(root.join("card1")).unwrap();
|
||||
create_dir_all(&pci0).unwrap();
|
||||
create_dir_all(&pci1).unwrap();
|
||||
symlink(
|
||||
"../devices/pci0000:00/0000:00:02.0",
|
||||
root.join("card0/device"),
|
||||
)
|
||||
.unwrap();
|
||||
symlink(
|
||||
"../devices/pci0000:01/0000:01:00.0",
|
||||
root.join("card1/device"),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let card0 = root.join("card0/device");
|
||||
let card1 = root.join("card1/device");
|
||||
write(card0.join("vendor"), "0x8086\n").unwrap();
|
||||
write(card0.join("device"), "0x46a6\n").unwrap();
|
||||
write(card0.join("subsystem_vendor"), "0x1028\n").unwrap();
|
||||
write(card0.join("subsystem_device"), "0x0b19\n").unwrap();
|
||||
write(card0.join("uevent"), "DRIVER=i915\nPCI_ID=8086:46A6\n").unwrap();
|
||||
write(card0.join("mem_info_vram_total"), "268435456\n").unwrap();
|
||||
|
||||
write(card1.join("vendor"), "0x10de\n").unwrap();
|
||||
write(card1.join("device"), "0x1f99\n").unwrap();
|
||||
write(card1.join("uevent"), "PCI_ID=10DE:1F99\n").unwrap();
|
||||
symlink("/sys/bus/pci/drivers/nvidia", card1.join("driver")).unwrap();
|
||||
|
||||
let info = linux_gpu_info_from_drm_root(root);
|
||||
assert_eq!(SOURCE_LINUX_SYSFS, info.source);
|
||||
assert_eq!(2, info.devices.len());
|
||||
assert!(info.devices[0].active);
|
||||
assert_eq!(0x8086, info.devices[0].vendor_id);
|
||||
assert_eq!(Some("Intel".to_owned()), info.devices[0].vendor_name);
|
||||
assert_eq!(
|
||||
Some("Intel GPU (8086:46A6)".to_owned()),
|
||||
info.devices[0].device_string
|
||||
);
|
||||
assert_eq!(Some("i915".to_owned()), info.devices[0].driver_vendor);
|
||||
assert_eq!(Some("0000:00:02.0".to_owned()), info.devices[0].pci_path);
|
||||
assert_eq!(Some(268_435_456.0), info.devices[0].dedicated_video_memory);
|
||||
assert!(!info.devices[1].active);
|
||||
assert_eq!(Some("nvidia".to_owned()), info.devices[1].driver_vendor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows")))]
|
||||
@@ -514,26 +417,3 @@ mod platform {
|
||||
empty_info(SOURCE_LINUX_SYSFS)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn base_device_sets_required_contract_fields() {
|
||||
let device = base_device(true, 0x10de, 0x2684, SOURCE_DXGI);
|
||||
assert!(device.active);
|
||||
assert_eq!(0x10de, device.vendor_id);
|
||||
assert_eq!(0x2684, device.device_id);
|
||||
assert_eq!(Some("NVIDIA".to_owned()), device.vendor_name);
|
||||
assert_eq!(SOURCE_DXGI, device.source);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn empty_info_preserves_source_and_empty_devices() {
|
||||
let info = empty_info(SOURCE_LINUX_SYSFS);
|
||||
assert_eq!(SOURCE_LINUX_SYSFS, info.source);
|
||||
assert!(info.devices.is_empty());
|
||||
assert!(info.error.is_none());
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import platformInfoPure from '../pure.cjs';
|
||||
|
||||
test('loader resolves native binaries for supported platforms and architectures', () => {
|
||||
assert.equal(platformInfoPure.nativeFileName('darwin', 'x64'), 'platform-info.darwin-x64.node');
|
||||
assert.equal(platformInfoPure.nativeFileName('darwin', 'arm64'), 'platform-info.darwin-arm64.node');
|
||||
assert.equal(platformInfoPure.nativeFileName('linux', 'x64'), 'platform-info.linux-x64-gnu.node');
|
||||
assert.equal(platformInfoPure.nativeFileName('linux', 'arm64'), 'platform-info.linux-arm64-gnu.node');
|
||||
assert.equal(platformInfoPure.nativeFileName('win32', 'x64'), 'platform-info.win32-x64-msvc.node');
|
||||
assert.equal(platformInfoPure.nativeFileName('win32', 'arm64'), 'platform-info.win32-arm64-msvc.node');
|
||||
});
|
||||
Reference in new issue
Block a user