Skip to content

Commit

Permalink
Merge pull request #10 from bearcove/compat
Browse files Browse the repository at this point in the history
Add opt-in compatibility tests
  • Loading branch information
fasterthanlime authored Jul 23, 2024
2 parents 9077c59 + b7ba170 commit 14a7591
Show file tree
Hide file tree
Showing 22 changed files with 1,303 additions and 45 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,11 @@ jobs:
toolchain: stable
profile: minimal
override: true
- name: Run cargo command
- name: Add nightly
run: rustup toolchain add nightly
- name: Run tests runner
run: |
cargo run --manifest-path test-crates/bin/Cargo.toml
cd tests/
cargo run
shell: bash
continue-on-error: ${{ matrix.os == 'windows-latest' }}
- name: Run cargo command (release)
run: |
cargo run --manifest-path test-crates/bin/Cargo.toml --release
continue-on-error: ${{ matrix.os == 'windows-latest' }}
- name: Run cargo command (release with SOPRINTLN=1)
if: matrix.os != 'windows-latest'
run: |
export SOPRINTLN=1
cargo run --manifest-path test-crates/bin/Cargo.toml --release
15 changes: 13 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,16 @@
check:
cargo hack --each-feature --exclude-all-features clippy --manifest-path rubicon/Cargo.toml

test:
SOPRINTLN=1 cargo run --manifest-path test-crates/bin/Cargo.toml
test *args:
#!/usr/bin/env bash -eux
BIN_CHANNEL="${BIN_CHANNEL:-stable}"
BIN_FLAGS="${BIN_FLAGS:-}"
SOPRINTLN=1 cargo "+${BIN_CHANNEL}" build --manifest-path test-crates/samplebin/Cargo.toml ${BIN_FLAGS}

export DYLD_LIBRARY_PATH=$(rustc "+stable" --print sysroot)/lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$(rustc "+nightly" --print sysroot)/lib
export LD_LIBRARY_PATH=$(rustc "+stable" --print sysroot)/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(rustc "+nightly" --print sysroot)/lib

./test-crates/samplebin/target/debug/samplebin {{args}}
69 changes: 69 additions & 0 deletions rubicon/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions rubicon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@ keywords = ["ffi", "thread-local"]
crate-type = ["dylib"]

[dependencies]
ctor = { version = "0.2.8", optional = true }
libc = { version = "0.2.155", optional = true }
paste = { version = "1.0.15", optional = true }

[build-dependencies]
rustc_version = { version = "0.4.0", optional = true }

[features]
default = []
export-globals = ["dep:paste"]
import-globals = ["dep:paste"]
export-globals = ["dep:paste", "dep:rustc_version"]
import-globals = ["dep:paste", "dep:rustc_version", "dep:ctor", "dep:libc"]
ctor = ["dep:ctor"]
14 changes: 14 additions & 0 deletions rubicon/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
fn main() {
#[cfg(any(feature = "export-globals", feature = "import-globals"))]
{
use std::env;

// Get the Rust compiler version and set it as an environment variable.
let rustc_version = rustc_version::version().unwrap();
println!("cargo:rustc-env=RUBICON_RUSTC_VERSION={}", rustc_version);

// Pass the target triple.
let target = env::var("TARGET").unwrap();
println!("cargo:rustc-env=RUBICON_TARGET_TRIPLE={}", target);
}
}
Loading

0 comments on commit 14a7591

Please sign in to comment.