mirror of
https://github.com/openharmony/third_party_rust_bitflags.git
synced 2026-07-20 23:46:15 -04:00
Merge pull request #127 from tamird/master
Move tests to test suite crate
This commit is contained in:
+2
-2
@@ -1,2 +1,2 @@
|
||||
/target
|
||||
/Cargo.lock
|
||||
target
|
||||
Cargo.lock
|
||||
|
||||
+3
-11
@@ -2,6 +2,7 @@ os:
|
||||
- linux
|
||||
- osx
|
||||
language: rust
|
||||
cache: cargo
|
||||
rust:
|
||||
# This version is tested to avoid unintentional bumping of the minimum supported Rust version
|
||||
- 1.20.0
|
||||
@@ -9,23 +10,14 @@ rust:
|
||||
- beta
|
||||
- nightly
|
||||
sudo: false
|
||||
before_script:
|
||||
- pip install -v 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
|
||||
- if [[ -e ~/Library/Python/2.7/bin ]]; then export PATH=~/Library/Python/2.7/bin:$PATH; fi
|
||||
script:
|
||||
- travis-cargo build
|
||||
- travis-cargo test
|
||||
- travis-cargo --only nightly test -- --all
|
||||
- travis-cargo --only stable doc
|
||||
after_success:
|
||||
- travis-cargo --only nightly doc-upload
|
||||
- cargo test
|
||||
- if [ "$TRAVIS_RUST_VERSION" = nightly ]; then (cd ./test_suite && cargo test --features unstable); fi
|
||||
env:
|
||||
global:
|
||||
- TRAVIS_CARGO_NIGHTLY_FEATURE=unstable_testing
|
||||
- secure: "DoZ8g8iPs+X3xEEucke0Ae02JbkQ1qd1SSv/L2aQqxULmREtRcbzRauhiT+ToQO5Ft1Lul8uck14nPfs4gMr/O3jFFBhEBVpSlbkJx7eNL3kwUdp95UNroA8I43xPN/nccJaHDN6TMTD3+uajTQTje2SyzOQP+1gvdKg17kguvE="
|
||||
|
||||
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
|
||||
-10
@@ -22,14 +22,4 @@ travis-ci = { repository = "rust-lang-nursery/bitflags" }
|
||||
|
||||
[features]
|
||||
default = ["example_generated"]
|
||||
unstable_testing = []
|
||||
example_generated = []
|
||||
|
||||
[dev-dependencies]
|
||||
# Trick Cargo into testing this crate when we run `cargo test --all`.
|
||||
bitflags-compiletest = { path = "compiletest" }
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
|
||||
[workspace]
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
[project]
|
||||
name = "bitflags-compiletest"
|
||||
version = "0.0.0"
|
||||
|
||||
[dev-dependencies]
|
||||
bitflags = { path = "../" }
|
||||
compiletest_rs = { version = "0.2" }
|
||||
@@ -1,30 +0,0 @@
|
||||
extern crate compiletest_rs as compiletest;
|
||||
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
use compiletest::common::Mode;
|
||||
|
||||
fn run_mode(mode: Mode) {
|
||||
let config = compiletest::Config {
|
||||
mode: mode,
|
||||
src_base: PathBuf::from(format!("tests/{}", mode)),
|
||||
target_rustcflags: fs::read_dir("../target/debug/deps").unwrap().filter_map(|entry| {
|
||||
let path = entry.unwrap().path();
|
||||
path.file_name().map(|file_name| file_name.to_string_lossy()).and_then(|file_name| {
|
||||
if file_name.starts_with("libbitflags-") && file_name.ends_with(".rlib") {
|
||||
Some(format!("--extern bitflags={}", path.to_string_lossy()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
}).next(),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
compiletest::run_tests(&config);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn compile_test() {
|
||||
run_mode(Mode::CompileFail);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
[project]
|
||||
name = "test_suite"
|
||||
version = "0.0.0"
|
||||
|
||||
[features]
|
||||
unstable = ["compiletest_rs"]
|
||||
|
||||
[dependencies]
|
||||
bitflags = { path = "../" }
|
||||
compiletest_rs = { version = "*", optional = true }
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
@@ -0,0 +1,32 @@
|
||||
#![cfg(feature = "unstable")]
|
||||
|
||||
extern crate compiletest_rs as compiletest;
|
||||
|
||||
use std::result::Result;
|
||||
use std::fs;
|
||||
|
||||
use compiletest::common::Mode;
|
||||
|
||||
fn run_mode(mode: Mode) {
|
||||
let config = compiletest::Config {
|
||||
mode: mode,
|
||||
src_base: format!("tests/{}", mode).into(),
|
||||
target_rustcflags: fs::read_dir("target/debug/deps").unwrap().map(Result::unwrap).filter(|entry| {
|
||||
let file_name = entry.file_name();
|
||||
let file_name = file_name.to_string_lossy();
|
||||
file_name.starts_with("libbitflags-") && file_name.ends_with(".rlib")
|
||||
}).max_by_key(|entry| {
|
||||
entry.metadata().unwrap().modified().unwrap()
|
||||
}).map(|entry| {
|
||||
format!("--extern bitflags={}", entry.path().to_string_lossy())
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
compiletest::run_tests(&config);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn compile_test() {
|
||||
run_mode(Mode::CompileFail);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#![cfg(feature = "unstable_testing")]
|
||||
#![cfg(feature = "unstable")]
|
||||
|
||||
#![feature(i128_type)]
|
||||
|
||||
Reference in New Issue
Block a user