diff --git a/netmap_test/Cargo.toml b/netmap_test/Cargo.toml new file mode 100644 index 0000000..27804e3 --- /dev/null +++ b/netmap_test/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "netmap_test" +version = "0.1.0" +authors = ["Alexander Polyakov "] +build = "build.rs" + +[dependencies.netmap_sys] +path = "../../netmap_sys" +features = [ "netmap_with_libs" ] + +[dependencies] +libc = "0.2" + +[build-dependencies] +ctest = { git = "https://github.com/libpnet/ctest", branch = "nowerror" } diff --git a/netmap_test/build.rs b/netmap_test/build.rs new file mode 100644 index 0000000..2db4892 --- /dev/null +++ b/netmap_test/build.rs @@ -0,0 +1,24 @@ +extern crate ctest; + +fn main() { + let mut cfg = ctest::TestGenerator::new(); + + cfg.header("sys/time.h") + .header("sys/ioctl.h") + .header("net/if.h") + .header("net/netmap.h") + .header("net/netmap_user.h"); + + cfg.type_name(|ty, is_struct| { + if is_struct || ty == "timeval" { + format!("struct {}", ty) + } else { + ty.to_string() + } + }); + + cfg.include("netmap/sys"); + cfg.include("/usr/include"); + + cfg.generate("../src/lib.rs", "all.rs"); +} diff --git a/netmap_test/src/main.rs b/netmap_test/src/main.rs new file mode 100644 index 0000000..066a775 --- /dev/null +++ b/netmap_test/src/main.rs @@ -0,0 +1,11 @@ +#![allow(bad_style)] + +extern crate netmap_sys; +extern crate libc; + +//use netmap_sys::*; +use netmap_sys::netmap::*; +use netmap_sys::netmap_user::*; +use libc::*; + +include!(concat!(env!("OUT_DIR"), "/all.rs"));