Travis cleaner caching (#833)

* speed up Travis startup
- keep all test tempdata in target/tmp
- purge before saving target/* to S3 cache

* allow 4 minutes for cache up/download from Travis' S3 cache stores
This commit is contained in:
Simon B 2018-03-21 17:05:07 +01:00 committed by Ignotus Peverell
parent ed78e1a721
commit e3601b6c8e
5 changed files with 17 additions and 12 deletions

View file

@ -1,5 +1,10 @@
language: rust
cache: cargo
cache:
cargo: true
timeout:
240 # =4 min (default 120). ~6 GB cache up/down from S3 needs time.
before_cache:
- rm -rf target/tmp
dist: trusty
sudo: false
rust:
@ -17,7 +22,7 @@ addons:
- libdw-dev
- cmake
- gcc
- binutils-dev
- binutils-dev
env:
global:
- RUST_BACKTRACE="1"

View file

@ -34,7 +34,7 @@ use wallet::WalletConfig;
/// Just removes all results from previous runs
pub fn clean_all_output(test_name_dir: &str) {
let target_dir = format!("target/{}", test_name_dir);
let target_dir = format!("target/tmp/{}", test_name_dir);
let result = fs::remove_dir_all(target_dir);
if let Err(e) = result {
println!("{}", e);
@ -156,10 +156,10 @@ pub struct LocalServerContainer {
impl LocalServerContainer {
/// Create a new local server container with defaults, with the given name
/// all related files will be created in the directory
/// target/test_servers/{name}
/// target/tmp/test_servers/{name}
pub fn new(config: LocalServerContainerConfig) -> Result<LocalServerContainer, Error> {
let working_dir = format!("target/test_servers/{}", config.name);
let working_dir = format!("target/tmp/test_servers/{}", config.name);
let mut wallet_config = WalletConfig::default();
wallet_config.api_listen_port = format!("{}", config.wallet_port);

View file

@ -190,7 +190,7 @@ fn a_simulate_block_propagation() {
for n in 0..5 {
let s = grin::Server::new(grin::ServerConfig {
api_http_addr: format!("127.0.0.1:{}", 19000 + n),
db_root: format!("target/{}/grin-prop-{}", test_name_dir, n),
db_root: format!("target/tmp/{}/grin-prop-{}", test_name_dir, n),
p2p_config: p2p::P2PConfig {
port: 18000 + n,
..p2p::P2PConfig::default()
@ -300,8 +300,8 @@ fn simulate_fast_sync_double() {
s2.stop();
}
// locks files don't seem to be cleaned properly until process exit
std::fs::remove_file("target/grin-double-fast2/grin-sync-1001/chain/LOCK");
std::fs::remove_file("target/grin-double-fast2/grin-sync-1001/peers/LOCK");
std::fs::remove_file("target/tmp/grin-double-fast2/grin-sync-1001/chain/LOCK");
std::fs::remove_file("target/tmp/grin-double-fast2/grin-sync-1001/peers/LOCK");
thread::sleep(time::Duration::from_secs(20));
let mut conf = config(1001, "grin-double-fast2");
@ -316,7 +316,7 @@ fn simulate_fast_sync_double() {
fn config(n: u16, test_name_dir: &str) -> grin::ServerConfig {
grin::ServerConfig {
api_http_addr: format!("127.0.0.1:{}", 19000 + n),
db_root: format!("target/{}/grin-sync-{}", test_name_dir, n),
db_root: format!("target/tmp/{}/grin-sync-{}", test_name_dir, n),
p2p_config: p2p::P2PConfig {
port: 11000 + n,
..p2p::P2PConfig::default()

View file

@ -555,7 +555,7 @@ fn pmmr_compact_horizon() {
fn setup(tag: &str) -> (String, Vec<TestElem>) {
let _ = env_logger::init();
let t = time::get_time();
let data_dir = format!("./target/{}.{}-{}", t.sec, t.nsec, tag);
let data_dir = format!("./target/tmp/{}.{}-{}", t.sec, t.nsec, tag);
fs::create_dir_all(data_dir.clone()).unwrap();
let mut elems = vec![];

View file

@ -21,8 +21,8 @@ use util::zip;
#[test]
fn zip_unzip() {
let root = Path::new("./target");
let zip_name = "./target/zipped.zip";
let root = Path::new("./target/tmp");
let zip_name = "./target/tmp/zipped.zip";
fs::create_dir_all(root.join("./to_zip/sub")).unwrap();
write_files(&root).unwrap();