diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..07af5629 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,35 @@ +name: Test +on: [push, pull_request] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04, macos-11.0] + rust-version: [stable, beta] + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.rust-version }} + override: true + - name: Build + uses: actions-rs/cargo@v1 + with: + command: rustc + args: --verbose -- -D warnings + - name: Test + uses: actions-rs/cargo@v1 + with: + command: test + args: --verbose --all + - name: Num tests + uses: actions-rs/cargo@v1 + continue-on-error: true + with: + command: test + args: --verbose --all --no-default-features --features num diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 001bb6b6..00000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: rust -cache: cargo -os: linux -dist: xenial - -before_script: - - cargo fetch - -jobs: - allow_failures: - env: - - CAN_FAIL=true - include: - - stage: "Stable: Build" - rust: stable - script: cargo rustc --verbose -- -D warnings - name: "Build Stable" - - stage: "Stable: Tests" - rust: stable - script: cargo test --verbose --all - name: "Tests Stable" - - stage: "Features" - rust: stable - script: cargo test --verbose --all --no-default-features --features num - name: "num Tests" - env: CAN_FAIL=true - - stage: "Beta: Build" - # - # - rust: beta - script: cargo rustc --verbose -- -D warnings - name: "Build Beta" diff --git a/src/machine/machine_state_impl.rs b/src/machine/machine_state_impl.rs index 0e4a4e1c..5de07140 100644 --- a/src/machine/machine_state_impl.rs +++ b/src/machine/machine_state_impl.rs @@ -3130,9 +3130,14 @@ impl MachineState { ) { let interrupted = INTERRUPT.load(std::sync::atomic::Ordering::Relaxed); - if INTERRUPT.compare_and_swap(interrupted, false, std::sync::atomic::Ordering::Relaxed) { - self.throw_interrupt_exception(); - return; + match INTERRUPT.compare_exchange(interrupted, false, std::sync::atomic::Ordering::Relaxed, std::sync::atomic::Ordering::Relaxed) { + Ok(interruption) => { + if interruption { + self.throw_interrupt_exception(); + return; + } + }, + Err(_) => unreachable!() } let mut default_call_policy: Box = Box::new(DefaultCallPolicy {});