-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from polachok/ctest
Add ctest tests
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "netmap_test" | ||
version = "0.1.0" | ||
authors = ["Alexander Polyakov <[email protected]>"] | ||
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" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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")); |