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

move datatest-stable into this repository #35

Merged
merged 35 commits into from
Apr 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e1d4651
[datatest-stable] introduce data-driven testing framework
bmwill Sep 19, 2019
14c1ffa
Add generic descriptions, repositories, and homepages to Cargo.toml's
Oct 3, 2019
9262a91
remove underscrores & dashes from descriptions
huitseeker Oct 8, 2019
dab1040
[lint] ensure all *.{rs,sh} files have a license header
bmwill Nov 4, 2019
ebd4c38
[language][Move] Added test framework
Oct 22, 2019
2af682a
Forbid unsafe code throughout the codebase, with a few exceptions
metajack Nov 25, 2019
961ad68
Bump regex from 1.3.4 to 1.3.5
dependabot-preview[bot] Mar 15, 2020
e22c350
Bump structopt from 0.3.11 to 0.3.12
dependabot-preview[bot] Mar 19, 2020
ec69f3d
Bump regex from 1.3.5 to 1.3.6
dependabot-preview[bot] Mar 25, 2020
1dd5a13
datatest: enable listing of tests
bmwill Apr 7, 2020
6549dd7
[test] unblock the use of --ignored in libra-fuzzer
rexhoffman Apr 8, 2020
333f139
[test] explicitly and only state that these are no-op args/flags.
rexhoffman Apr 8, 2020
5dddf99
Bump structopt from 0.3.12 to 0.3.13
dependabot-preview[bot] Apr 10, 2020
17fc201
Add workspace-hack crate to unify third party dependency features
metajack Mar 17, 2020
70f472e
Bump regex from 1.3.6 to 1.3.7
dependabot-preview[bot] Apr 20, 2020
b81de61
Bump structopt from 0.3.13 to 0.3.14
dependabot-preview[bot] Apr 24, 2020
75ddc9d
Bump regex from 1.3.7 to 1.3.9
dependabot-preview[bot] May 29, 2020
ea0ac8b
[deps] use cargo-edit's cargo upgrade command to cleanup project tomls
rexhoffman Jun 3, 2020
b7fc402
Bump structopt from 0.3.14 to 0.3.15
dependabot-preview[bot] Jun 17, 2020
b4a1e85
fixup! [Deps] Downgrade bindgen to unyanked 0.54.0, upgrade others. c…
bors-libra Aug 28, 2020
5a45dd0
Bump structopt from 0.3.17 to 0.3.18
dependabot[bot] Sep 24, 2020
8dc0904
[integer-overflow] enforce some checked operations
mimoo Oct 2, 2020
fe84044
cargo upgrade --workspace aho-corasick anyhow backtrace bitvec cc cro…
rexhoffman Oct 28, 2020
b36eed6
cargo upgrade --workspace aes-gcm ureq thiserror structopt sha2 sha-1…
rexhoffman Nov 10, 2020
d868d98
Bump termcolor from 1.1.0 to 1.1.2
dependabot[bot] Nov 20, 2020
f1da5b1
Bump structopt from 0.3.20 to 0.3.21
dependabot[bot] Dec 1, 2020
a1f3d20
[Rename] Rename all occurences of "Libra" to "Diem"
Dec 3, 2020
8941d00
github url update, ignoring developers.libra.org
rexhoffman Dec 9, 2020
26bea2f
Bump regex from 1.4.2 to 1.4.3
dependabot[bot] Jan 15, 2021
168d7d4
x: add unpublished-packages-only-use-path-dependencies lint
bmwill Feb 24, 2021
4dae209
[datatest-stable] support --format terse
sunshowers Mar 16, 2021
a309921
[datatest-stable] handle the --ignored flag
sunshowers Mar 25, 2021
24a4a35
[datatest-stable] prepare for merge into diem-devtools
sunshowers Mar 26, 2021
5c53bbd
[datatest-stable] merge into diem-devtools
sunshowers Mar 26, 2021
436a411
[datatest-stable] add to workspace
sunshowers Mar 26, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
resolver = "2"
members = [
"datatest-stable",
"quick-junit",
"testrunner",
]
19 changes: 19 additions & 0 deletions datatest-stable/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "datatest-stable"
version = "0.1.0"
authors = ["Diem Association <[email protected]>"]
description = "Data-driven tests that work on stable Rust"
repository = "https://github.com/diem/diem-devtools"
license = "MIT OR Apache-2.0"
publish = false
edition = "2018"

[dependencies]
regex = "1.4.3"
walkdir = "2.3.1"
structopt = "0.3.21"
termcolor = "1.1.2"

[[test]]
name = "example"
harness = false
35 changes: 35 additions & 0 deletions datatest-stable/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: MIT OR Apache-2.0

#![forbid(unsafe_code)]

//! `datatest-stable` is a very simple test harness intended to meet some of the needs provided by
//! the `datatest` crate when using a stable rust compiler without using the `RUSTC_BOOTSTRAP` hack
//! to use nightly features on the stable track.
//!
//! In order to setup data-driven tests for a particular test target you must do the following:
//! 1. Configure the test target by setting the following in the `Cargo.toml`
//! ```lang=toml
//! [[test]]
//! name = "<test target name>"
//! harness = false
//! ```
//!
//! 2. Call the `datatest_stable::harness!(testfn, root, pattern)` macro with the following
//! parameters:
//! * `testfn` - The test function to be executed on each matching input. This function must have
//! the type `fn(&Path) -> datatest_stable::Result<()>`
//! * `root` - The path to the root directory where the input files live. This path is relative to
//! the root of the crate.
//! * `pattern` - the regex used to match against and select each file to be tested.
//!
//! The three parameters can be repeated if you have multiple sets of data-driven tests to be run:
//! `datatest_stable::harness!(testfn1, root1, pattern1, testfn2, root2, pattern2)`

mod macros;
mod runner;
pub mod utils;

pub type Result<T> = ::std::result::Result<T, Box<dyn ::std::error::Error>>;

pub use self::runner::{runner, Requirements};
28 changes: 28 additions & 0 deletions datatest-stable/src/macros.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: MIT OR Apache-2.0

/// `datatest-stable` test harness entry point. Should be declared in the test module.
///
/// Also, `harness` should be set to `false` for that test module in `Cargo.toml` (see [Configuring
/// a target](https://doc.rust-lang.org/cargo/reference/manifest.html#configuring-a-target)).
#[macro_export]
macro_rules! harness {
( $( $name:path, $root:expr, $pattern:expr ),+ $(,)* ) => {
fn main() {
let mut requirements = Vec::new();

$(
requirements.push(
$crate::Requirements::new(
$name,
stringify!($name).to_string(),
$root.to_string(),
$pattern.to_string()
)
);
)+

$crate::runner(&requirements);
}
};
}
Loading