Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test i686-unknown-linux-gnu and aarch64-unknown-linux-gnu on CI #613

Merged
merged 9 commits into from Jan 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
51 changes: 36 additions & 15 deletions .github/workflows/ci.yml
Expand Up @@ -24,30 +24,39 @@ jobs:
name: test
env:
RUST_VERSION: ${{ matrix.rust }}
TARGET: ${{ matrix.target }}
strategy:
matrix:
crates:
- crossbeam
- crossbeam-channel
- crossbeam-deque
- crossbeam-epoch
- crossbeam-queue
- crossbeam-skiplist
- crossbeam-utils
rust:
- 1.36.0
- nightly
os:
- ubuntu-latest
- windows-latest
include:
jeehoonkang marked this conversation as resolved.
Show resolved Hide resolved
- rust: 1.36.0
os: ubuntu-latest
- rust: 1.36.0
os: windows-latest
- rust: stable
os: ubuntu-latest
- rust: stable
os: windows-latest
- rust: nightly
os: ubuntu-latest
# TODO: https://github.com/crossbeam-rs/crossbeam/pull/518#issuecomment-633342606
# - rust: nightly
# os: macos-latest
- rust: nightly
os: windows-latest
- rust: nightly
os: ubuntu-latest
target: i686-unknown-linux-gnu
- rust: nightly
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install Rust
# --no-self-update is necessary because the windows environment cannot self-update rustup.exe.
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
- name: Test
run: ./ci/${{ matrix.crates }}.sh
run: ./ci/test.sh

# Check all feature combinations works properly.
features:
Expand Down Expand Up @@ -116,6 +125,17 @@ jobs:
- name: loom
run: ./ci/crossbeam-epoch-loom.sh

# Check if the document can be generated without warning.
docs:
name: docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup update nightly && rustup default nightly
- name: docs
run: ./ci/docs.sh

# This job doesn't actually test anything, but they're used to tell bors the
# build completed, as there is no practical way to detect when a workflow is
# successful listening to webhooks only.
Expand All @@ -132,6 +152,7 @@ jobs:
- rustfmt
- clippy
- loom
- docs
runs-on: ubuntu-latest
steps:
- name: Mark the job as a success
Expand Down
17 changes: 0 additions & 17 deletions ci/crossbeam-channel.sh

This file was deleted.

13 changes: 0 additions & 13 deletions ci/crossbeam-deque.sh

This file was deleted.

4 changes: 2 additions & 2 deletions ci/crossbeam-epoch-loom.sh
Expand Up @@ -3,9 +3,9 @@
cd "$(dirname "$0")"/../crossbeam-epoch
set -ex

export RUSTFLAGS="-D warnings --cfg=loom_crossbeam"
export RUSTFLAGS="-D warnings --cfg loom_crossbeam --cfg crossbeam_sanitize"

# With MAX_PREEMPTIONS=2 the loom tests (currently) take around 11m.
# If we were to run with =3, they would take several times that,
# which is probably too costly for CI.
env LOOM_MAX_PREEMPTIONS=2 cargo test --test loom --features sanitize --release -- --nocapture
env LOOM_MAX_PREEMPTIONS=2 cargo test --test loom --release -- --nocapture
25 changes: 0 additions & 25 deletions ci/crossbeam-epoch.sh

This file was deleted.

13 changes: 0 additions & 13 deletions ci/crossbeam-queue.sh

This file was deleted.

15 changes: 0 additions & 15 deletions ci/crossbeam-skiplist.sh

This file was deleted.

15 changes: 0 additions & 15 deletions ci/crossbeam-utils.sh

This file was deleted.

15 changes: 0 additions & 15 deletions ci/crossbeam.sh

This file was deleted.

8 changes: 8 additions & 0 deletions ci/docs.sh
@@ -0,0 +1,8 @@
#!/bin/bash

cd "$(dirname "$0")"/..
set -ex

export RUSTDOCFLAGS="-D warnings"

