Skip to content

Commit c18ed7b

Browse files
committed
Move std_detect tests into a separate crate
1 parent 6435125 commit c18ed7b

28 files changed

Lines changed: 45 additions & 17 deletions

library/Cargo.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ dependencies = [
358358
"rustc-std-workspace-core",
359359
]
360360

361+
[[package]]
362+
name = "std_detect_tests"
363+
version = "0.0.0"
364+
361365
[[package]]
362366
name = "sysroot"
363367
version = "0.0.0"

library/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ members = [
77
"sysroot",
88
"coretests",
99
"alloctests",
10+
"std_detect_tests",
1011
]
1112

1213
exclude = [
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "std_detect_tests"
3+
version = "0.0.0"
4+
license = "MIT OR Apache-2.0"
5+
description = "Tests for std_detect"
6+
edition = "2024"

library/std_detect/src/detect/test_data/linux-artificial-aarch64.auxv renamed to library/std_detect_tests/test_data/linux-artificial-aarch64.auxv

File renamed without changes.

library/std_detect/src/detect/test_data/linux-empty-hwcap2-aarch64.auxv renamed to library/std_detect_tests/test_data/linux-empty-hwcap2-aarch64.auxv

File renamed without changes.

library/std_detect/src/detect/test_data/linux-hwcap2-aarch64.auxv renamed to library/std_detect_tests/test_data/linux-hwcap2-aarch64.auxv

File renamed without changes.

library/std_detect/src/detect/test_data/linux-no-hwcap2-aarch64.auxv renamed to library/std_detect_tests/test_data/linux-no-hwcap2-aarch64.auxv

File renamed without changes.
File renamed without changes.

library/std_detect/src/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv renamed to library/std_detect_tests/test_data/macos-virtualbox-linux-x86-4850HQ.auxv

File renamed without changes.
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#![allow(internal_features)]
22
#![feature(cfg_select, stdarch_internal)]
33

4+
extern crate std_detect;
5+
46
use std_detect::detect::__test_os::{auxv, auxv_from_file};
57

68
// FIXME: on mips/mips64 getauxval returns 0, and /proc/self/auxv
@@ -50,15 +52,15 @@ cfg_select! {
5052
// files on disk, so we need to embed them with `include_bytes!`.
5153
#[test]
5254
fn linux_rpi3() {
53-
let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-rpi3.auxv");
55+
let file = concat!(env!("CARGO_MANIFEST_DIR"), "/test_data/linux-rpi3.auxv");
5456
let v = auxv_from_file(file).unwrap();
5557
assert_eq!(v.hwcap, 4174038);
5658
assert_eq!(v.hwcap2, 16);
5759
}
5860

5961
#[test]
6062
fn linux_macos_vb() {
61-
let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/macos-virtualbox-linux-x86-4850HQ.auxv");
63+
let file = concat!(env!("CARGO_MANIFEST_DIR"), "/test_data/macos-virtualbox-linux-x86-4850HQ.auxv");
6264
// The file contains HWCAP but not HWCAP2. In that case, we treat HWCAP2 as zero.
6365
let v = auxv_from_file(file).unwrap();
6466
assert_eq!(v.hwcap, 126614527);
@@ -69,15 +71,15 @@ cfg_select! {
6971
#[cfg(target_endian = "little")]
7072
#[test]
7173
fn linux_artificial_aarch64() {
72-
let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-artificial-aarch64.auxv");
74+
let file = concat!(env!("CARGO_MANIFEST_DIR"), "/test_data/linux-artificial-aarch64.auxv");
7375
let v = auxv_from_file(file).unwrap();
7476
assert_eq!(v.hwcap, 0x0123456789abcdef);
7577
assert_eq!(v.hwcap2, 0x02468ace13579bdf);
7678
}
7779
#[cfg(target_endian = "little")]
7880
#[test]
7981
fn linux_no_hwcap2_aarch64() {
80-
let file = concat!(env!("CARGO_MANIFEST_DIR"), "/src/detect/test_data/linux-no-hwcap2-aarch64.auxv");
82+
let file = concat!(env!("CARGO_MANIFEST_DIR"), "/test_data/linux-no-hwcap2-aarch64.auxv");
8183
let v = auxv_from_file(file).unwrap();
8284
// An absent HWCAP2 is treated as zero, and does not prevent acceptance of HWCAP.
8385
assert_ne!(v.hwcap, 0);

0 commit comments

Comments
 (0)