Skip to content

Commit d78e7d1

Browse files
committed
fix(cksum): exclude Android from CPU feature detection tests
The test functions test_cpu_features_detection, test_cpu_features_cached, and test_cpu_features_on_x86_64 call CpuFeatures::detect() which executes the x86 CPUID instruction. On the Android x86_64 emulator, this crashes the adb process with exit code 137 (SIGKILL). This fix adds #[cfg(not(target_os = "android"))] attributes to these tests to prevent them from running on Android, where the CPUID instruction is not supported by the emulator. Fixes: Android CI test failure with exit code 137 Resolves: PR uutils#9088 Android x86_64 emulator crash during tests
1 parent 4f9f6cc commit d78e7d1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/uu/cksum/src/hardware.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ mod tests {
118118
use super::*;
119119

120120
#[test]
121+
#[cfg(not(target_os = "android"))]
121122
fn test_cpu_features_detection() {
122123
let features = CpuFeatures::detect();
123124
// Features should be valid booleans - just verify they can be detected
@@ -128,6 +129,7 @@ mod tests {
128129
}
129130

130131
#[test]
132+
#[cfg(not(target_os = "android"))]
131133
fn test_cpu_features_cached() {
132134
let features1 = CpuFeatures::detect();
133135
let features2 = CpuFeatures::detect();
@@ -139,13 +141,11 @@ mod tests {
139141
}
140142

141143
#[test]
144+
#[cfg(all(target_arch = "x86_64", not(target_os = "android")))]
142145
fn test_cpu_features_on_x86_64() {
143-
#[cfg(target_arch = "x86_64")]
144-
{
145-
let features = CpuFeatures::detect();
146-
// On x86_64, at least one feature should be detected or all false
147-
// (depending on CPU capabilities)
148-
let _ = features;
149-
}
146+
let features = CpuFeatures::detect();
147+
// On x86_64, at least one feature should be detected or all false
148+
// (depending on CPU capabilities)
149+
let _ = features;
150150
}
151151
}

0 commit comments

Comments
 (0)