Git Product home page Git Product logo

Comments (7)

Arcterus avatar Arcterus commented on May 25, 2024

Does it spawn actual processes? Ours just creates new threads and executes the commands in-process so that code coverage works.

from mesabox.

mssun avatar mssun commented on May 25, 2024

Oh,that issue is caused by ptrace-based coverage report tool. Because we are using gcov (compiler instrumentation-based method), I think we can safely spawn processes and get accurate code coverage report. Anyway, let me verify my thought first.

from mesabox.

mssun avatar mssun commented on May 25, 2024

It works as expected.

diff --git a/tests/gnu/test_arch.rs b/tests/gnu/test_arch.rs
index e6a4401..7f5863e 100644
--- a/tests/gnu/test_arch.rs
+++ b/tests/gnu/test_arch.rs
@@ -7,13 +7,18 @@
 //

 use util::*;
+extern crate assert_cmd;
+use std::process::Command;
+use self::assert_cmd::prelude::*;

 #[test]
 #[cfg(target_arch = "x86_64")]
 fn test_x86_64() {
-    new_ucmd!()
-        .succeeds()
-        .stdout_only("x86_64\n");
+    Command::main_binary()
+        .unwrap()
+        .args(&["arch"])
+        .assert()
+        .stdout("x86_64\n");
 }

 #[test]

image

from mesabox.

mssun avatar mssun commented on May 25, 2024

For the issue I mentioned here: https://github.com/rust-lang-nursery/cli-wg/issues/9#issuecomment-385530575

It can be solve with a rustc wrapper: https://github.com/mesalock-linux/mesabox/blob/master/ci/cov-rustc

In this way, we can add coverage-related flags to both mesabox and tests crate names.

from mesabox.

Arcterus avatar Arcterus commented on May 25, 2024

I'm not opposed to this change then (assuming assert_cmd has everything we need, which I haven't verified).

from mesabox.

mssun avatar mssun commented on May 25, 2024

Sorry, should be assert_cli. I changed the title accordingly.

Edit: assert_cli is deprecated. We use assert_cmd instead.

I'm working on this in this PR: #24

from mesabox.

mssun avatar mssun commented on May 25, 2024

Merged.

from mesabox.

Related Issues (20)

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.