cargo doc --no-deps --all --all-features
46 changes: 46 additions & 0 deletions ci/test.sh
@@ -0,0 +1,46 @@
#!/bin/bash

cd "$(dirname "$0")"/..
set -ex

export RUSTFLAGS="-D warnings"

if [[ -n "$TARGET" ]]; then
# If TARGET is specified, use cross for testing.
cargo install cross
cross test --all --target "$TARGET" --exclude benchmarks

# For now, the non-host target only runs tests.
exit 0
fi

# Otherwise, run tests and checks with the host target.
cargo check --all --bins --examples --tests --exclude benchmarks
cargo test --all --exclude benchmarks -- --test-threads=1

if [[ "$RUST_VERSION" == "nightly"* ]]; then
# Some crates have `nightly` feature, so run tests with --all-features.
cargo test --all --all-features --exclude benchmarks -- --test-threads=1

# Benchmarks are only checked on nightly because depending on unstable features.
cargo check --all --benches
cargo check --bins --manifest-path crossbeam-channel/benchmarks/Cargo.toml

# Run address sanitizer on crossbeam-epoch
# Note: this will be significantly rewritten by https://github.com/crossbeam-rs/crossbeam/pull/591.
if [[ "$OSTYPE" == "linux"* ]]; then
cargo clean

# TODO: Once `cfg(sanitize = "..")` is stable, replace
# `cfg(crossbeam_sanitize)` with `cfg(sanitize = "..")` and remove
# `--cfg crossbeam_sanitize`.
ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0" \
RUSTFLAGS="-Z sanitizer=address --cfg crossbeam_sanitize" \
cargo run \
--release \
--target x86_64-unknown-linux-gnu \
--features nightly \
--example sanitize \
--manifest-path crossbeam-epoch/Cargo.toml
fi
fi
3 changes: 0 additions & 3 deletions crossbeam-epoch/Cargo.toml
Expand Up @@ -33,9 +33,6 @@ alloc = []
# of crossbeam may make breaking changes to them at any time.
nightly = ["crossbeam-utils/nightly", "const_fn"]

# TODO: docs
sanitize = [] # Makes it more likely to trigger any potential data races.

[dependencies]
cfg-if = "1"
const_fn = { version = "0.4.4", optional = true }
Expand Down
10 changes: 5 additions & 5 deletions crossbeam-epoch/src/internal.rs
Expand Up @@ -55,9 +55,9 @@ use crate::sync::list::{Entry, IsElement, IterError, List};
use crate::sync::queue::Queue;

/// Maximum number of objects a bag can contain.
#[cfg(not(feature = "sanitize"))]
#[cfg(not(crossbeam_sanitize))]
const MAX_OBJECTS: usize = 62;
#[cfg(feature = "sanitize")]
#[cfg(crossbeam_sanitize)]
const MAX_OBJECTS: usize = 4;

/// A bag of deferred functions.
Expand Down Expand Up @@ -109,7 +109,7 @@ impl Default for Bag {
#[rustfmt::skip]
fn default() -> Self {
// TODO: [no_op; MAX_OBJECTS] syntax blocked by https://github.com/rust-lang/rust/issues/49147
#[cfg(not(feature = "sanitize"))]
#[cfg(not(crossbeam_sanitize))]
return Bag {
len: 0,
deferreds: [
Expand Down Expand Up @@ -177,7 +177,7 @@ impl Default for Bag {
Deferred::new(no_op_func),
],
};
#[cfg(feature = "sanitize")]
#[cfg(crossbeam_sanitize)]
return Bag {
len: 0,
deferreds: [
Expand Down Expand Up @@ -278,7 +278,7 @@ impl Global {
pub(crate) fn collect(&self, guard: &Guard) {
let global_epoch = self.try_advance(guard);

let steps = if cfg!(feature = "sanitize") {
let steps = if cfg!(crossbeam_sanitize) {
usize::max_value()
} else {
Self::COLLECT_STEPS
Expand Down