diff --git a/debian/patches/series b/debian/patches/series index 797c15920f..a2277b0c57 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -8,13 +8,14 @@ u-prefer-local-css.patch u-make-tests-work-without-rpath.patch u-tag-private-modules-with-doc-cfg.patch u-sparc64-cabi.patch +u-rust-52760-test_loading_atoi.patch +u-rust-52876-const-endianess.patch # https://github.com/rust-lang/compiler-rt/pull/35/ u-compiler-rt.patch # Extra ignored tests. We now instead raise FAILURES_ALLOWED in d/rules but # these patches are kept in case they are useful for derivatives. -#u-ignoretest-arm64_02.patch #u-ignoretest-ppc64el_02.patch # not forwarded, or forwarded but unlikely to be merged diff --git a/debian/patches/u-ignoretest-arm64_02.patch b/debian/patches/u-ignoretest-arm64_02.patch deleted file mode 100644 index e43f8299ca..0000000000 --- a/debian/patches/u-ignoretest-arm64_02.patch +++ /dev/null @@ -1,16 +0,0 @@ -Description: Don't run dynamic_lib::tests::test_loading_cosine on Aarch64 and - powerpc64le whilst it fails. -Author: Chris Coulson -Bug: https://github.com/rust-lang/rust/issues/45410 - ---- a/src/librustc_metadata/dynamic_lib.rs -+++ b/src/librustc_metadata/dynamic_lib.rs -@@ -91,7 +91,7 @@ - - #[test] - fn test_loading_cosine() { -- if cfg!(windows) { -+ if cfg!(any(windows, target_arch = "aarch64", all(target_arch = "powerpc64", target_endian = "little"))) { - return - } - diff --git a/debian/patches/u-rust-52760-test_loading_atoi.patch b/debian/patches/u-rust-52760-test_loading_atoi.patch new file mode 100644 index 0000000000..77ddf13db3 --- /dev/null +++ b/debian/patches/u-rust-52760-test_loading_atoi.patch @@ -0,0 +1,62 @@ +From efa11da26a882aaf57f7eae747e48d128c474bf3 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Thu, 26 Jul 2018 17:20:02 -0700 +Subject: [PATCH] rustc_metadata: test loading atoi instead of cos + +Some platforms don't actually have `libm` already linked in the test +infrastructure, and then `dynamic_lib::tests::test_loading_cosine` would +fail to find the "cos" symbol. Every platform running this test should +have `libc` and "atoi" though, so try to use that symbol instead. + +Fixes #45410. +--- + src/librustc_metadata/dynamic_lib.rs | 25 ++++++++++++------------- + 1 file changed, 12 insertions(+), 13 deletions(-) + +diff --git a/src/librustc_metadata/dynamic_lib.rs b/src/librustc_metadata/dynamic_lib.rs +index d7da0d00012e..182a071277ec 100644 +--- a/src/librustc_metadata/dynamic_lib.rs ++++ b/src/librustc_metadata/dynamic_lib.rs +@@ -90,30 +90,29 @@ mod tests { + use std::mem; + + #[test] +- fn test_loading_cosine() { ++ fn test_loading_atoi() { + if cfg!(windows) { + return + } + +- // The math library does not need to be loaded since it is already +- // statically linked in +- let libm = match DynamicLibrary::open(None) { ++ // The C library does not need to be loaded since it is already linked in ++ let lib = match DynamicLibrary::open(None) { + Err(error) => panic!("Could not load self as module: {}", error), +- Ok(libm) => libm ++ Ok(lib) => lib + }; + +- let cosine: extern fn(libc::c_double) -> libc::c_double = unsafe { +- match libm.symbol("cos") { +- Err(error) => panic!("Could not load function cos: {}", error), +- Ok(cosine) => mem::transmute::<*mut u8, _>(cosine) ++ let atoi: extern fn(*const libc::c_char) -> libc::c_int = unsafe { ++ match lib.symbol("atoi") { ++ Err(error) => panic!("Could not load function atoi: {}", error), ++ Ok(atoi) => mem::transmute::<*mut u8, _>(atoi) + } + }; + +- let argument = 0.0; +- let expected_result = 1.0; +- let result = cosine(argument); ++ let argument = CString::new("1383428980").unwrap(); ++ let expected_result = 0x52757374; ++ let result = atoi(argument.as_ptr()); + if result != expected_result { +- panic!("cos({}) != {} but equaled {} instead", argument, ++ panic!("atoi({:?}) != {} but equaled {} instead", argument, + expected_result, result) + } + } diff --git a/debian/patches/u-rust-52876-const-endianess.patch b/debian/patches/u-rust-52876-const-endianess.patch new file mode 100644 index 0000000000..1e844e8274 --- /dev/null +++ b/debian/patches/u-rust-52876-const-endianess.patch @@ -0,0 +1,26 @@ +From 1ea2765918d1212a07e1359537470c477d82a681 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Mon, 30 Jul 2018 13:08:56 -0700 +Subject: [PATCH] run-pass/const-endianness: negate before to_le() + +`const LE_I128` needs parentheses to negate the value *before* calling +`to_le()`, otherwise it doesn't match the operations performed in the +black-boxed part of the test. This only makes a tangible difference on +big-endian targets. +--- + src/test/run-pass/const-endianess.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/test/run-pass/const-endianess.rs b/src/test/run-pass/const-endianess.rs +index fa34b49210a6..95c738d3ec49 100644 +--- a/src/test/run-pass/const-endianess.rs ++++ b/src/test/run-pass/const-endianess.rs +@@ -25,7 +25,7 @@ fn main() { + #[cfg(not(target_arch = "asmjs"))] + { + const BE_U128: u128 = 999999u128.to_be(); +- const LE_I128: i128 = -999999i128.to_le(); ++ const LE_I128: i128 = (-999999i128).to_le(); + assert_eq!(BE_U128, b(999999u128).to_be()); + assert_eq!(LE_I128, b(-999999i128).to_le()); + }