summaryrefslogtreecommitdiff
path: root/cc/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cc/tests')
-rw-r--r--cc/tests/cc_env.rs5
-rw-r--r--cc/tests/cflags.rs5
-rw-r--r--cc/tests/cxxflags.rs5
-rw-r--r--cc/tests/support/mod.rs4
-rw-r--r--cc/tests/test.rs37
5 files changed, 37 insertions, 19 deletions
diff --git a/cc/tests/cc_env.rs b/cc/tests/cc_env.rs
index e862fea..43eb689 100644
--- a/cc/tests/cc_env.rs
+++ b/cc/tests/cc_env.rs
@@ -1,12 +1,9 @@
-extern crate cc;
-extern crate tempdir;
-
use std::env;
use std::ffi::OsString;
use std::path::Path;
mod support;
-use support::Test;
+use crate::support::Test;
#[test]
fn main() {
diff --git a/cc/tests/cflags.rs b/cc/tests/cflags.rs
index df6b0a7..caec6ea 100644
--- a/cc/tests/cflags.rs
+++ b/cc/tests/cflags.rs
@@ -1,10 +1,7 @@
-extern crate cc;
-extern crate tempdir;
-
mod support;
+use crate::support::Test;
use std::env;
-use support::Test;
/// This test is in its own module because it modifies the environment and would affect other tests
/// when run in parallel with them.
diff --git a/cc/tests/cxxflags.rs b/cc/tests/cxxflags.rs
index 26426af..c524c7d 100644
--- a/cc/tests/cxxflags.rs
+++ b/cc/tests/cxxflags.rs
@@ -1,10 +1,7 @@
-extern crate cc;
-extern crate tempdir;
-
mod support;
+use crate::support::Test;
use std::env;
-use support::Test;
/// This test is in its own module because it modifies the environment and would affect other tests
/// when run in parallel with them.
diff --git a/cc/tests/support/mod.rs b/cc/tests/support/mod.rs
index 7d74719..fe8acde 100644
--- a/cc/tests/support/mod.rs
+++ b/cc/tests/support/mod.rs
@@ -8,7 +8,7 @@ use std::io::prelude::*;
use std::path::{Path, PathBuf};
use cc;
-use tempdir::TempDir;
+use tempfile::{Builder, TempDir};
pub struct Test {
pub td: TempDir,
@@ -27,7 +27,7 @@ impl Test {
if gcc.ends_with("deps") {
gcc.pop();
}
- let td = TempDir::new_in(&gcc, "gcc-test").unwrap();
+ let td = Builder::new().prefix("gcc-test").tempdir_in(&gcc).unwrap();
gcc.push(format!("gcc-shim{}", env::consts::EXE_SUFFIX));
Test {
td: td,
diff --git a/cc/tests/test.rs b/cc/tests/test.rs
index 74eca1e..def11f0 100644
--- a/cc/tests/test.rs
+++ b/cc/tests/test.rs
@@ -1,7 +1,4 @@
-extern crate cc;
-extern crate tempdir;
-
-use support::Test;
+use crate::support::Test;
mod support;
@@ -42,10 +39,40 @@ fn gnu_opt_level_s() {
}
#[test]
-fn gnu_debug() {
+fn gnu_debug_fp_auto() {
let test = Test::gnu();
test.gcc().debug(true).file("foo.c").compile("foo");
test.cmd(0).must_have("-g");
+ test.cmd(0).must_have("-fno-omit-frame-pointer");
+}
+
+#[test]
+fn gnu_debug_fp() {
+ let test = Test::gnu();
+ test.gcc().debug(true).file("foo.c").compile("foo");
+ test.cmd(0).must_have("-g");
+ test.cmd(0).must_have("-fno-omit-frame-pointer");
+}
+
+#[test]
+fn gnu_debug_nofp() {
+ let test = Test::gnu();
+ test.gcc()
+ .debug(true)
+ .force_frame_pointer(false)
+ .file("foo.c")
+ .compile("foo");
+ test.cmd(0).must_have("-g");
+ test.cmd(0).must_not_have("-fno-omit-frame-pointer");
+
+ let test = Test::gnu();
+ test.gcc()
+ .force_frame_pointer(false)
+ .debug(true)
+ .file("foo.c")
+ .compile("foo");
+ test.cmd(0).must_have("-g");
+ test.cmd(0).must_not_have("-fno-omit-frame-pointer");
}
#[test]