]> git.lizzy.rs Git - rust.git/commitdiff
Add cargo-miri test for no isolation
authorChristian Poveda <christianpoveda@protonmail.com>
Thu, 29 Aug 2019 09:09:34 +0000 (04:09 -0500)
committerChristian Poveda <christianpoveda@protonmail.com>
Thu, 29 Aug 2019 15:13:02 +0000 (10:13 -0500)
README.md
src/shims/env.rs
test-cargo-miri/run-test.py
test-cargo-miri/test.stdout.ref3 [new file with mode: 0644]

index f5b8999d1c5906071d23b0bd26ca10d33cafcfc1..7ae3c84517f95116baa3c9633ef1b718a0b75a10 100644 (file)
--- a/README.md
+++ b/README.md
@@ -161,7 +161,8 @@ Several `-Z` flags are relevant for Miri:
   the program has access to host resources such as environment variables and
   randomness (and, eventually, file systems and more).
 * `-Zmiri-env-exclude=<var>` keeps the `var` environment variable isolated from 
-  the host. Can be used multiple times to exclude several variables.
+  the host. Can be used multiple times to exclude several variables. The `TERM`
+  environment variable is excluded by default.
 * `-Zmir-opt-level` controls how many MIR optimizations are performed.  Miri
   overrides the default to be `0`; be advised that using any higher level can
   make Miri miss bugs in your program because they got optimized away.
index d0b5abbaf181920ea2b15f4f94d38e9df264033c..4b126fbfdaed1d4472c133a7642e6d6c00ad4e0b 100644 (file)
@@ -17,8 +17,9 @@ pub(crate) fn init<'mir, 'tcx>(
         ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'tcx>>,
         mut excluded_env_vars: Vec<String>,
     ) {
-        // Exclude TERM var to avoid calls to the file system
+        // Exclude `TERM` var to avoid terminfo trying to open the termcap file.
         excluded_env_vars.push("TERM".to_owned());
+
         if ecx.machine.communicate {
             for (name, value) in std::env::vars() {
                 if !excluded_env_vars.contains(&name) {
index 73515c74e401030dd14a4169a984662121622ce2..499c2e896f172ca3019b27fed2d0d303ed24be32 100755 (executable)
@@ -60,6 +60,10 @@ def test_cargo_miri_test():
         cargo_miri("test") + ["--", "--", "le1"],
         "test.stdout.ref2", "test.stderr.ref"
     )
+    test("cargo miri test (without isolation)",
+        cargo_miri("test") + ["--", "-Zmiri-disable-isolation", "--", "num_cpus"],
+        "test.stdout.ref3", "test.stderr.ref"
+    )
 
 os.chdir(os.path.dirname(os.path.realpath(__file__)))
 
diff --git a/test-cargo-miri/test.stdout.ref3 b/test-cargo-miri/test.stdout.ref3
new file mode 100644 (file)
index 0000000..f0d8afb
--- /dev/null
@@ -0,0 +1,11 @@
+
+running 0 tests
+
+test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out
+
+
+running 1 test
+test num_cpus ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 3 filtered out
+