From aabaa0bee825a0be3bc8536e16e834d12b01429c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Wed, 23 Oct 2024 22:37:49 +0200 Subject: [PATCH] fix or disable some more broken tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabian Grünbichler --- ...on-like-enum.rs-UB-free-and-portable.patch | 117 ++++++++++++++++++ .../build/disable-broken-i386-tests.patch | 40 ++++++ .../build/ignore-broken-debuginfo-tests.patch | 55 ++++++++ debian/patches/series | 3 + 4 files changed, 215 insertions(+) create mode 100644 debian/patches/build/Make-option-like-enum.rs-UB-free-and-portable.patch create mode 100644 debian/patches/build/disable-broken-i386-tests.patch create mode 100644 debian/patches/build/ignore-broken-debuginfo-tests.patch diff --git a/debian/patches/build/Make-option-like-enum.rs-UB-free-and-portable.patch b/debian/patches/build/Make-option-like-enum.rs-UB-free-and-portable.patch new file mode 100644 index 0000000000..b788e30227 --- /dev/null +++ b/debian/patches/build/Make-option-like-enum.rs-UB-free-and-portable.patch @@ -0,0 +1,117 @@ +From: Ben Kimock +Date: Tue, 27 Aug 2024 19:10:22 -0400 +Subject: Make option-like-enum.rs UB-free and portable + +(cherry picked from commit 1a2ec2634e378c8e1b8c531f29c4f983b87a5764) + +Forwarded: https://github.com/rust-lang/rust/pull/129672 +--- + tests/debuginfo/option-like-enum.rs | 39 +++++++++++++------------------------ + 1 file changed, 14 insertions(+), 25 deletions(-) + +diff --git a/tests/debuginfo/option-like-enum.rs b/tests/debuginfo/option-like-enum.rs +index d370796..72a4198 100644 +--- a/tests/debuginfo/option-like-enum.rs ++++ b/tests/debuginfo/option-like-enum.rs +@@ -8,22 +8,22 @@ + // gdb-command:run + + // gdb-command:print some +-// gdb-check:$1 = core::option::Option<&u32>::Some(0x12345678) ++// gdb-check:$1 = core::option::Option<&u32>::Some(0x[...]) + + // gdb-command:print none + // gdb-check:$2 = core::option::Option<&u32>::None + + // gdb-command:print full +-// gdb-check:$3 = option_like_enum::MoreFields::Full(454545, 0x87654321, 9988) ++// gdb-check:$3 = option_like_enum::MoreFields::Full(454545, 0x[...], 9988) + +-// gdb-command:print empty_gdb.discr +-// gdb-check:$4 = (*mut isize) 0x1 ++// gdb-command:print empty ++// gdb-check:$4 = option_like_enum::MoreFields::Empty + + // gdb-command:print droid +-// gdb-check:$5 = option_like_enum::NamedFields::Droid{id: 675675, range: 10000001, internals: 0x43218765} ++// gdb-check:$5 = option_like_enum::NamedFields::Droid{id: 675675, range: 10000001, internals: 0x[...]} + +-// gdb-command:print void_droid_gdb.internals +-// gdb-check:$6 = (*mut isize) 0x1 ++// gdb-command:print void_droid ++// gdb-check:$6 = option_like_enum::NamedFields::Void + + // gdb-command:print nested_non_zero_yep + // gdb-check:$7 = option_like_enum::NestedNonZero::Yep(10.5, option_like_enum::NestedNonZeroField {a: 10, b: 20, c: 0x[...]}) +@@ -39,19 +39,19 @@ + // lldb-command:run + + // lldb-command:v some +-// lldb-check:[...] Some(&0x12345678) ++// lldb-check:[...] Some(&0x[...]) + + // lldb-command:v none + // lldb-check:[...] None + + // lldb-command:v full +-// lldb-check:[...] Full(454545, &0x87654321, 9988) ++// lldb-check:[...] Full(454545, &0x[...], 9988) + + // lldb-command:v empty + // lldb-check:[...] Empty + + // lldb-command:v droid +-// lldb-check:[...] Droid { id: 675675, range: 10000001, internals: &0x43218765 } ++// lldb-check:[...] Droid { id: 675675, range: 10000001, internals: &0x[...] } + + // lldb-command:v void_droid + // lldb-check:[...] Void +@@ -76,11 +76,6 @@ + // contains a non-nullable pointer, then this value is used as the discriminator. + // The test cases in this file make sure that something readable is generated for + // this kind of types. +-// If the non-empty variant contains a single non-nullable pointer than the whole +-// item is represented as just a pointer and not wrapped in a struct. +-// Unfortunately (for these test cases) the content of the non-discriminant fields +-// in the null-case is not defined. So we just read the discriminator field in +-// this case (by casting the value to a memory-equivalent struct). + + enum MoreFields<'a> { + Full(u32, &'a isize, i16), +@@ -120,32 +115,26 @@ fn main() { + let some_str: Option<&'static str> = Some("abc"); + let none_str: Option<&'static str> = None; + +- let some: Option<&u32> = Some(unsafe { std::mem::transmute(0x12345678_usize) }); ++ let some: Option<&u32> = Some(&1234); + let none: Option<&u32> = None; + +- let full = MoreFields::Full(454545, unsafe { std::mem::transmute(0x87654321_usize) }, 9988); +- ++ let full = MoreFields::Full(454545, &1234, 9988); + let empty = MoreFields::Empty; +- let empty_gdb: &MoreFieldsRepr = unsafe { std::mem::transmute(&MoreFields::Empty) }; + + let droid = NamedFields::Droid { + id: 675675, + range: 10000001, +- internals: unsafe { std::mem::transmute(0x43218765_usize) } ++ internals: &1234, + }; +- + let void_droid = NamedFields::Void; +- let void_droid_gdb: &NamedFieldsRepr = unsafe { std::mem::transmute(&NamedFields::Void) }; + +- let x = 'x'; + let nested_non_zero_yep = NestedNonZero::Yep( + 10.5, + NestedNonZeroField { + a: 10, + b: 20, +- c: &x ++ c: &'x', + }); +- + let nested_non_zero_nope = NestedNonZero::Nope; + + zzz(); // #break diff --git a/debian/patches/build/disable-broken-i386-tests.patch b/debian/patches/build/disable-broken-i386-tests.patch new file mode 100644 index 0000000000..270766e41f --- /dev/null +++ b/debian/patches/build/disable-broken-i386-tests.patch @@ -0,0 +1,40 @@ +From: =?utf-8?q?Fabian_Gr=C3=BCnbichler?= +Date: Wed, 23 Oct 2024 22:29:50 +0200 +Subject: disable broken i386 tests +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + + +Signed-off-by: Fabian Grünbichler +--- + tests/ui/consts/const-float-bits-conv.rs | 3 ++- + tests/ui/traits/object/print_vtable_sizes.rs | 2 ++ + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/tests/ui/consts/const-float-bits-conv.rs b/tests/ui/consts/const-float-bits-conv.rs +index 3a526c5..682eff2 100644 +--- a/tests/ui/consts/const-float-bits-conv.rs ++++ b/tests/ui/consts/const-float-bits-conv.rs +@@ -26,7 +26,8 @@ macro_rules! const_assert { + + fn has_broken_floats() -> bool { + // i586 targets are broken due to . +- std::env::var("TARGET").is_ok_and(|v| v.contains("i586")) ++ // Debian: this is true for our i686 target (i368 arch) ++ std::env::var("TARGET").is_ok_and(|v| v.contains("i686")) + } + + #[cfg(target_arch = "x86_64")] +diff --git a/tests/ui/traits/object/print_vtable_sizes.rs b/tests/ui/traits/object/print_vtable_sizes.rs +index 684458d..d288d18 100644 +--- a/tests/ui/traits/object/print_vtable_sizes.rs ++++ b/tests/ui/traits/object/print_vtable_sizes.rs +@@ -1,5 +1,7 @@ + //@ check-pass + //@ compile-flags: -Z print-vtable-sizes ++//Debian: broken floats break the expected output on i386 ++//@ ignore-i686 + #![crate_type = "lib"] + + trait A: AsRef<[T::V]> + AsMut<[T::V]> {} diff --git a/debian/patches/build/ignore-broken-debuginfo-tests.patch b/debian/patches/build/ignore-broken-debuginfo-tests.patch new file mode 100644 index 0000000000..da45f4f17a --- /dev/null +++ b/debian/patches/build/ignore-broken-debuginfo-tests.patch @@ -0,0 +1,55 @@ +From: =?utf-8?q?Fabian_Gr=C3=BCnbichler?= +Date: Wed, 23 Oct 2024 22:37:25 +0200 +Subject: ignore broken debuginfo tests +MIME-Version: 1.0 +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Forwarded: yes + +Signed-off-by: Fabian Grünbichler +--- + tests/debuginfo/by-value-non-immediate-argument.rs | 2 ++ + tests/debuginfo/macro-stepping.rs | 3 ++- + tests/debuginfo/method-on-enum.rs | 2 ++ + 3 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/tests/debuginfo/by-value-non-immediate-argument.rs b/tests/debuginfo/by-value-non-immediate-argument.rs +index f0a39a4..f6e0ea0 100644 +--- a/tests/debuginfo/by-value-non-immediate-argument.rs ++++ b/tests/debuginfo/by-value-non-immediate-argument.rs +@@ -1,6 +1,8 @@ + //@ min-lldb-version: 1800 + //@ min-gdb-version: 13.0 + //@ compile-flags:-g ++//Debian: broken, see https://github.com/rust-lang/rust/issues/129662#issuecomment-2313102689 ++//@ ignore-gdb + + // === GDB TESTS =================================================================================== + +diff --git a/tests/debuginfo/macro-stepping.rs b/tests/debuginfo/macro-stepping.rs +index 35bb6de..dec0eff 100644 +--- a/tests/debuginfo/macro-stepping.rs ++++ b/tests/debuginfo/macro-stepping.rs +@@ -2,7 +2,8 @@ + //@ ignore-aarch64 + //@ min-lldb-version: 1800 + //@ min-gdb-version: 13.0 +- ++//Debian: broken, see https://github.com/rust-lang/rust/issues/130896 ++//@ ignore-gdb + //@ aux-build:macro-stepping.rs + + #![allow(unused)] +diff --git a/tests/debuginfo/method-on-enum.rs b/tests/debuginfo/method-on-enum.rs +index a570144..68a82a5 100644 +--- a/tests/debuginfo/method-on-enum.rs ++++ b/tests/debuginfo/method-on-enum.rs +@@ -1,5 +1,7 @@ + //@ min-lldb-version: 1800 + //@ min-gdb-version: 13.0 ++//Debian: broken, see https://github.com/rust-lang/rust/issues/129662#issuecomment-2313102689 ++//@ ignore-gdb + + //@ compile-flags:-g + diff --git a/debian/patches/series b/debian/patches/series index 1d29169e3e..8a39ab21b1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -42,3 +42,6 @@ ubuntu/ubuntu-ignore-arm-doctest.patch vendor/onig_sys-use-system-lib.patch vendor/libz-sys-allow-cross-building.patch build/bootstrap-tests-disable-compiler-rt-optimizing.patch +build/disable-broken-i386-tests.patch +build/Make-option-like-enum.rs-UB-free-and-portable.patch +build/ignore-broken-debuginfo-tests.patch