From d997ad38bac468aae589f3f8197d2677d7c5c52b Mon Sep 17 00:00:00 2001 From: Jordan Terrell Date: Wed, 7 Nov 2018 07:07:40 -0600 Subject: [PATCH] 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... --- .travis.yml | 4 ++++ librocksdb-sys/Cargo.toml | 1 + librocksdb-sys/build.rs | 3 ++- librocksdb-sys/tests/ffi.rs | 8 ++++++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f0e0916..c691293 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ sudo: true os: - linux - osx +- windows rust: - stable @@ -26,3 +27,6 @@ script: - cargo test cache: cargo +before_cache: + - rm -rfv target/ + \ No newline at end of file diff --git a/librocksdb-sys/Cargo.toml b/librocksdb-sys/Cargo.toml index 7d08b87..44facbf 100644 --- a/librocksdb-sys/Cargo.toml +++ b/librocksdb-sys/Cargo.toml @@ -20,6 +20,7 @@ libc = "0.2" [dev-dependencies] const-cstr = "0.2" +uuid = { version = "0.7", features = ["v4"] } [build-dependencies] cc = { version = "^1.0", features = ["parallel"] } diff --git a/librocksdb-sys/build.rs b/librocksdb-sys/build.rs index 08262d9..dd072d4 100644 --- a/librocksdb-sys/build.rs +++ b/librocksdb-sys/build.rs @@ -83,8 +83,9 @@ fn build_rocksdb() { config.define("ROCKSDB_LIB_IO_POSIX", Some("1")); } - if cfg!(windows) { + if cfg!(target_os = "windows") { link("rpcrt4", false); + link("shlwapi", false); config.define("OS_WIN", Some("1")); // Remove POSIX-specific sources diff --git a/librocksdb-sys/tests/ffi.rs b/librocksdb-sys/tests/ffi.rs index e5face9..13a1a98 100644 --- a/librocksdb-sys/tests/ffi.rs +++ b/librocksdb-sys/tests/ffi.rs @@ -21,6 +21,7 @@ extern crate const_cstr; extern crate libc; extern crate librocksdb_sys as ffi; +extern crate uuid; use ::ffi::*; use ::libc::*; @@ -33,6 +34,7 @@ use ::std::path::PathBuf; use ::std::ptr; use ::std::slice; use ::std::str; +use ::uuid::Uuid; macro_rules! err_println { ($($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 run: c_int = -1; + let test_uuid = Uuid::new_v4().to_simple(); + let dbname = { 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(); CString::new(path).unwrap() }; let dbbackupname = { 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(); CString::new(path).unwrap() };