Adding Windows builds to CI (#219)

* Adding Windows builds to Travis CI config...
* Adding missing library to windows target...
* Changing test directory name randomization to be cross-platform...
* Removing /target directory from CI cache...
master
Jordan Terrell 6 years ago committed by GitHub
parent 4471217a60
commit d997ad38ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .travis.yml
  2. 1
      librocksdb-sys/Cargo.toml
  3. 3
      librocksdb-sys/build.rs
  4. 8
      librocksdb-sys/tests/ffi.rs

@ -5,6 +5,7 @@ sudo: true
os: os:
- linux - linux
- osx - osx
- windows
rust: rust:
- stable - stable
@ -26,3 +27,6 @@ script:
- cargo test - cargo test
cache: cargo cache: cargo
before_cache:
- rm -rfv target/

@ -20,6 +20,7 @@ libc = "0.2"
[dev-dependencies] [dev-dependencies]
const-cstr = "0.2" const-cstr = "0.2"
uuid = { version = "0.7", features = ["v4"] }
[build-dependencies] [build-dependencies]
cc = { version = "^1.0", features = ["parallel"] } cc = { version = "^1.0", features = ["parallel"] }

@ -83,8 +83,9 @@ fn build_rocksdb() {
config.define("ROCKSDB_LIB_IO_POSIX", Some("1")); config.define("ROCKSDB_LIB_IO_POSIX", Some("1"));
} }
if cfg!(windows) { if cfg!(target_os = "windows") {
link("rpcrt4", false); link("rpcrt4", false);
link("shlwapi", false);
config.define("OS_WIN", Some("1")); config.define("OS_WIN", Some("1"));
// Remove POSIX-specific sources // Remove POSIX-specific sources

@ -21,6 +21,7 @@
extern crate const_cstr; extern crate const_cstr;
extern crate libc; extern crate libc;
extern crate librocksdb_sys as ffi; extern crate librocksdb_sys as ffi;
extern crate uuid;
use ::ffi::*; use ::ffi::*;
use ::libc::*; use ::libc::*;
@ -33,6 +34,7 @@ use ::std::path::PathBuf;
use ::std::ptr; use ::std::ptr;
use ::std::slice; use ::std::slice;
use ::std::str; use ::std::str;
use ::uuid::Uuid;
macro_rules! err_println { macro_rules! err_println {
($($arg:tt)*) => (writeln!(&mut ::std::io::stderr(), $($arg)*).expect("failed printing to stderr")); ($($arg:tt)*) => (writeln!(&mut ::std::io::stderr(), $($arg)*).expect("failed printing to stderr"));
@ -392,15 +394,17 @@ fn ffi() {
let mut err: *mut c_char = ptr::null_mut(); let mut err: *mut c_char = ptr::null_mut();
let run: c_int = -1; let run: c_int = -1;
let test_uuid = Uuid::new_v4().to_simple();
let dbname = { let dbname = {
let mut dir = GetTempDir(); let mut dir = GetTempDir();
dir.push(format!("rocksdb_c_test-{}", geteuid())); dir.push(format!("rocksdb_c_test-{}", test_uuid));
let path = dir.to_str().unwrap(); let path = dir.to_str().unwrap();
CString::new(path).unwrap() CString::new(path).unwrap()
}; };
let dbbackupname = { let dbbackupname = {
let mut dir = GetTempDir(); let mut dir = GetTempDir();
dir.push(format!("rocksdb_c_test-{}-backup", geteuid())); dir.push(format!("rocksdb_c_test-{}-backup", test_uuid));
let path = dir.to_str().unwrap(); let path = dir.to_str().unwrap();
CString::new(path).unwrap() CString::new(path).unwrap()
}; };

Loading…
Cancel
Save