Regtests on the CI (#244)

* submodule and test script

* proper grep pattern

* travis config

* build in advance

* remove error! and fix grep

* use intermediate file

* use package with java, not jdk

* use minimum cache

* add summary delimter

* fixed regtests broken in 9e53289

* clear output

* remove old submodule

* updating tool

* remove from .gitmodules also

* more convinient log output

* travis fold labels
This commit is contained in:
Nikolay Volf 2016-12-02 12:27:48 +03:00 committed by Marek Kotewicz
parent e5027ea844
commit 76aeb1f0ba
7 changed files with 43 additions and 6 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "tools/compare-tool"]
path = tools/compare-tool
url = https://github.com/theuni/bitcoind-comparisontool

View File

@ -1,7 +1,6 @@
sudo: required
dist: trusty
language: rust
branches:
only:
- master
@ -24,9 +23,16 @@ addons:
- libdw-dev
- gcc-4.8
- g++-4.8
- oracle-java8-set-default
script:
- echo -en 'travis_fold:start:tests'
- ./tools/test.sh
- echo -en 'travis_fold:end:tests'
- echo -en 'travis_fold:start:build.release'
- cargo build --release
- echo -en 'travis_fold:end:build.release'
- ./tools/bench.sh
- ./tools/regtests.sh
after_success: |
[ false ] &&
[ $TRAVIS_BRANCH = master ] &&

View File

@ -322,7 +322,7 @@ impl Storage {
Err(e) => {
// todo: log error here
context.restore();
error!("Error while reorganizing to {}: {:?}", hash, e);
warn!("Error while reorganizing to {}: {:?}", hash, e);
Err(e)
}
}

View File

@ -248,11 +248,13 @@ impl SynchronizationServer {
};
trace!(target: "sync", "Going to respond with inventory with {} items to peer#{}", blocks_hashes.len(), peer_index);
let inventory = blocks_hashes.into_iter().map(|hash| InventoryVector {
let inventory: Vec<_> = blocks_hashes.into_iter().map(|hash| InventoryVector {
inv_type: InventoryType::MessageBlock,
hash: hash,
}).collect();
executor.lock().execute(Task::SendInventory(peer_index, inventory));
if !inventory.is_empty() {
executor.lock().execute(Task::SendInventory(peer_index, inventory));
}
// inform that we have processed task for peer
queue.lock().task_processed(peer_index);
},
@ -660,7 +662,7 @@ pub mod tests {
}).map(|t| server.add_task(0, t));
// => empty response
let tasks = DummyTaskExecutor::wait_tasks_for(executor, 100); // TODO: get rid of explicit timeout
assert_eq!(tasks, vec![Task::SendInventory(0, vec![])]);
assert_eq!(tasks, vec![]);
}
#[test]

View File

@ -1,3 +1,4 @@
#!/bin/bash
echo -en 'travis_fold:start:bench'
cargo run --manifest-path ./bencher/Cargo.toml --release
echo -en 'travis_fold:end:bench'

1
tools/compare-tool Submodule

@ -0,0 +1 @@
Subproject commit 09fb3db2b703e3865fde8c2bb169306969364d74

24
tools/regtests.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
echo -en 'travis_fold:start:Regtests'
./target/release/pbtc --regtest --db-cache=192 &
! java -jar ./tools/compare-tool/pull-tests-be0eef7.jar /tmp/regtest-db 2>&1 | tee regtests-full.log | grep -E --color=auto 'org.bitcoinj.store.BlockStoreException\:|BitcoindComparisonTool.main\: ERROR|bitcoind sent us a block it already had, make sure bitcoind has no blocks!|java.lang.NullPointerException'
result=$?
if [ $result -eq 1 ]
then
echo "Regtests failed" | grep --color=auto "failed"
echo "-----------------------------"
echo "Full log: "
cat regtests-full.log
else
echo "Reg tests ok, test cases: "
GREP_COLOR="01;32" grep -E "BitcoindComparisonTool.main: Block \"b[0-9]*\" completed processing" regtests-full.log
fi
echo -en 'travis_fold:end:Regtests'
pkill -f ./target/release/pbtc
exit "$result"