forked from mirror/async-std
Test and fix 32 bit targets
This commit is contained in:
parent
6f6fced103
commit
e4c4c93d29
5 changed files with 54 additions and 7 deletions
33
.github/workflows/ci.yml
vendored
33
.github/workflows/ci.yml
vendored
|
@ -110,6 +110,39 @@ jobs:
|
||||||
command: check
|
command: check
|
||||||
args: --no-default-features --features alloc --target thumbv7m-none-eabi -Z avoid-dev-deps
|
args: --no-default-features --features alloc --target thumbv7m-none-eabi -Z avoid-dev-deps
|
||||||
|
|
||||||
|
cross:
|
||||||
|
name: Cross compile
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- i686-unknown-linux-gnu
|
||||||
|
- powerpc-unknown-linux-gnu
|
||||||
|
- powerpc64-unknown-linux-gnu
|
||||||
|
- mips-unknown-linux-gnu
|
||||||
|
- arm-linux-androideabi
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
|
||||||
|
- name: Install nightly
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: nightly
|
||||||
|
override: true
|
||||||
|
|
||||||
|
- name: Install cross
|
||||||
|
run: cargo install cross
|
||||||
|
|
||||||
|
- name: check
|
||||||
|
run: cross check --all --target ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: check unstable
|
||||||
|
run: cross check --all --features unstable --target ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: test
|
||||||
|
run: cross test --all --features unstable --target ${{ matrix.target }}
|
||||||
|
|
||||||
check_fmt_and_docs:
|
check_fmt_and_docs:
|
||||||
name: Checking fmt and docs
|
name: Checking fmt and docs
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
@ -67,6 +67,9 @@ pin-project-lite = { version = "0.1.4", optional = true }
|
||||||
pin-utils = { version = "0.1.0-alpha.4", optional = true }
|
pin-utils = { version = "0.1.0-alpha.4", optional = true }
|
||||||
slab = { version = "0.4.2", optional = true }
|
slab = { version = "0.4.2", optional = true }
|
||||||
|
|
||||||
|
# Devdepencency, but they are not allowed to be optional :/
|
||||||
|
surf = { version = "1.0.3", optional = true }
|
||||||
|
|
||||||
[target.'cfg(not(target_os = "unknown"))'.dependencies]
|
[target.'cfg(not(target_os = "unknown"))'.dependencies]
|
||||||
smol = { version = "0.1.1", optional = true }
|
smol = { version = "0.1.1", optional = true }
|
||||||
|
|
||||||
|
@ -81,7 +84,6 @@ wasm-bindgen-test = "0.3.10"
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
femme = "1.3.0"
|
femme = "1.3.0"
|
||||||
rand = "0.7.3"
|
rand = "0.7.3"
|
||||||
surf = "1.0.3"
|
|
||||||
tempdir = "0.3.7"
|
tempdir = "0.3.7"
|
||||||
futures = "0.3.4"
|
futures = "0.3.4"
|
||||||
rand_xorshift = "0.2.0"
|
rand_xorshift = "0.2.0"
|
||||||
|
@ -93,3 +95,7 @@ required-features = ["unstable"]
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "tcp-ipv4-and-6-echo"
|
name = "tcp-ipv4-and-6-echo"
|
||||||
required-features = ["unstable"]
|
required-features = ["unstable"]
|
||||||
|
|
||||||
|
[[example]]
|
||||||
|
name = "surf-web"
|
||||||
|
required-features = ["surf"]
|
|
@ -1,5 +1,5 @@
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::sync::atomic::{AtomicU64, Ordering};
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
|
|
||||||
/// A unique identifier for a task.
|
/// A unique identifier for a task.
|
||||||
///
|
///
|
||||||
|
@ -13,15 +13,16 @@ use std::sync::atomic::{AtomicU64, Ordering};
|
||||||
/// })
|
/// })
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Eq, PartialEq, Clone, Copy, Hash, Debug)]
|
#[derive(Eq, PartialEq, Clone, Copy, Hash, Debug)]
|
||||||
pub struct TaskId(pub(crate) u64);
|
pub struct TaskId(pub(crate) usize);
|
||||||
|
|
||||||
impl TaskId {
|
impl TaskId {
|
||||||
/// Generates a new `TaskId`.
|
/// Generates a new `TaskId`.
|
||||||
pub(crate) fn generate() -> TaskId {
|
pub(crate) fn generate() -> TaskId {
|
||||||
static COUNTER: AtomicU64 = AtomicU64::new(1);
|
// TODO: find a good version to emulate u64 atomics on 32 bit systems.
|
||||||
|
static COUNTER: AtomicUsize = AtomicUsize::new(1);
|
||||||
|
|
||||||
let id = COUNTER.fetch_add(1, Ordering::Relaxed);
|
let id = COUNTER.fetch_add(1, Ordering::Relaxed);
|
||||||
if id > u64::max_value() / 2 {
|
if id > usize::max_value() / 2 {
|
||||||
std::process::abort();
|
std::process::abort();
|
||||||
}
|
}
|
||||||
TaskId(id)
|
TaskId(id)
|
||||||
|
|
|
@ -5,7 +5,14 @@ use async_std::task;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(expected = "timed out")]
|
#[should_panic(expected = "timed out")]
|
||||||
#[cfg(not(target_os = "unknown"))]
|
#[cfg(not(any(
|
||||||
|
target_os = "unknown",
|
||||||
|
target_arch = "arm",
|
||||||
|
target_arch = "mips",
|
||||||
|
target_arch = "powerpc",
|
||||||
|
target_arch = "powerpc64",
|
||||||
|
target_arch = "x86",
|
||||||
|
)))] // stdin tests fail when running through cross
|
||||||
fn io_timeout_timedout() {
|
fn io_timeout_timedout() {
|
||||||
task::block_on(async {
|
task::block_on(async {
|
||||||
io::timeout(Duration::from_secs(1), async {
|
io::timeout(Duration::from_secs(1), async {
|
||||||
|
|
|
@ -12,7 +12,7 @@ fn timeout_future_many() {
|
||||||
task::block_on(async {
|
task::block_on(async {
|
||||||
let futures = (0..100)
|
let futures = (0..100)
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
timeout(Duration::from_millis(i * 10), async move {
|
timeout(Duration::from_millis(i * 20), async move {
|
||||||
task::sleep(Duration::from_millis(i)).await;
|
task::sleep(Duration::from_millis(i)).await;
|
||||||
Ok::<(), async_std::future::TimeoutError>(())
|
Ok::<(), async_std::future::TimeoutError>(())
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue