Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into feature/rc_1_5_0
Browse files Browse the repository at this point in the history
  • Loading branch information
jovfer authored Jun 28, 2018
2 parents 5c1d205 + c58de88 commit 0de2351
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 30 deletions.
26 changes: 12 additions & 14 deletions Jenkinsfile.cd
Original file line number Diff line number Diff line change
Expand Up @@ -230,23 +230,21 @@ def linuxTesting(file, env_name, network_name, stashBuildResults) {
}
}

if (env_name == 'Ubuntu') { // TODO: Delete condition IS-702
sh "cp libnullpay/target/release/libnullpay.so cli"
sh "cp libindy/target/release/libindy.so cli"
dir('cli') {
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
echo "${env_name} Indy Cli Test: Build"
sh "LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo build --release"
sh "cp libnullpay/target/release/libnullpay.so cli"
sh "cp libindy/target/release/libindy.so cli"
dir('cli') {
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
echo "${env_name} Indy Cli Test: Build"
sh "LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo build --release"

echo "${env_name} Indy Cli Test: Build Tests"
sh 'LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --release --features "nullpay_plugin" --no-run'
echo "${env_name} Indy Cli Test: Build Tests"
sh 'LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --release --features "nullpay_plugin" --no-run'

echo "${env_name} Indy Cli Test: Run tests"
sh 'LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "nullpay_plugin"'
echo "${env_name} Indy Cli Test: Run tests"
sh 'LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "nullpay_plugin"'

if (stashBuildResults) {
stash includes: 'target/release/indy-cli', name: 'IndyCliUbuntuBuildResult'
}
if (stashBuildResults) {
stash includes: 'target/release/indy-cli', name: 'IndyCliUbuntuBuildResult'
}
}
}
Expand Down
6 changes: 1 addition & 5 deletions Jenkinsfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,6 @@ def linuxNodejsTesting(env_name, network_name, testEnv) {
}

def linuxCLITesting(env_name, network_name, testEnv) {
if (env_name == "RedHat"){ // TODO: Delete it IS-702
return;
}

unstash name: "LibindyCliSO${env_name}"
unstash name: "LibnullpayCliSO${env_name}"

Expand Down Expand Up @@ -457,4 +453,4 @@ def setupBrewPackages() {
sh "brew switch libsodium 1.0.12"
sh "brew switch openssl 1.0.2l"
sh "brew switch zeromq 4.2.3"
}
}
15 changes: 13 additions & 2 deletions cli/src/commands/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub mod load_plugin_command {
}

pub fn load_plugin(ctx: &CommandContext, library: &str, initializer: &str) -> Result<(), ()> {
let lib = libloading::Library::new(library)
let lib = _load_lib(library)
.map_err(|_| println_err!("Plugin not found: {:?}", library))?;

unsafe {
Expand All @@ -131,6 +131,17 @@ pub fn load_plugin(ctx: &CommandContext, library: &str, initializer: &str) -> Re
Ok(())
}

#[cfg(all(unix, test))]
fn _load_lib(library: &str) -> libloading::Result<libloading::Library> {
libloading::os::unix::Library::open(Some(library), ::libc::RTLD_NOW | ::libc::RTLD_NODELETE)
.map(libloading::Library::from)
}

#[cfg(any(not(unix), not(test)))]
fn _load_lib(library: &str) -> libloading::Result<libloading::Library> {
libloading::Library::new(library)
}

pub mod exit_command {
use super::*;

Expand Down Expand Up @@ -202,7 +213,7 @@ pub mod tests {
}

pub fn load_null_payment_plugin(ctx: &CommandContext) -> () {
let lib = libloading::Library::new(NULL_PAYMENT_PLUGIN).unwrap();
let lib = _load_lib(NULL_PAYMENT_PLUGIN).unwrap();
unsafe {
let init_func: libloading::Symbol<unsafe extern fn() -> ErrorCode> = lib.get(NULL_PAYMENT_PLUGIN_INIT_FUNCTION.as_bytes()).unwrap();
init_func();
Expand Down
2 changes: 1 addition & 1 deletion libindy/src/commands/did.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl DidCommandExecutor {
let (did, key) = self.crypto_service.create_my_did(&my_did_info)?;

if self.wallet_service.record_exists::<Did>(wallet_handle, &did.did)? {
return Err(IndyError::DidError(DidError::AlreadyExistsError("Did already exists".to_string())));
return Err(IndyError::DidError(DidError::AlreadyExistsError(did.did)));
};

self.wallet_service.add_indy_object(wallet_handle, &did.did, &did, &HashMap::new())?;
Expand Down
2 changes: 1 addition & 1 deletion libindy/src/services/wallet/encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,4 @@ mod tests {
let u = decrypt_tags(&None, &tag_name_key, &tag_value_key).unwrap();
assert!(u.is_none());
}
}
}
2 changes: 1 addition & 1 deletion libindy/src/services/wallet/export_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1107,4 +1107,4 @@ mod tests {
let res = wallet.get(type1, name1, _options());
assert_match!(Err(WalletError::ItemNotFound), res);
}
}
}
6 changes: 3 additions & 3 deletions libindy/src/services/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ impl WalletService {
match self.open_wallet(name, None, credentials) {
Err(err) => {
// Ignores the error, since there is nothing that can be done
self.delete_wallet(name, credentials).ok(); // TODO: why do we ignore thr result here? ok is used to avoid warning
let _ = self.delete_wallet(name, credentials); // TODO: why do we ignore thr result here? ok is used to avoid warning
Err(err)
}
Ok(wallet_handle) => {
Expand All @@ -593,7 +593,7 @@ impl WalletService {
match import(wallet, reader, &import_config.key) {
Ok(_) => Ok(()),
err @ Err(_) => {
self.delete_wallet(name, credentials).ok(); // TODO: why do we ignore thr result here? ok is used to avoid warning
let _ = self.delete_wallet(name, credentials); // TODO: why do we ignore thr result here? ok is used to avoid warning
err
}
}
Expand Down Expand Up @@ -1819,4 +1819,4 @@ mod tests {
let res = wallet_service.open_wallet("test_wallet", None, &_credentials());
assert_match!(Err(_), res);
}
}
}
1 change: 0 additions & 1 deletion libindy/src/services/wallet/storage/default/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,6 @@ mod tests {
use std::collections::HashMap;
use std::env;


fn _create_and_open_test_storage() -> Box<WalletStorage> {
_prepare_path();
let storage_type = SQLiteStorageType::new();
Expand Down
2 changes: 1 addition & 1 deletion libindy/src/services/wallet/storage/plugged/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2179,4 +2179,4 @@ mod tests {
assert_eq!(&expected_free_record_call, debug.get(6).unwrap());
assert_eq!(&expected_free_search_call, debug.get(7).unwrap());
}
}
}
2 changes: 1 addition & 1 deletion libindy/src/utils/crypto/chacha20poly1305_ietf/sodium.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ mod tests {
let u = ChaCha20Poly1305IETF::decrypt(&c, &key, &nonce).unwrap();
assert_eq!(data, u)
}
}
}

0 comments on commit 0de2351

Please sign in to comment.