diff options
author | Alex Crichton <alex@alexcrichton.com> | 2015-10-07 10:21:47 -0700 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2015-10-07 10:21:47 -0700 |
commit | 251ec8bdd0f8010ffb1f82853652d6566e1e6a13 (patch) | |
tree | da235d261e73fe3c42698bfe4a38e50db148227e /systest | |
parent | d5b69eb0db8f1054246c273a3d49c6209dc90366 (diff) | |
download | ssh2-rs-251ec8bdd0f8010ffb1f82853652d6566e1e6a13.zip |
Add automated testing of FFI bindings
Diffstat (limited to 'systest')
-rw-r--r-- | systest/Cargo.toml | 12 | ||||
-rw-r--r-- | systest/build.rs | 24 | ||||
-rw-r--r-- | systest/src/main.rs | 9 |
3 files changed, 45 insertions, 0 deletions
diff --git a/systest/Cargo.toml b/systest/Cargo.toml new file mode 100644 index 0000000..af981da --- /dev/null +++ b/systest/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "systest" +version = "0.1.0" +authors = ["Alex Crichton <alex@alexcrichton.com>"] +build = "build.rs" + +[dependencies] +libssh2-sys = { path = "../libssh2-sys" } +libc = "0.1" + +[build-dependencies] +ctest = { git = "https://github.com/alexcrichton/ctest" } diff --git a/systest/build.rs b/systest/build.rs new file mode 100644 index 0000000..4a2d2b4 --- /dev/null +++ b/systest/build.rs @@ -0,0 +1,24 @@ +extern crate ctest; + +use std::env; + +fn main() { + let mut cfg = ctest::TestGenerator::new(); + cfg.header("libssh2.h") + .header("libssh2_publickey.h") + .header("libssh2_sftp.h") + .include(env::var("DEP_SSH2_INCLUDE").unwrap()) + .type_name(|s, is_struct| { + if (is_struct || s == "stat") && !s.starts_with("LIB") { + format!("struct {}", s) + } else { + s.to_string() + } + }) + .skip_type(|t| t.ends_with("FUNC")) + .skip_fn(|f| { + f == "libssh2_userauth_password_ex" || + f == "libssh2_session_init_ex" + }); + cfg.generate("../libssh2-sys/lib.rs", "all.rs"); +} diff --git a/systest/src/main.rs b/systest/src/main.rs new file mode 100644 index 0000000..7fe430a --- /dev/null +++ b/systest/src/main.rs @@ -0,0 +1,9 @@ +#![allow(bad_style, improper_ctypes)] + +extern crate libssh2_sys; +extern crate libc; + +use libc::*; +use libssh2_sys::*; + +include!(concat!(env!("OUT_DIR"), "/all.rs")); |