tags 1057451 +patch
thanks
I just looked at the remaining autopkgtest failures in rust-ahash, I found and
fixed two issues and after doing so the autopkgtests passed.
The first issue was some arithmetic overflows in summations in tests/bench.rs
these cause panics if built/run in Debug mode (as "cargo test --all-targets"
does by default). The results of the summations were not used for anything.
I'm not sure what the original intent of the summations was, perhaps it was
just to shut compiler warnings up, perhaps it was an attempt to stop the
compiler optimizing stuff away. I just commented out the summations, another
possibility would be to replace them with calls to std::hint::black_box
The second issue was some tests that failed to build when the std feature
was enabled but none of the rng features (runtime-rng, compile-time-rng
or no-rng) were enabled. I added/adjusted feature gaurds to fix this
issue.
Debdiff attached, if I get no response I will likely NMU this in a week
or so.
diff -Nru rust-ahash-0.8.5/debian/changelog rust-ahash-0.8.5/debian/changelog
--- rust-ahash-0.8.5/debian/changelog 2023-12-10 23:06:48.000000000 +0000
+++ rust-ahash-0.8.5/debian/changelog 2023-12-26 10:08:52.000000000 +0000
@@ -1,3 +1,13 @@
+rust-ahash (0.8.5-3.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Fix autopkgtest. (Closes: #1057451)
+ + Disable overflowing additions whose results are not used in
tests/bench.rs
+ + Add/Adjust feature gaurds to fix build of tests when the std feature is
+ enabled but no rng feature is enabled.
+
+ -- Peter Michael Green <plugw...@debian.org> Tue, 26 Dec 2023 10:08:52 +0000
+
rust-ahash (0.8.5-3) unstable; urgency=medium
* update patch;
diff -Nru rust-ahash-0.8.5/debian/patches/1001_bench_overflow.patch
rust-ahash-0.8.5/debian/patches/1001_bench_overflow.patch
--- rust-ahash-0.8.5/debian/patches/1001_bench_overflow.patch 1970-01-01
00:00:00.000000000 +0000
+++ rust-ahash-0.8.5/debian/patches/1001_bench_overflow.patch 2023-12-26
10:08:52.000000000 +0000
@@ -0,0 +1,84 @@
+Description: Disable overflowing additions whose results are not used in
tests/bench.rs
+Author: Peter Michael Green <plugw...@debian.org>
+Bug-Debian: https://bugs.debian.org/1057451
+
+--- rust-ahash-0.8.5.orig/tests/bench.rs
++++ rust-ahash-0.8.5/tests/bench.rs
+@@ -118,10 +118,10 @@ fn bench_map(c: &mut Criterion) {
+ group.bench_function("aHash-alias", |b| {
+ b.iter(|| {
+ let hm: ahash::HashMap<i32, i32> = (0..1_000_000).map(|i| (i,
i)).collect();
+- let mut sum = 0;
++ //let mut sum = 0;
+ for i in 0..1_000_000 {
+ if let Some(x) = hm.get(&i) {
+- sum += x;
++ //sum += x;
+ }
+ }
+ })
+@@ -129,10 +129,10 @@ fn bench_map(c: &mut Criterion) {
+ group.bench_function("aHash-hashBrown", |b| {
+ b.iter(|| {
+ let hm: hashbrown::HashMap<i32, i32> = (0..1_000_000).map(|i|
(i, i)).collect();
+- let mut sum = 0;
++ //let mut sum = 0;
+ for i in 0..1_000_000 {
+ if let Some(x) = hm.get(&i) {
+- sum += x;
++ //sum += x;
+ }
+ }
+ })
+@@ -140,10 +140,10 @@ fn bench_map(c: &mut Criterion) {
+ group.bench_function("aHash-hashBrown-explicit", |b| {
+ b.iter(|| {
+ let hm: hashbrown::HashMap<i32, i32, RandomState> =
(0..1_000_000).map(|i| (i, i)).collect();
+- let mut sum = 0;
++ //let mut sum = 0;
+ for i in 0..1_000_000 {
+ if let Some(x) = hm.get(&i) {
+- sum += x;
++ //sum += x;
+ }
+ }
+ })
+@@ -151,10 +151,10 @@ fn bench_map(c: &mut Criterion) {
+ group.bench_function("aHash-wrapper", |b| {
+ b.iter(|| {
+ let hm: ahash::AHashMap<i32, i32> = (0..1_000_000).map(|i|
(i, i)).collect();
+- let mut sum = 0;
++ //let mut sum = 0;
+ for i in 0..1_000_000 {
+ if let Some(x) = hm.get(&i) {
+- sum += x;
++ //sum += x;
+ }
+ }
+ })
+@@ -162,10 +162,10 @@ fn bench_map(c: &mut Criterion) {
+ group.bench_function("aHash-rand", |b| {
+ b.iter(|| {
+ let hm: std::collections::HashMap<i32, i32, RandomState> =
(0..1_000_000).map(|i| (i, i)).collect();
+- let mut sum = 0;
++ //let mut sum = 0;
+ for i in 0..1_000_000 {
+ if let Some(x) = hm.get(&i) {
+- sum += x;
++ //sum += x;
+ }
+ }
+ })
+@@ -174,10 +174,10 @@ fn bench_map(c: &mut Criterion) {
+ b.iter(|| {
+ let hm: std::collections::HashMap<i32, i32,
BuildHasherDefault<AHasher>> =
+ (0..1_000_000).map(|i| (i, i)).collect();
+- let mut sum = 0;
++ //let mut sum = 0;
+ for i in 0..1_000_000 {
+ if let Some(x) = hm.get(&i) {
+- sum += x;
++ //sum += x;
+ }
+ }
+ })
diff -Nru rust-ahash-0.8.5/debian/patches/1002_test_feature_requirements.patch
rust-ahash-0.8.5/debian/patches/1002_test_feature_requirements.patch
--- rust-ahash-0.8.5/debian/patches/1002_test_feature_requirements.patch
1970-01-01 00:00:00.000000000 +0000
+++ rust-ahash-0.8.5/debian/patches/1002_test_feature_requirements.patch
2023-12-26 10:08:52.000000000 +0000
@@ -0,0 +1,75 @@
+Description: fix feature requirements for tests.
+Author: Peter Michael Green <plugw...@debian.org>
+Bug-Debian: https://bugs.debian.org/1057451
+
+--- rust-ahash-0.8.5.orig/src/lib.rs
++++ rust-ahash-0.8.5/src/lib.rs
+@@ -322,12 +322,14 @@ mod test {
+ use std::hash::Hash;
+
+ #[test]
++ #[cfg(any(feature = "runtime-rng", feature = "compile-time-rng", feature
= "no-rng"))]
+ fn test_ahash_alias_map_construction() {
+ let mut map = super::HashMap::with_capacity(1234);
+ map.insert(1, "test");
+ }
+
+ #[test]
++ #[cfg(any(feature = "runtime-rng", feature = "compile-time-rng", feature
= "no-rng"))]
+ fn test_ahash_alias_set_construction() {
+ let mut set = super::HashSet::with_capacity(1234);
+ set.insert(1);
+@@ -342,6 +344,7 @@ mod test {
+ }
+
+ #[test]
++ #[cfg(any(feature = "runtime-rng", feature = "compile-time-rng", feature
= "no-rng"))]
+ fn test_builder() {
+ let mut map = HashMap::<u32, u64, RandomState>::default();
+ map.insert(1, 3);
+--- rust-ahash-0.8.5.orig/tests/bench.rs
++++ rust-ahash-0.8.5/tests/bench.rs
+@@ -115,6 +115,7 @@ fn bench_map(c: &mut Criterion) {
+ #[cfg(feature = "std")]
+ {
+ let mut group = c.benchmark_group("map");
++ #[cfg(any(feature = "runtime-rng", feature = "compile-time-rng",
feature = "no-rng"))]
+ group.bench_function("aHash-alias", |b| {
+ b.iter(|| {
+ let hm: ahash::HashMap<i32, i32> = (0..1_000_000).map(|i| (i,
i)).collect();
+@@ -137,6 +138,7 @@ fn bench_map(c: &mut Criterion) {
+ }
+ })
+ });
++ #[cfg(any(feature = "runtime-rng", feature = "compile-time-rng",
feature = "no-rng"))]
+ group.bench_function("aHash-hashBrown-explicit", |b| {
+ b.iter(|| {
+ let hm: hashbrown::HashMap<i32, i32, RandomState> =
(0..1_000_000).map(|i| (i, i)).collect();
+@@ -159,6 +161,7 @@ fn bench_map(c: &mut Criterion) {
+ }
+ })
+ });
++ #[cfg(any(feature = "runtime-rng", feature = "compile-time-rng",
feature = "no-rng"))]
+ group.bench_function("aHash-rand", |b| {
+ b.iter(|| {
+ let hm: std::collections::HashMap<i32, i32, RandomState> =
(0..1_000_000).map(|i| (i, i)).collect();
+--- rust-ahash-0.8.5.orig/tests/map_tests.rs
++++ rust-ahash-0.8.5/tests/map_tests.rs
+@@ -179,7 +179,7 @@ fn test_bucket_distribution() {
+ check_for_collisions(&build_hasher, &sequence, 256);
+ }
+
+-#[cfg(feature = "std")]
++#[cfg(all(feature = "std",any(feature = "runtime-rng", feature =
"compile-time-rng", feature = "no-rng")))]
+ #[test]
+ fn test_ahash_alias_map_construction() {
+ let mut map = ahash::HashMap::default();
+@@ -189,7 +189,7 @@ fn test_ahash_alias_map_construction() {
+ map.insert(1, "test");
+ }
+
+-#[cfg(feature = "std")]
++#[cfg(all(feature = "std",any(feature = "runtime-rng", feature =
"compile-time-rng", feature = "no-rng")))]
+ #[test]
+ fn test_ahash_alias_set_construction() {
+ let mut set = ahash::HashSet::default();
diff -Nru rust-ahash-0.8.5/debian/patches/series
rust-ahash-0.8.5/debian/patches/series
--- rust-ahash-0.8.5/debian/patches/series 2023-12-02 17:11:04.000000000
+0000
+++ rust-ahash-0.8.5/debian/patches/series 2023-12-26 10:08:52.000000000
+0000
@@ -1 +1,3 @@
+1001_bench_overflow.patch
+1002_test_feature_requirements.patch
2001_zerocopy.patch