Code Monkey home page Code Monkey logo

libtest's Introduction

Note: This repository is no longer in use. The test crate lives in the rust-lang/rust repository.


Build Status Build Status Latest Version docs

libtest - Rust's built-in unit-testing and benchmarking framework

See The Rust Programming Language chapter on Testing.

Platform support

  • "build" shows whether the library compiles
  • "run" shows whether the full test-suite passes
Target Build Run
aarch64-linux-android
aarch64-unknown-linux-gnu
arm-linux-androideabi
arm-unknown-linux-gnueabi
arm-unknown-linux-musleabi
armv7-linux-androideabi
armv7-unknown-linux-gnueabihf
armv7-unknown-linux-musleabihf
i586-unknown-linux-gnu
i586-unknown-linux-musl
i686-linux-android
i686-pc-windows-gnu
i686-apple-darwin
i686-unknown-freebsd
i686-unknown-linux-gnu
i686-unknown-linux-musl
mips-unknown-linux-gnu
mips64-unknown-linux-gnuabi64
mips64el-unknown-linux-gnuabi64
mipsel-unknown-linux-gnu
powerpc-unknown-linux-gnu
powerpc64-unknown-linux-gnu
powerpc64le-unknown-linux-gnu
sparc64-unknown-linux-gnu
s390x-unknown-linux-gnu
x86_64-apple-darwin
x86_64-sun-solaris
x86_64-linux-android
x86_64-pc-windows-gnu
x86_64-pc-windows-msvc
x86_64-unknown-freebsd
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl
x86_64-unknown-netbsd

License

This project is licensed under either of

at your option.

Contributing

We welcome all people who want to contribute.

Contributions in any form (issues, pull requests, etc.) to this project must adhere to Rust's Code of Conduct.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in libtest by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

libtest's People

Contributors

ahmedcharles avatar alexcrichton avatar aochagavia avatar aturon avatar bors avatar brendanzab avatar brson avatar eddyb avatar emberian avatar flaper87 avatar frewsxcv avatar gnzlbg avatar guillaumegomez avatar huonw avatar kmcallister avatar ljedrz avatar manishearth avatar mark-simulacrum avatar nikomatsakis avatar nrc avatar oli-obk avatar pcwalton avatar petrochenkov avatar ralfjung avatar richo avatar sfackler avatar simonsapin avatar steveklabnik avatar tamird avatar thestinger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libtest's Issues

Consider rename to 'test'?

None of the most important crates outside rustc has a "lib" prefix. If this is supposed to be used by most users, maybe it's a good idea to just call it "test".

Roadmap for json format on Stable

I think I've got the right repo but please let me know if I need to move this elsewhere 😄

I was just wondering if you have a ballpark timeline/roadmap for when --format json might be available on Stable?

I'm currently interfacing with the test results output (from an IDE extension) and parsing the pretty format, but having json available on stable would make things a lot easier!

Thanks in advance

Fork process for each test case

My test cases sometimes leave zombie threads hanging around, which sometimes causes issues in unrelated test cases. I'd like to be able to run one test case per process for better isolation, until I can make sure all threads are reaped properly. For the moment I am using the following:

  while IFS= read -r exe; do
    echo "found test exe $exe"
    while IFS= read -r test; do
      echo "found test name $test"
      "$exe" --exact "$test"
    done < <("$exe" --list | grep '.*: test$' | sed 's/: test$//g')
  done < <(cat cargo-output.json | jq -cMr 'select(.reason == "compiler-artifact" and .target.kind == [ "test" ]) | .executable')

where cargo-output.json is cargo's message-format output. This is far from ideal, and I'd love support for this in libtest.

Do you reckon there are technical reasons why it can't be made?

Support json format for --list

I'd like to be able to get a json-formatted list of the tests and benches. This isn't a huge deal, because the output is pretty simple to parse with regex.

Expected:

> test_binary -Z unstable-options --list --format json
[{name: "foo", type: "test"}]

Actual:

> test_binary -Z unstable-options --list --format json
foo: test

1 test, 0 benchmarks

Cargo test with the option 'include-ignored' yields error

I'm using a nightly compiler (by running rustup install nightly && rustup default nightly) and ran the following testing command,

cargo test -- --include-ignored

This command yields the error

error: The "include-ignored" flag is only accepted on the nightly compiler

I have also tried adding the +nightly option, that didn't work either.

The version of the compiler I'm using is

nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.39.0-nightly (6ef275e6c 2019-09-24)

Initial roadmap

We should come up with a couple of goals for the roadmap of what to do next. The first goal is probably making the crate usable. For that we need to:

  • get it running on stable Rust, and
  • get rust-lang/rust to use it as is.

To get it running on stable Rust we can just try to stop using unstable Rust features. To get rust-lang/rust to use it, the main blocker was the relationship between #[ignore] and #[test] which was discussed in the internal thread (https://internals.rust-lang.org/t/a-path-forward-towards-re-usable-libtest-functionality-custom-test-frameworks-and-a-stable-bench-macro/9139).

@alexcrichton proposed the following:

I’m not sure I completely follow the trickiness with #[test] and #[ignore] orderings, but it seems to me like we could make both of them procedural macros in the prelude by default perhaps? If both #[test] and #[ignore] were routed to the same procedural macro, it wouldn’t matter which runs first and #[ignore] would just otherwise verify that #[test] exists (removing it).

In the meantime there are also a couple of things that we might want to do, but that's probably better to discuss them in their own issues:

  • refactor argument parsing, formatting, json, etc. to make them reusable for other custom test frameworks
  • refactor testing and benchmarking into different crates, so that one doesn't need to pull in the whole testing infrastructure for benchmarks and vice-versa
  • use the real term crate instead of our own fork
  • make sure that libtest is usable as a custom_test_framework (and potentially "libbench" as well if we have splitted them in two)

cc @djrenren

Set up Travis-CI

We need to set up CI for the tier-1 and tier-2 targets. We probably want to do something similar to what libc, stdsimd, etc do.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.