From 35fc5ed5512f419efeb5639c47a1c1c7b1ae63c3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 2 May 2019 08:12:00 -0700 Subject: [PATCH] Move crates to `crates` folder --- Cargo.toml | 10 +- azure-pipelines.yml | 156 ++++++++++++++++-- ci/azure-install-rust.yml | 23 +++ ci/azure-test-all.yml | 41 +++++ .../compiler-builtins-smoke-test}/Cargo.toml | 0 .../compiler-builtins-smoke-test}/src/lib.rs | 2 +- .../input-generator}/Cargo.toml | 0 .../input-generator}/src/main.rs | 32 ++-- .../musl-generator}/Cargo.toml | 0 .../musl-generator}/src/macros.rs | 16 +- .../musl-generator}/src/main.rs | 0 .../newlib-generator}/Cargo.toml | 0 .../newlib-generator}/src/macros.rs | 0 .../newlib-generator}/src/main.rs | 0 {shared => crates/shared}/Cargo.toml | 0 {shared => crates/shared}/src/lib.rs | 82 +++++---- math/.cargo/config | 11 -- math/Cargo.toml | 8 - math/Cross.toml | 2 - src/math/acosf.rs | 14 ++ 20 files changed, 288 insertions(+), 109 deletions(-) create mode 100644 ci/azure-install-rust.yml create mode 100644 ci/azure-test-all.yml rename {cb => crates/compiler-builtins-smoke-test}/Cargo.toml (100%) rename {cb => crates/compiler-builtins-smoke-test}/src/lib.rs (82%) rename {input-generator => crates/input-generator}/Cargo.toml (100%) rename {input-generator => crates/input-generator}/src/main.rs (82%) rename {musl-generator => crates/musl-generator}/Cargo.toml (100%) rename {musl-generator => crates/musl-generator}/src/macros.rs (90%) rename {musl-generator => crates/musl-generator}/src/main.rs (100%) rename {newlib-generator => crates/newlib-generator}/Cargo.toml (100%) rename {newlib-generator => crates/newlib-generator}/src/macros.rs (100%) rename {newlib-generator => crates/newlib-generator}/src/main.rs (100%) rename {shared => crates/shared}/Cargo.toml (100%) rename {shared => crates/shared}/src/lib.rs (86%) delete mode 100644 math/.cargo/config delete mode 100644 math/Cargo.toml delete mode 100644 math/Cross.toml diff --git a/Cargo.toml b/Cargo.toml index f28024d..b4f07ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,11 +17,11 @@ stable = [] [workspace] members = [ - "cb", - "input-generator", - "musl-generator", - "newlib-generator", - "shared", + "crates/compiler-builtins-smoke-test", + "crates/input-generator", + "crates/musl-generator", + "crates/newlib-generator", + "crates/shared", ] [dev-dependencies] diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c23ced4..36271ec 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,19 +1,143 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml - trigger: -- master + - master -pool: - vmImage: 'Ubuntu-16.04' +jobs: + - job: Docker + pool: + vmImage: ubuntu-16.04 + steps: + - template: ci/azure-install-rust.yml + env: + TOOLCHAIN: nightly + - bash: rustup target add $TARGET + displayName: "Install rust cross target" + - bash: | + set -e + mkdir cross + curl -L https://github.com/rust-embedded/cross/releases/download/v0.1.14/cross-v0.1.14-x86_64-unknown-linux-musl.tar.gz | tar xzf - -C $HOME/.cargo/bin + displayName: "Install cross" + - bash: cross test --lib --features checked --target $TARGET --release + displayName: "Run lib tests" + - bash: cross test --tests --features checked --target $TARGET --release + displayName: "Run integration tests" + strategy: + matrix: + aarch64: + TARGET: aarch64-unknown-linux-gnu + armhv: + TARGET: arm-unknown-linux-gnueabihf + armv7: + TARGET: armv7-unknown-linux-gnueabihf + i586: + TARGET: i586-unknown-linux-gnu + i686: + TARGET: i686-unknown-linux-gnu + mips: + TARGET: mips-unknown-linux-gnu + mips64: + TARGET: mips64-unknown-linux-gnuabi64 + mips64el: + TARGET: mips64el-unknown-linux-gnuabi64 + powerpc: + TARGET: powerpc-unknown-linux-gnu + powerpc64: + TARGET: powerpc64-unknown-linux-gnu + powerpc64le: + TARGET: powerpc64le-unknown-linux-gnu + x86_64: + TARGET: x86_64-unknown-linux-gnu -steps: -- script: echo Hello, world! - displayName: 'Run a one-line script' - -- script: | - echo Add other tasks to build, test, and deploy your project. - echo See https://aka.ms/yaml - displayName: 'Run a multi-line script' + # - job: Linux + # pool: + # vmImage: ubuntu-16.04 + # steps: + # - template: ci/azure-test-all.yml + # strategy: + # matrix: + # stable: + # TOOLCHAIN: stable + # beta: + # TOOLCHAIN: beta + # nightly: + # TOOLCHAIN: nightly + # + # - job: macOS + # pool: + # vmImage: macos-10.13 + # steps: + # - template: ci/azure-test-all.yml + # strategy: + # matrix: + # x86_64: + # TARGET: x86_64-apple-darwin + # + # - job: iOS + # pool: + # vmImage: macos-10.13 + # steps: + # - checkout: self + # submodules: true + # - template: ci/azure-install-rust.yml + # - script: rustup target add $TARGET + # displayName: "Install rust cross target" + # - bash: | + # set -e + # export SDK_PATH=`xcrun --show-sdk-path --sdk $SDK` + # export RUSTFLAGS="-C link-arg=-isysroot -C link-arg=$SDK_PATH" + # cargo test --no-run --target $TARGET + # displayName: "Build for iOS" + # strategy: + # matrix: + # aarch64: + # TARGET: aarch64-apple-ios + # SDK: iphoneos + # armv7: + # TARGET: armv7-apple-ios + # SDK: iphoneos + # armv7s: + # TARGET: armv7s-apple-ios + # SDK: iphoneos + # i386: + # TARGET: i386-apple-ios + # SDK: iphonesimulator + # x86_64: + # TARGET: x86_64-apple-ios + # SDK: iphonesimulator + # + # - job: wasm + # pool: + # vmImage: ubuntu-16.04 + # steps: + # - checkout: self + # submodules: true + # - template: ci/azure-install-rust.yml + # - script: rustup target add wasm32-unknown-unknown + # displayName: "Install rust cross target" + # - script: cargo build --target wasm32-unknown-unknown + # displayName: "Build for wasm" + # + # - job: Windows + # pool: + # vmImage: vs2017-win2016 + # steps: + # - template: ci/azure-test-all.yml + # strategy: + # matrix: + # x86_64-msvc: + # TARGET: x86_64-pc-windows-msvc + # i686-msvc: + # TARGET: i686-pc-windows-msvc + # x86_64-gnu: + # TARGET: x86_64-pc-windows-gnu + # i686-gnu: + # TARGET: i686-pc-windows-gnu + # + # - job: Windows_arm64 + # pool: + # vmImage: windows-2019 + # steps: + # - template: ci/azure-install-rust.yml + # - script: rustup target add aarch64-pc-windows-msvc + # displayName: "Install rust cross target" + # - script: cargo test --no-run --target aarch64-pc-windows-msvc + # displayName: "Build for arm64" diff --git a/ci/azure-install-rust.yml b/ci/azure-install-rust.yml new file mode 100644 index 0000000..fa7eae4 --- /dev/null +++ b/ci/azure-install-rust.yml @@ -0,0 +1,23 @@ +steps: + - bash: | + set -e + toolchain=$TOOLCHAIN + if [ "$toolchain" = "" ]; then + toolchain=stable + fi + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $toolchain + echo "##vso[task.prependpath]$HOME/.cargo/bin" + displayName: Install rust (unix) + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + + - script: | + curl -sSf -o rustup-init.exe https://win.rustup.rs + rustup-init.exe -y --default-toolchain stable-%TARGET% + echo ##vso[task.prependpath]%USERPROFILE%\.cargo\bin + displayName: Install rust (windows) + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + + - script: | + rustc -Vv + cargo -V + displayName: Query rust and cargo versions diff --git a/ci/azure-test-all.yml b/ci/azure-test-all.yml new file mode 100644 index 0000000..b2b7124 --- /dev/null +++ b/ci/azure-test-all.yml @@ -0,0 +1,41 @@ +steps: + - checkout: self + submodules: true + - template: azure-install-rust.yml + + - bash: cargo build --manifest-path backtrace-sys/Cargo.toml + displayName: "Build backtrace-sys" + - bash: cargo build + displayName: "Build backtrace" + - bash: cargo test + displayName: "Test backtrace" + - bash: cargo test --no-default-features + displayName: "Test backtrace (-default)" + - bash: cargo test --no-default-features --features 'std' + displayName: "Test backtrace (-default + std)" + - bash: cargo test --no-default-features --features 'libunwind std' + displayName: "Test backtrace (-default + libunwind)" + - bash: cargo test --no-default-features --features 'libunwind dladdr std' + displayName: "Test backtrace (-default + libunwind + dladdr)" + - bash: cargo test --no-default-features --features 'libunwind libbacktrace std' + displayName: "Test backtrace (-default + libunwind + libbacktrace)" + - bash: cargo test --no-default-features --features 'unix-backtrace std' + displayName: "Test backtrace (-default + unix-backtrace)" + - bash: cargo test --no-default-features --features 'unix-backtrace dladdr std' + displayName: "Test backtrace (-default + unix-backtrace + dladdr)" + - bash: cargo test --no-default-features --features 'unix-backtrace libbacktrace std' + displayName: "Test backtrace (-default + unix-backtrace + libbacktrace)" + - bash: cargo test --no-default-features --features 'serialize-serde std' + displayName: "Test backtrace (-default + serialize-serde + std)" + - bash: cargo test --no-default-features --features 'serialize-rustc std' + displayName: "Test backtrace (-default + serialize-rustc + std)" + - bash: cargo test --no-default-features --features 'serialize-rustc serialize-serde std' + displayName: "Test backtrace (-default + serialize-rustc + serialize-serde + std)" + - bash: cargo test --no-default-features --features 'cpp_demangle std' + displayName: "Test backtrace (-default + cpp_demangle + std)" + - bash: cargo test --no-default-features --features 'gimli-symbolize std' + displayName: "Test backtrace (-default + gimli-symbolize + std)" + - bash: cargo test --no-default-features --features 'dbghelp std' + displayName: "Test backtrace (-default + dbghelp + std)" + - bash: cd ./cpp_smoke_test && cargo test + displayName: "Test cpp_smoke_test" diff --git a/cb/Cargo.toml b/crates/compiler-builtins-smoke-test/Cargo.toml similarity index 100% rename from cb/Cargo.toml rename to crates/compiler-builtins-smoke-test/Cargo.toml diff --git a/cb/src/lib.rs b/crates/compiler-builtins-smoke-test/src/lib.rs similarity index 82% rename from cb/src/lib.rs rename to crates/compiler-builtins-smoke-test/src/lib.rs index 439ba7d..7fad301 100644 --- a/cb/src/lib.rs +++ b/crates/compiler-builtins-smoke-test/src/lib.rs @@ -5,5 +5,5 @@ #![allow(dead_code)] #![no_std] -#[path = "../../src/math/mod.rs"] +#[path = "../../../src/math/mod.rs"] mod libm; diff --git a/input-generator/Cargo.toml b/crates/input-generator/Cargo.toml similarity index 100% rename from input-generator/Cargo.toml rename to crates/input-generator/Cargo.toml diff --git a/input-generator/src/main.rs b/crates/input-generator/src/main.rs similarity index 82% rename from input-generator/src/main.rs rename to crates/input-generator/src/main.rs index b4a6ad1..0746ea4 100644 --- a/input-generator/src/main.rs +++ b/crates/input-generator/src/main.rs @@ -43,7 +43,7 @@ fn f32(rng: &mut XorShiftRng) -> Result<(), Box> { let mut f = File::create("bin/input/f32")?; for i in set { - f.write_all(&i.to_bytes())?; + f.write_all(&i.to_le_bytes())?; } Ok(()) @@ -61,8 +61,8 @@ fn f32f32(rng: &mut XorShiftRng) -> Result<(), Box> { } i += 1; - f.write_all(&x0.to_bits().to_bytes())?; - f.write_all(&x1.to_bits().to_bytes())?; + f.write_all(&x0.to_bits().to_le_bytes())?; + f.write_all(&x1.to_bits().to_le_bytes())?; } Ok(()) @@ -80,8 +80,8 @@ fn f32i16(rng: &mut XorShiftRng) -> Result<(), Box> { } i += 1; - f.write_all(&x0.to_bits().to_bytes())?; - f.write_all(&x1.to_bytes())?; + f.write_all(&x0.to_bits().to_le_bytes())?; + f.write_all(&x1.to_le_bytes())?; } Ok(()) @@ -100,9 +100,9 @@ fn f32f32f32(rng: &mut XorShiftRng) -> Result<(), Box> { } i += 1; - f.write_all(&x0.to_bits().to_bytes())?; - f.write_all(&x1.to_bits().to_bytes())?; - f.write_all(&x2.to_bits().to_bytes())?; + f.write_all(&x0.to_bits().to_le_bytes())?; + f.write_all(&x1.to_bits().to_le_bytes())?; + f.write_all(&x2.to_bits().to_le_bytes())?; } Ok(()) @@ -123,7 +123,7 @@ fn f64(rng: &mut XorShiftRng) -> Result<(), Box> { let mut f = File::create("bin/input/f64")?; for i in set { - f.write_all(&i.to_bytes())?; + f.write_all(&i.to_le_bytes())?; } Ok(()) @@ -141,8 +141,8 @@ fn f64f64(rng: &mut XorShiftRng) -> Result<(), Box> { } i += 1; - f.write_all(&x0.to_bits().to_bytes())?; - f.write_all(&x1.to_bits().to_bytes())?; + f.write_all(&x0.to_bits().to_le_bytes())?; + f.write_all(&x1.to_bits().to_le_bytes())?; } Ok(()) @@ -161,9 +161,9 @@ fn f64f64f64(rng: &mut XorShiftRng) -> Result<(), Box> { } i += 1; - f.write_all(&x0.to_bits().to_bytes())?; - f.write_all(&x1.to_bits().to_bytes())?; - f.write_all(&x2.to_bits().to_bytes())?; + f.write_all(&x0.to_bits().to_le_bytes())?; + f.write_all(&x1.to_bits().to_le_bytes())?; + f.write_all(&x2.to_bits().to_le_bytes())?; } Ok(()) @@ -181,8 +181,8 @@ fn f64i16(rng: &mut XorShiftRng) -> Result<(), Box> { } i += 1; - f.write_all(&x0.to_bits().to_bytes())?; - f.write_all(&x1.to_bytes())?; + f.write_all(&x0.to_bits().to_le_bytes())?; + f.write_all(&x1.to_le_bytes())?; } Ok(()) diff --git a/musl-generator/Cargo.toml b/crates/musl-generator/Cargo.toml similarity index 100% rename from musl-generator/Cargo.toml rename to crates/musl-generator/Cargo.toml diff --git a/musl-generator/src/macros.rs b/crates/musl-generator/src/macros.rs similarity index 90% rename from musl-generator/src/macros.rs rename to crates/musl-generator/src/macros.rs index 16ba99d..e47c0ab 100644 --- a/musl-generator/src/macros.rs +++ b/crates/musl-generator/src/macros.rs @@ -16,7 +16,7 @@ macro_rules! f32 { $fun(*x) }; - $fun.write_all(&y.to_bits().to_bytes())?; + $fun.write_all(&y.to_bits().to_le_bytes())?; )+ } }}; @@ -40,7 +40,7 @@ macro_rules! f32f32 { $fun(*x0, *x1) }; - $fun.write_all(&y.to_bits().to_bytes())?; + $fun.write_all(&y.to_bits().to_le_bytes())?; )+ } }}; @@ -64,7 +64,7 @@ macro_rules! f32f32f32 { $fun(*x0, *x1, *x2) }; - $fun.write_all(&y.to_bits().to_bytes())?; + $fun.write_all(&y.to_bits().to_le_bytes())?; )+ } }}; @@ -88,7 +88,7 @@ macro_rules! f32i32 { $fun(*x0, *x1 as i32) }; - $fun.write_all(&y.to_bits().to_bytes())?; + $fun.write_all(&y.to_bits().to_le_bytes())?; )+ } }}; @@ -112,7 +112,7 @@ macro_rules! f64 { $fun(*x) }; - $fun.write_all(&y.to_bits().to_bytes())?; + $fun.write_all(&y.to_bits().to_le_bytes())?; )+ } }}; @@ -136,7 +136,7 @@ macro_rules! f64f64 { $fun(*x0, *x1) }; - $fun.write_all(&y.to_bits().to_bytes())?; + $fun.write_all(&y.to_bits().to_le_bytes())?; )+ } }}; @@ -160,7 +160,7 @@ macro_rules! f64f64f64 { $fun(*x0, *x1, *x2) }; - $fun.write_all(&y.to_bits().to_bytes())?; + $fun.write_all(&y.to_bits().to_le_bytes())?; )+ } }}; @@ -184,7 +184,7 @@ macro_rules! f64i32 { $fun(*x0, *x1 as i32) }; - $fun.write_all(&y.to_bits().to_bytes())?; + $fun.write_all(&y.to_bits().to_le_bytes())?; )+ } }}; diff --git a/musl-generator/src/main.rs b/crates/musl-generator/src/main.rs similarity index 100% rename from musl-generator/src/main.rs rename to crates/musl-generator/src/main.rs diff --git a/newlib-generator/Cargo.toml b/crates/newlib-generator/Cargo.toml similarity index 100% rename from newlib-generator/Cargo.toml rename to crates/newlib-generator/Cargo.toml diff --git a/newlib-generator/src/macros.rs b/crates/newlib-generator/src/macros.rs similarity index 100% rename from newlib-generator/src/macros.rs rename to crates/newlib-generator/src/macros.rs diff --git a/newlib-generator/src/main.rs b/crates/newlib-generator/src/main.rs similarity index 100% rename from newlib-generator/src/main.rs rename to crates/newlib-generator/src/main.rs diff --git a/shared/Cargo.toml b/crates/shared/Cargo.toml similarity index 100% rename from shared/Cargo.toml rename to crates/shared/Cargo.toml diff --git a/shared/src/lib.rs b/crates/shared/src/lib.rs similarity index 86% rename from shared/src/lib.rs rename to crates/shared/src/lib.rs index 84676f9..17c20a3 100644 --- a/shared/src/lib.rs +++ b/crates/shared/src/lib.rs @@ -1,5 +1,3 @@ -#![feature(exact_chunks)] - #[macro_use] extern crate lazy_static; @@ -8,11 +6,11 @@ lazy_static! { let bytes = include_bytes!("../../bin/input/f32"); bytes - .exact_chunks(4) + .chunks_exact(4) .map(|chunk| { let mut buf = [0; 4]; buf.copy_from_slice(chunk); - f32::from_bits(u32::from_le(u32::from_bytes(buf))) + f32::from_bits(u32::from_le(u32::from_le_bytes(buf))) }) .collect() }; @@ -20,7 +18,7 @@ lazy_static! { let bytes = include_bytes!("../../bin/input/f32f32"); bytes - .exact_chunks(8) + .chunks_exact(8) .map(|chunk| { let mut x0 = [0; 4]; let mut x1 = [0; 4]; @@ -28,8 +26,8 @@ lazy_static! { x1.copy_from_slice(&chunk[4..]); ( - f32::from_bits(u32::from_le(u32::from_bytes(x0))), - f32::from_bits(u32::from_le(u32::from_bytes(x1))), + f32::from_bits(u32::from_le(u32::from_le_bytes(x0))), + f32::from_bits(u32::from_le(u32::from_le_bytes(x1))), ) }) .collect() @@ -38,7 +36,7 @@ lazy_static! { let bytes = include_bytes!("../../bin/input/f32f32f32"); bytes - .exact_chunks(12) + .chunks_exact(12) .map(|chunk| { let mut x0 = [0; 4]; let mut x1 = [0; 4]; @@ -48,9 +46,9 @@ lazy_static! { x2.copy_from_slice(&chunk[8..]); ( - f32::from_bits(u32::from_le(u32::from_bytes(x0))), - f32::from_bits(u32::from_le(u32::from_bytes(x1))), - f32::from_bits(u32::from_le(u32::from_bytes(x2))), + f32::from_bits(u32::from_le(u32::from_le_bytes(x0))), + f32::from_bits(u32::from_le(u32::from_le_bytes(x1))), + f32::from_bits(u32::from_le(u32::from_le_bytes(x2))), ) }) .collect() @@ -59,7 +57,7 @@ lazy_static! { let bytes = include_bytes!("../../bin/input/f32i16"); bytes - .exact_chunks(6) + .chunks_exact(6) .map(|chunk| { let mut x0 = [0; 4]; let mut x1 = [0; 2]; @@ -67,8 +65,8 @@ lazy_static! { x1.copy_from_slice(&chunk[4..]); ( - f32::from_bits(u32::from_le(u32::from_bytes(x0))), - i16::from_le(i16::from_bytes(x1)) as i32, + f32::from_bits(u32::from_le(u32::from_le_bytes(x0))), + i16::from_le(i16::from_le_bytes(x1)) as i32, ) }) .collect() @@ -77,11 +75,11 @@ lazy_static! { let bytes = include_bytes!("../../bin/input/f64"); bytes - .exact_chunks(8) + .chunks_exact(8) .map(|chunk| { let mut buf = [0; 8]; buf.copy_from_slice(chunk); - f64::from_bits(u64::from_le(u64::from_bytes(buf))) + f64::from_bits(u64::from_le(u64::from_le_bytes(buf))) }) .collect() }; @@ -89,7 +87,7 @@ lazy_static! { let bytes = include_bytes!("../../bin/input/f64f64"); bytes - .exact_chunks(16) + .chunks_exact(16) .map(|chunk| { let mut x0 = [0; 8]; let mut x1 = [0; 8]; @@ -97,8 +95,8 @@ lazy_static! { x1.copy_from_slice(&chunk[8..]); ( - f64::from_bits(u64::from_le(u64::from_bytes(x0))), - f64::from_bits(u64::from_le(u64::from_bytes(x1))), + f64::from_bits(u64::from_le(u64::from_le_bytes(x0))), + f64::from_bits(u64::from_le(u64::from_le_bytes(x1))), ) }) .collect() @@ -107,7 +105,7 @@ lazy_static! { let bytes = include_bytes!("../../bin/input/f64f64f64"); bytes - .exact_chunks(24) + .chunks_exact(24) .map(|chunk| { let mut x0 = [0; 8]; let mut x1 = [0; 8]; @@ -117,9 +115,9 @@ lazy_static! { x2.copy_from_slice(&chunk[16..]); ( - f64::from_bits(u64::from_le(u64::from_bytes(x0))), - f64::from_bits(u64::from_le(u64::from_bytes(x1))), - f64::from_bits(u64::from_le(u64::from_bytes(x2))), + f64::from_bits(u64::from_le(u64::from_le_bytes(x0))), + f64::from_bits(u64::from_le(u64::from_le_bytes(x1))), + f64::from_bits(u64::from_le(u64::from_le_bytes(x2))), ) }) .collect() @@ -128,7 +126,7 @@ lazy_static! { let bytes = include_bytes!("../../bin/input/f64i16"); bytes - .exact_chunks(10) + .chunks_exact(10) .map(|chunk| { let mut x0 = [0; 8]; let mut x1 = [0; 2]; @@ -136,8 +134,8 @@ lazy_static! { x1.copy_from_slice(&chunk[8..]); ( - f64::from_bits(u64::from_le(u64::from_bytes(x0))), - i16::from_le(i16::from_bytes(x1)) as i32, + f64::from_bits(u64::from_le(u64::from_le_bytes(x0))), + i16::from_le(i16::from_le_bytes(x1)) as i32, ) }) .collect() @@ -151,11 +149,11 @@ macro_rules! f32 { #[test] fn $fun() { let expected = include_bytes!(concat!("../bin/output/", $lib, ".", stringify!($fun))) - .exact_chunks(4) + .chunks_exact(4) .map(|chunk| { let mut buf = [0; 4]; buf.copy_from_slice(chunk); - f32::from_bits(u32::from_le(u32::from_bytes(buf))) + f32::from_bits(u32::from_le(u32::from_le_bytes(buf))) }) .collect::>(); @@ -190,11 +188,11 @@ macro_rules! f32f32 { #[test] fn $fun() { let expected = include_bytes!(concat!("../bin/output/", $lib, ".", stringify!($fun))) - .exact_chunks(4) + .chunks_exact(4) .map(|chunk| { let mut buf = [0; 4]; buf.copy_from_slice(chunk); - f32::from_bits(u32::from_le(u32::from_bytes(buf))) + f32::from_bits(u32::from_le(u32::from_le_bytes(buf))) }) .collect::>(); @@ -231,11 +229,11 @@ macro_rules! f32f32f32 { #[test] fn $fun() { let expected = include_bytes!(concat!("../bin/output/", $lib, ".", stringify!($fun))) - .exact_chunks(4) + .chunks_exact(4) .map(|chunk| { let mut buf = [0; 4]; buf.copy_from_slice(chunk); - f32::from_bits(u32::from_le(u32::from_bytes(buf))) + f32::from_bits(u32::from_le(u32::from_le_bytes(buf))) }) .collect::>(); @@ -273,11 +271,11 @@ macro_rules! f32i32 { #[test] fn $fun() { let expected = include_bytes!(concat!("../bin/output/", $lib, ".", stringify!($fun))) - .exact_chunks(4) + .chunks_exact(4) .map(|chunk| { let mut buf = [0; 4]; buf.copy_from_slice(chunk); - f32::from_bits(u32::from_le(u32::from_bytes(buf))) + f32::from_bits(u32::from_le(u32::from_le_bytes(buf))) }) .collect::>(); @@ -314,11 +312,11 @@ macro_rules! f64 { #[test] fn $fun() { let expected = include_bytes!(concat!("../bin/output/", $lib, ".", stringify!($fun))) - .exact_chunks(8) + .chunks_exact(8) .map(|chunk| { let mut buf = [0; 8]; buf.copy_from_slice(chunk); - f64::from_bits(u64::from_le(u64::from_bytes(buf))) + f64::from_bits(u64::from_le(u64::from_le_bytes(buf))) }) .collect::>(); @@ -353,11 +351,11 @@ macro_rules! f64f64 { #[test] fn $fun() { let expected = include_bytes!(concat!("../bin/output/", $lib, ".", stringify!($fun))) - .exact_chunks(8) + .chunks_exact(8) .map(|chunk| { let mut buf = [0; 8]; buf.copy_from_slice(chunk); - f64::from_bits(u64::from_le(u64::from_bytes(buf))) + f64::from_bits(u64::from_le(u64::from_le_bytes(buf))) }) .collect::>(); @@ -394,11 +392,11 @@ macro_rules! f64f64f64 { #[test] fn $fun() { let expected = include_bytes!(concat!("../bin/output/", $lib, ".", stringify!($fun))) - .exact_chunks(8) + .chunks_exact(8) .map(|chunk| { let mut buf = [0; 8]; buf.copy_from_slice(chunk); - f64::from_bits(u64::from_le(u64::from_bytes(buf))) + f64::from_bits(u64::from_le(u64::from_le_bytes(buf))) }) .collect::>(); @@ -436,11 +434,11 @@ macro_rules! f64i32 { #[test] fn $fun() { let expected = include_bytes!(concat!("../bin/output/", $lib, ".", stringify!($fun))) - .exact_chunks(8) + .chunks_exact(8) .map(|chunk| { let mut buf = [0; 8]; buf.copy_from_slice(chunk); - f64::from_bits(u64::from_le(u64::from_bytes(buf))) + f64::from_bits(u64::from_le(u64::from_le_bytes(buf))) }) .collect::>(); diff --git a/math/.cargo/config b/math/.cargo/config deleted file mode 100644 index be79c45..0000000 --- a/math/.cargo/config +++ /dev/null @@ -1,11 +0,0 @@ -[target.thumbv7em-none-eabi] -rustflags = [ - "-C", "link-arg=-Wl,-Tlink.x", - "-C", "link-arg=-nostartfiles", - "-C", "link-arg=-mthumb", - "-C", "link-arg=-march=armv7e-m", - "-C", "link-arg=-mfloat-abi=soft", -] - -[build] -target = "thumbv7em-none-eabi" \ No newline at end of file diff --git a/math/Cargo.toml b/math/Cargo.toml deleted file mode 100644 index 5bca038..0000000 --- a/math/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "math" -version = "0.0.0" - -[dependencies] -qemu-arm-rt = { git = "https://github.com/japaric/qemu-arm-rt" } - -[workspace] \ No newline at end of file diff --git a/math/Cross.toml b/math/Cross.toml deleted file mode 100644 index 471770b..0000000 --- a/math/Cross.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.thumbv7em-none-eabi] -xargo = false \ No newline at end of file diff --git a/src/math/acosf.rs b/src/math/acosf.rs index 469601c..b12ed53 100644 --- a/src/math/acosf.rs +++ b/src/math/acosf.rs @@ -73,3 +73,17 @@ pub fn acosf(x: f32) -> f32 { w = r(z) * s + c; 2. * (df + w) } + +#[cfg(test)] +mod tests { + #[test] + fn acosf() { + extern { + fn acosf(x: f32) -> f32; + } + unsafe { + crate::_eqf(super::acosf(1.0), acosf(1.0)).unwrap(); + } + } + // shared::f32!("musl", acosf); +}