Skip to content

Commit beaf687

Browse files
committed
Merge remote-tracking branch 'upstream/master' into feature/rc_1_5_0
2 parents ddc4972 + db5a926 commit beaf687

File tree

189 files changed

+14759
-14639
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+14759
-14639
lines changed

Jenkinsfile.cd

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,12 @@ def linuxTesting(file, env_name, network_name, stashBuildResults) {
171171

172172
try {
173173
def libindyFeatures = "--features sodium_static"
174+
def libindyBuildFeatures = "--features \"fatal_warnings sodium_static\""
174175

175176
echo "${env_name} Libindy Test: Build"
177+
sh "RUST_BACKTRACE=1 cargo build --release $libindyBuildFeatures"
178+
179+
echo "${env_name} Libindy Test: Build tests"
176180
sh "RUST_BACKTRACE=1 cargo test --release --no-run $libindyFeatures"
177181

178182
echo "${env_name} Libindy Test: Run tests"
@@ -230,23 +234,21 @@ def linuxTesting(file, env_name, network_name, stashBuildResults) {
230234
}
231235
}
232236

233-
if (env_name == 'Ubuntu') { // TODO: Delete condition IS-702
234-
sh "cp libnullpay/target/release/libnullpay.so cli"
235-
sh "cp libindy/target/release/libindy.so cli"
236-
dir('cli') {
237-
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
238-
echo "${env_name} Indy Cli Test: Build"
239-
sh "LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo build --release"
237+
sh "cp libnullpay/target/release/libnullpay.so cli"
238+
sh "cp libindy/target/release/libindy.so cli"
239+
dir('cli') {
240+
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
241+
echo "${env_name} Indy Cli Test: Build"
242+
sh "LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo build --release --features fatal_warnings"
240243

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

244-
echo "${env_name} Indy Cli Test: Run tests"
245-
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"'
247+
echo "${env_name} Indy Cli Test: Run tests"
248+
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"'
246249

247-
if (stashBuildResults) {
248-
stash includes: 'target/release/indy-cli', name: 'IndyCliUbuntuBuildResult'
249-
}
250+
if (stashBuildResults) {
251+
stash includes: 'target/release/indy-cli', name: 'IndyCliUbuntuBuildResult'
250252
}
251253
}
252254
}
@@ -288,7 +290,7 @@ def windowsTesting() {
288290
"PATH=$WORKSPACE\\libindy\\prebuilt\\lib;$PATH",
289291
"RUST_BACKTRACE=1"
290292
]) {
291-
bat "cargo build --release"
293+
bat "cargo build --release --features fatal_warnings"
292294
bat "cargo test --release --no-run"
293295

294296
echo "Windows Libindy Test: Run tests"
@@ -308,7 +310,7 @@ def windowsTesting() {
308310
withEnv([
309311
"RUST_BACKTRACE=1"
310312
]) {
311-
bat "cargo build --release"
313+
bat "cargo build --release --features fatal_warnings"
312314
bat "cargo test --release --no-run"
313315

314316
echo "Windows Libnullpay Test: Run tests"
@@ -336,7 +338,7 @@ def windowsTesting() {
336338
withEnv([
337339
"RUST_BACKTRACE=1"
338340
]) {
339-
bat "cargo build --release"
341+
bat "cargo build --release --features fatal_warnings"
340342

341343
echo "Windows Indy Cli Test: Build tests"
342344
bat "cargo test --release $featuresArgs --no-run"
@@ -629,7 +631,7 @@ def publishingRCtoStable() {
629631
publishLibindyCliWindowsFilesRCtoStable(libindyVersion)
630632

631633
echo 'Moving Windows RC artifacts to Stable: libnullpay'
632-
publishLibnullpayWindowsFilesRCtoStable(libindyVersion)
634+
publishLibnullpayWindowsFilesRCtoStable()
633635

634636
echo 'Moving Ubuntu RC artifacts to Stable: libnullpay'
635637
publishLibnullpayDebRCtoStable(testEnv)
@@ -676,7 +678,7 @@ def publishLibindyCliDebRCtoStable(testEnv, version) {
676678

677679
def publishLibnullpayDebRCtoStable(testEnv) {
678680
def libnullpayVersion = getSrcVersion("libnullpay")
679-
publishDebRCtoStable(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "libindyCliDebs", false)
681+
publishDebRCtoStable(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "libnullpayDebs", false)
680682
}
681683

682684
def publishDebRCtoStable(testEnv, packageName, folder, version, stashName, moveDevArtifacts) {
@@ -685,7 +687,7 @@ def publishDebRCtoStable(testEnv, packageName, folder, version, stashName, moveD
685687

686688
unstash name: stashName
687689

688-
sh "fakeroot deb-reversion -v $version $packageName/debs/\"$packageName\"_\"$rcFullVersion\"_amd64.deb"
690+
sh "fakeroot deb-reversion -v $version $folder/debs/\"$packageName\"_\"$rcFullVersion\"_amd64.deb"
689691

690692
if (moveDevArtifacts) {
691693
sh "fakeroot deb-reversion -v $version $folder/debs/\"$packageName\"-dev_\"$rcFullVersion\"_amd64.deb"

Jenkinsfile.ci

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def windowsTesting() {
4545
"PATH=$WORKSPACE\\libindy\\prebuilt\\lib;$PATH",
4646
"RUST_BACKTRACE=1"
4747
]) {
48-
bat "cargo build"
48+
bat "cargo build --features fatal_warnings"
4949
bat "cargo test --no-run"
5050

5151
echo "Windows Libindy Test: Run tests"
@@ -64,7 +64,7 @@ def windowsTesting() {
6464
withEnv([
6565
"RUST_BACKTRACE=1"
6666
]) {
67-
bat "cargo build"
67+
bat "cargo build --features fatal_warnings"
6868
bat "cargo test --no-run"
6969

7070
echo "Windows Libnullpay Test: Run tests"
@@ -133,7 +133,7 @@ def macosTesting() {
133133
echo "MacOS Test: Build"
134134
setupRust()
135135
setupBrewPackages()
136-
sh "cargo build"
136+
sh "cargo build --features fatal_warnings"
137137
sh "cargo test --no-run"
138138
// TODO testing
139139
}
@@ -226,15 +226,15 @@ def linuxTesting(file, env_name, network_name) {
226226
poolInst = openPool(env_name, network_name)
227227

228228
def testEnv
229-
def libindyFeatures = "--features sodium_static"
229+
def additionalFeatures = "sodium_static"
230230

231231
dir('libindy') {
232232
echo "${env_name} Libindy Test: Build docker image"
233233
testEnv = dockerBuild('libindy', file)
234234

235235
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
236236
echo "${env_name} Libindy Test: Build"
237-
sh "cargo build $libindyFeatures"
237+
sh "cargo build --features \"fatal_warnings $additionalFeatures\""
238238
}
239239
}
240240

@@ -249,7 +249,7 @@ def linuxTesting(file, env_name, network_name) {
249249

250250
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
251251
echo "${env_name} Libnullpay Test: Build"
252-
sh "LIBRARY_PATH=./ cargo build"
252+
sh "LIBRARY_PATH=./ cargo build --features fatal_warnings"
253253
}
254254
}
255255

@@ -268,10 +268,10 @@ def linuxTesting(file, env_name, network_name) {
268268
echo "${env_name} Libindy Test: Test"
269269

270270
echo "${env_name} Libindy Test: Build Test"
271-
sh "RUST_BACKTRACE=1 cargo test --no-run $libindyFeatures"
271+
sh "RUST_BACKTRACE=1 cargo test --no-run --features $additionalFeatures"
272272

273273
echo "${env_name} Libindy Test: Run tests"
274-
sh "RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test $libindyFeatures"
274+
sh "RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --features $additionalFeatures"
275275
}
276276
}
277277
},
@@ -362,10 +362,6 @@ def linuxNodejsTesting(env_name, network_name, testEnv) {
362362
}
363363

364364
def linuxCLITesting(env_name, network_name, testEnv) {
365-
if (env_name == "RedHat"){ // TODO: Delete it IS-702
366-
return;
367-
}
368-
369365
unstash name: "LibindyCliSO${env_name}"
370366
unstash name: "LibnullpayCliSO${env_name}"
371367

@@ -457,4 +453,4 @@ def setupBrewPackages() {
457453
sh "brew switch libsodium 1.0.12"
458454
sh "brew switch openssl 1.0.2l"
459455
sh "brew switch zeromq 4.2.3"
460-
}
456+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ After successfully compiling `libindy`, you will need to add the path containing
114114
* [RHEL based distributions (Amazon Linux 2017.03)](doc/rhel-build.md)
115115
* [Windows](doc/windows-build.md)
116116
* [MacOS](doc/mac-build.md)
117+
* [Android](doc/android-build.md)
117118

118119
**Note:**
119120
By default `cargo build` produce debug artifacts with a large amount of run-time checks.

cli/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ authors = ["Vyacheslav Gudkov <[email protected]>"]
66
[features]
77
nullpay_plugin = []
88

9+
# Causes the build to fail on all warnings
10+
fatal_warnings = []
11+
912
[dependencies]
1013
ansi_term = "0.10"
1114
chrono = "0.4"
@@ -22,4 +25,4 @@ serde = "1.0"
2225
serde_json = "1.0"
2326
serde_derive = "1.0"
2427
term = "0.4.6"
25-
rpassword = "1.0.0"
28+
rpassword = "1.0.0"

cli/src/commands/common.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub mod load_plugin_command {
112112
}
113113

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

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

134+
#[cfg(all(unix, test))]
135+
fn _load_lib(library: &str) -> libloading::Result<libloading::Library> {
136+
libloading::os::unix::Library::open(Some(library), ::libc::RTLD_NOW | ::libc::RTLD_NODELETE)
137+
.map(libloading::Library::from)
138+
}
139+
140+
#[cfg(any(not(unix), not(test)))]
141+
fn _load_lib(library: &str) -> libloading::Result<libloading::Library> {
142+
libloading::Library::new(library)
143+
}
144+
134145
pub mod exit_command {
135146
use super::*;
136147

@@ -202,7 +213,7 @@ pub mod tests {
202213
}
203214

204215
pub fn load_null_payment_plugin(ctx: &CommandContext) -> () {
205-
let lib = libloading::Library::new(NULL_PAYMENT_PLUGIN).unwrap();
216+
let lib = _load_lib(NULL_PAYMENT_PLUGIN).unwrap();
206217
unsafe {
207218
let init_func: libloading::Symbol<unsafe extern fn() -> ErrorCode> = lib.get(NULL_PAYMENT_PLUGIN_INIT_FUNCTION.as_bytes()).unwrap();
208219
init_func();

cli/src/commands/ledger.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,10 @@ pub mod get_validator_info_command {
357357
};
358358

359359
for (node, response) in responses {
360+
if response.eq("timeout") {
361+
println_err!("Restart pool node {} timeout.", node);
362+
continue
363+
}
360364
let response = serde_json::from_str::<Response<serde_json::Value>>(&response)
361365
.map_err(|err| println_err!("Invalid data has been received: {:?}", err))?;
362366
println_succ!("Get validator info response for node {}:", node);
@@ -687,6 +691,11 @@ pub mod pool_restart_command {
687691
};
688692

689693
for (node, response) in responses {
694+
if response.eq("timeout") {
695+
println_err!("Restart pool node {} timeout.", node);
696+
continue
697+
}
698+
690699
let response = serde_json::from_str::<Response<serde_json::Value>>(&response)
691700
.map_err(|err| println_err!("Invalid data has been received: {:?}", err))?;
692701

cli/src/commands/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ pub fn get_object_param<'a>(name: &'a str, params: &'a CommandParams) -> Result<
117117
}
118118
}
119119

120+
pub fn get_opt_object_param<'a>(name: &'a str, params: &'a CommandParams) -> Result<Option<serde_json::Value>, ()> {
121+
match params.get(name) {
122+
Some(_) => Ok(Some(get_object_param(name, params)?)),
123+
None => Ok(None)
124+
}
125+
}
126+
120127
fn extract_array_tuples<'a>(param: &'a str) -> Vec<String> {
121128
let re = Regex::new(r#"\(([^\(\)]+)\),?"#).unwrap();
122129
re.captures_iter(param).map(|c| c[1].to_string()).collect::<Vec<String>>()

cli/src/commands/pool.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub mod connect_command {
121121
match Pool::close(handle) {
122122
Ok(()) => {
123123
set_connected_pool(ctx, Some((handle, name.to_owned())));
124-
println_succ!("Pool \"{}\" has been connected", name)
124+
println_succ!("Pool \"{}\" has been disconnected", name)
125125
}
126126
Err(err) => println_err!("Indy SDK error occurred {:?}", err),
127127
}
@@ -576,4 +576,4 @@ pub mod tests {
576576
let pools = Pool::list().unwrap();
577577
serde_json::from_str(&pools).unwrap()
578578
}
579-
}
579+
}

0 commit comments

Comments
 (0)