mesalock-linux / mesabox

A collection of core system utilities written in Rust for Unix-like systems (and now Windows)
BSD 3-Clause "New" or "Revised" License
137 stars 19 forks source link

Refactor current tests and start to use `assert_cmd` #24

Closed mssun closed 6 years ago

mssun commented 6 years ago

This PR will refactor current test cases and change to assert_cmd, predicates, assert_fs, etc.

codecov[bot] commented 6 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@d47ad31). Click here to learn what that means. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #24   +/-   ##
=========================================
  Coverage          ?   13.56%           
=========================================
  Files             ?       46           
  Lines             ?     4349           
  Branches          ?     1705           
=========================================
  Hits              ?      590           
  Misses            ?     3167           
  Partials          ?      592

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d47ad31...0c9293a. Read the comment docs.

mssun commented 6 years ago
epage commented 6 years ago

Blocking on a feature of assert_cmd (assert-rs/assert_cmd#24) to rewrite test cases of head.

Do you need to wait for that feature? The alternative is just to read the file and pass it in. The main benefits of that assert_cmd feature are (1) large file support and (2) convenience.

mssun commented 6 years ago

Do you need to wait for that feature? The alternative is just to read the file and pass it in. The main benefits of that assert_cmd feature are (1) large file support and (2) convenience.

Yes, reading file and pass it in is a solution. I think with the feature provided by assert_cmd, the testcases will looks more clean. (Current test framework supports pipe in a file). After that, I can safely say that assert_cmd have similar functions of current framework and fully rely on assert_cmd in the future.

Anyway, I will work on refactoring other test cases and come back to this when it is ready. @epage Do you think it will take much more time to have this feature done?

epage commented 6 years ago

Anyway, I will work on refactoring other test cases and come back to this when it is ready. @epage Do you think it will take much more time to have this feature done?

I probably won't get to it until tomorrow night. If that is too long, feel free to prepare a PR.

mssun commented 6 years ago

I think I'm done with the refactoring. @Arcterus

Arcterus commented 6 years ago

The tests seem to run noticeably slower now, although this might just be due to fork+exec being slower than spawning a thread. On the other hand, it should be more resilient in the case of programs setting global state (e.g. we might be able to test the cd built-in for posix/sh now).

mssun commented 6 years ago

I don't why the first two cases are blocked.

test gnu::arch::test_x86_64 ... test gnu::arch::test_x86_64 has been running for over 60 seconds
test gnu::base32::test_decode ... test gnu::base32::test_decode has been running for over 60 seconds

Also, not sure if it is related with this issue: https://github.com/assert-rs/assert_cmd/issues/6

Arcterus commented 6 years ago

Ah that may be related to some extent. Those test cases work fine for me locally so I’m not sure what’s up with Travis.