Bug#1057451: rust-ahash: autopkgtests failing

2023-12-26 Thread Peter Green

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.0 +
+++ rust-ahash-0.8.5/debian/changelog   2023-12-26 10:08:52.0 +
@@ -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   Tue, 26 Dec 2023 10:08:52 +
+
 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.0 +
+++ rust-ahash-0.8.5/debian/patches/1001_bench_overflow.patch   2023-12-26 
10:08:52.0 +
@@ -0,0 +1,84 @@
+Description:  Disable overflowing additions whose results are not used in 
tests/bench.rs
+Author: Peter Michael Green 
+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:  Criterion) {
+ group.bench_function("aHash-alias", |b| {
+ b.iter(|| {
+ let hm: ahash::HashMap = (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() {
+-sum += x;
++//sum += x;
+ }
+ }
+ })
+@@ -129,10 +129,10 @@ fn bench_map(c:  Criterion) {
+ group.bench_function("aHash-hashBrown", |b| {
+ b.iter(|| {
+ let hm: hashbrown::HashMap = (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() {
+-sum += x;
++//sum += x;
+ }
+ }
+ })
+@@ -140,10 +140,10 @@ fn bench_map(c:  Criterion) {
+ group.bench_function("aHash-hashBrown-explicit", |b| {
+ b.iter(|| {
+ let hm: hashbrown::HashMap = 
(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() {
+-sum += x;
++//sum += x;
+ }
+ }
+ })
+@@ -151,10 +151,10 @@ fn bench_map(c:  Criterion) {
+ group.bench_function("aHash-wrapper", |b| {
+ b.iter(|| {
+ let hm: ahash::AHashMap = (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() {
+-sum += x;
++//sum += x;
+ }
+ }
+ })
+@@ -162,10 +162,10 @@ fn bench_map(c:  Criterion) {
+ group.bench_function("aHash-rand", |b| {
+ b.iter(|| {
+ let hm: std::collections::HashMap = 
(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() {
+-sum += x;
++//sum += x;
+ }
+ }
+ })
+@@ -174,10 +174,10 @@ fn bench_map(c:  Criterion) {
+ b.iter(|| 

Bug#1057451: rust-ahash: autopkgtests failing

2023-12-05 Thread Julian Gilbey
Source: rust-ahash
Version: 0.8.5-2
Severity: serious

Hi Jonas,

I have a package that depends on the newer version of rust-ahash, so
I've just taken a quick look at this package, which is not migrating
to testing because the autopkgtests are failing.  I am no Rust expert,
so I don't know the cause of this failure.  One thought: perhaps it's
because the autopkgtest dependencies (debian/tests/control) need to be
updated?  Here are the version differences I can see between
debian/control and debian/tests/control:

dh-cargo (>= 25) versus (>= 18)
librust-serde-1+default-dev (>= 1.0.117) versus (>= 1.0.59)

But it may be something else in this control file, like a missing
dependency perhaps?  Or there may be a bug in the upstream package.

Best wishes,

   Julian