aboutsummaryrefslogtreecommitdiff
path: root/pkg-config/tests
diff options
context:
space:
mode:
Diffstat (limited to 'pkg-config/tests')
-rw-r--r--pkg-config/tests/escape.pc5
-rw-r--r--pkg-config/tests/foo.pc16
-rw-r--r--pkg-config/tests/framework.pc16
-rw-r--r--pkg-config/tests/test.rs118
4 files changed, 0 insertions, 155 deletions
diff --git a/pkg-config/tests/escape.pc b/pkg-config/tests/escape.pc
deleted file mode 100644
index 701c4bf..0000000
--- a/pkg-config/tests/escape.pc
+++ /dev/null
@@ -1,5 +0,0 @@
-Name: Escape
-Version: 4.2.0
-Description: Escape utility library
-Libs: -Llink\ path\ with\ spaces
-Cflags: -Iinclude\ path\ with\ spaces -DA=\"escaped\ string\'\ literal\" -DB=ESCAPED\ IDENTIFIER -DFOX=🦊
diff --git a/pkg-config/tests/foo.pc b/pkg-config/tests/foo.pc
deleted file mode 100644
index b1ae3d8..0000000
--- a/pkg-config/tests/foo.pc
+++ /dev/null
@@ -1,16 +0,0 @@
-prefix=/usr
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include/valgrind
-arch=amd64
-os=linux
-platform=amd64-linux
-valt_load_address=0x38000000
-
-Name: Valgrind
-Description: A dynamic binary instrumentation framework
-Version: 3.10.0.SVN
-Requires:
-Libs: -L${libdir}/valgrind -lcoregrind-amd64-linux -lvex-amd64-linux -lgcc
-Cflags: -I${includedir}
-
diff --git a/pkg-config/tests/framework.pc b/pkg-config/tests/framework.pc
deleted file mode 100644
index fec17f4..0000000
--- a/pkg-config/tests/framework.pc
+++ /dev/null
@@ -1,16 +0,0 @@
-prefix=/usr
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include/valgrind
-arch=amd64
-os=linux
-platform=amd64-linux
-valt_load_address=0x38000000
-
-Name: Valgrind
-Description: A dynamic binary instrumentation framework
-Version: 3.10.0.SVN
-Requires:
-Libs: -F${libdir} -framework foo -Wl,-framework,bar -Wl,-framework -Wl,baz -Wl,-framework,foobar,-framework,foobaz
-Cflags: -I${includedir}
-
diff --git a/pkg-config/tests/test.rs b/pkg-config/tests/test.rs
deleted file mode 100644
index fad0fcf..0000000
--- a/pkg-config/tests/test.rs
+++ /dev/null
@@ -1,118 +0,0 @@
-extern crate pkg_config;
-#[macro_use]
-extern crate lazy_static;
-
-use pkg_config::Error;
-use std::env;
-use std::sync::Mutex;
-use std::path::PathBuf;
-
-lazy_static! {
- static ref LOCK: Mutex<()> = Mutex::new(());
-}
-
-fn reset() {
- for (k, _) in env::vars() {
- if k.contains("DYNAMIC") ||
- k.contains("STATIC") ||
- k.contains("PKG_CONFIG_ALLOW_CROSS") ||
- k.contains("FOO_NO_PKG_CONFIG") {
- env::remove_var(&k);
- }
- }
- env::remove_var("TARGET");
- env::remove_var("HOST");
- env::set_var("PKG_CONFIG_PATH", &env::current_dir().unwrap().join("tests"));
-}
-
-fn find(name: &str) -> Result<pkg_config::Library, Error> {
- pkg_config::probe_library(name)
-}
-
-#[test]
-fn cross_disabled() {
- let _g = LOCK.lock();
- reset();
- env::set_var("TARGET", "foo");
- env::set_var("HOST", "bar");
- match find("foo") {
- Err(Error::CrossCompilation) => {},
- x => panic!("Error::CrossCompilation expected, found `{:?}`", x),
- }
-}
-
-#[test]
-fn cross_enabled() {
- let _g = LOCK.lock();
- reset();
- env::set_var("TARGET", "foo");
- env::set_var("HOST", "bar");
- env::set_var("PKG_CONFIG_ALLOW_CROSS", "1");
- find("foo").unwrap();
-}
-
-#[test]
-fn package_disabled() {
- let _g = LOCK.lock();
- reset();
- env::set_var("FOO_NO_PKG_CONFIG", "1");
- match find("foo") {
- Err(Error::EnvNoPkgConfig(name)) => {
- assert_eq!(name, "FOO_NO_PKG_CONFIG")
- }
- x => panic!("Error::EnvNoPkgConfig expected, found `{:?}`", x),
- }
-}
-
-#[test]
-fn output_ok() {
- let _g = LOCK.lock();
- reset();
- let lib = find("foo").unwrap();
- assert!(lib.libs.contains(&"gcc".to_string()));
- assert!(lib.libs.contains(&"coregrind-amd64-linux".to_string()));
- assert!(lib.link_paths.contains(&PathBuf::from("/usr/lib/valgrind")));
-}
-
-#[test]
-fn escapes() {
- let _g = LOCK.lock();
- reset();
- let lib = find("escape").unwrap();
- assert!(lib.include_paths.contains(&PathBuf::from("include path with spaces")));
- assert!(lib.link_paths.contains(&PathBuf::from("link path with spaces")));
- assert_eq!(lib.defines.get("A"),
- Some(&Some("\"escaped string' literal\"".to_owned())));
- assert_eq!(lib.defines.get("B"),
- Some(&Some("ESCAPED IDENTIFIER".to_owned())));
- assert_eq!(lib.defines.get("FOX"),
- Some(&Some("🦊".to_owned())));
-}
-
-#[test]
-fn framework() {
- let _g = LOCK.lock();
- reset();
- let lib = find("framework").unwrap();
- assert!(lib.frameworks.contains(&"foo".to_string()));
- assert!(lib.frameworks.contains(&"bar".to_string()));
- assert!(lib.frameworks.contains(&"baz".to_string()));
- assert!(lib.frameworks.contains(&"foobar".to_string()));
- assert!(lib.frameworks.contains(&"foobaz".to_string()));
- assert!(lib.framework_paths.contains(&PathBuf::from("/usr/lib")));
-}
-
-#[test]
-fn get_variable() {
- let _g = LOCK.lock();
- reset();
- let prefix = pkg_config::get_variable("foo", "prefix").unwrap();
- assert_eq!(prefix, "/usr");
-}
-
-#[test]
-fn version() {
- let _g = LOCK.lock();
- reset();
- assert_eq!(&find("foo").unwrap().version[..], "3.10.0.SVN");
-}