Move crates to crates folder

This commit is contained in:
Alex Crichton 2019-05-02 08:12:00 -07:00
parent aa8e7832be
commit 35fc5ed551
20 changed files with 288 additions and 109 deletions

View File

@ -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]

View File

@ -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
jobs:
- job: Docker
pool:
vmImage: 'Ubuntu-16.04'
vmImage: ubuntu-16.04
steps:
- script: echo Hello, world!
displayName: 'Run a one-line script'
- 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
- 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"

23
ci/azure-install-rust.yml Normal file
View File

@ -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

41
ci/azure-test-all.yml Normal file
View File

@ -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"

View File

@ -5,5 +5,5 @@
#![allow(dead_code)]
#![no_std]
#[path = "../../src/math/mod.rs"]
#[path = "../../../src/math/mod.rs"]
mod libm;

View File

@ -43,7 +43,7 @@ fn f32(rng: &mut XorShiftRng) -> Result<(), Box<Error>> {
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<Error>> {
}
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<Error>> {
}
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<Error>> {
}
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<Error>> {
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<Error>> {
}
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<Error>> {
}
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<Error>> {
}
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(())

View File

@ -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())?;
)+
}
}};

View File

@ -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::<Vec<_>>();
@ -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::<Vec<_>>();
@ -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::<Vec<_>>();
@ -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::<Vec<_>>();
@ -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::<Vec<_>>();
@ -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::<Vec<_>>();
@ -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::<Vec<_>>();
@ -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::<Vec<_>>();

View File

@ -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"

View File

@ -1,8 +0,0 @@
[package]
name = "math"
version = "0.0.0"
[dependencies]
qemu-arm-rt = { git = "https://github.com/japaric/qemu-arm-rt" }
[workspace]

View File

@ -1,2 +0,0 @@
[target.thumbv7em-none-eabi]
xargo = false

View File

@ -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);
}