Skip to content

Commit

Permalink
Add tests, remove unwraps, fix bugs, auto https
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanhs authored and luser committed Nov 21, 2018
1 parent a3dcb66 commit f6ad408
Show file tree
Hide file tree
Showing 26 changed files with 3,225 additions and 1,012 deletions.
14 changes: 8 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ rand = "0.5"
redis = { version = "0.9.0", optional = true }
regex = "1"
# Exact dependency since we use the unstable async API
# If updating this, make sure to update dev-dependencies
reqwest = { version = "=0.8.8", features = ["unstable"], optional = true }
retry = "0.4.0"
ring = "0.13.2"
Expand Down Expand Up @@ -83,7 +84,12 @@ arraydeque = { version = "0.4", optional = true }
crossbeam-utils = { version = "0.5", optional = true }
libmount = { version = "0.1.10", optional = true }
nix = { version = "0.11.0", optional = true }
rouille = { version = "2.2", optional = true, default-features = false }
rouille = { version = "2.2", optional = true, default-features = false, features = ["ssl"] }
void = { version = "1", optional = true }

[patch.crates-io]
# Waiting for https://github.com/tiny-http/tiny-http/pull/151
tiny_http = { git = "https://github.com/aidanhs/tiny-http-sccache.git", rev = "a14fa0a" }

[dev-dependencies]
assert_cmd = "0.9"
Expand All @@ -93,6 +99,8 @@ escargot = "0.3"
itertools = "0.7"
predicates = "0.9.0"
selenium-rs = "0.1"
# Must match the version of request in dependencies
reqwest = { version = "=0.8.8" }

[target.'cfg(unix)'.dependencies]
daemonize = "0.3"
Expand All @@ -118,7 +126,7 @@ unstable = []
# Enables distributed support in the sccache client
dist-client = ["ar", "flate2", "hyper", "reqwest", "rust-crypto", "url"]
# Enables the sccache-dist binary
dist-server = ["arraydeque", "crossbeam-utils", "jsonwebtoken", "flate2", "libmount", "nix", "openssl", "reqwest", "rouille"]
dist-server = ["arraydeque", "crossbeam-utils", "jsonwebtoken", "flate2", "libmount", "nix", "openssl", "reqwest", "rouille", "void"]
# Enables dist tests with external requirements
dist-tests = []

Expand Down
97 changes: 97 additions & 0 deletions scripts/extratest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
set -o xtrace

#CARGO="cargo --color=always"
CARGO="cargo"

gnutarget=x86_64-unknown-linux-gnu
wintarget=x86_64-pc-windows-gnu

gnutarget() {
unset OPENSSL_DIR
export OPENSSL_STATIC=1
target=$gnutarget
}
wintarget() {
export OPENSSL_DIR=$(pwd)/openssl-win
export OPENSSL_STATIC=1
target=$wintarget
}

# all-windows doesn't work as redis-rs build.rs has issues (checks for cfg!(unix))

if [ "$1" = checkall ]; then
$CARGO check --target $target --all-targets --features 'all dist-client dist-server dist-tests'
$CARGO check --target $target --all-targets --features 'all dist-client dist-server'
$CARGO check --target $target --all-targets --features 'all dist-client dist-tests'
$CARGO check --target $target --all-targets --features 'all dist-server dist-tests'
$CARGO check --target $target --all-targets --features 'all dist-client'
$CARGO check --target $target --all-targets --features 'all dist-server'
$CARGO check --target $target --all-targets --features 'all dist-tests'
$CARGO check --target $target --all-targets --features 'all'
$CARGO check --target $target --all-targets --features 'dist-client dist-server dist-tests'
$CARGO check --target $target --all-targets --features 'dist-client dist-server'
$CARGO check --target $target --all-targets --features 'dist-client dist-tests'
$CARGO check --target $target --all-targets --features 'dist-server dist-tests'
$CARGO check --target $target --all-targets --features 'dist-client'
$CARGO check --target $target --all-targets --features 'dist-server'
$CARGO check --target $target --all-targets --features 'dist-tests'
$CARGO check --target $target --all-targets --features ''
$CARGO check --target $target --all-targets --no-default-features --features 'all dist-client dist-server dist-tests'
$CARGO check --target $target --all-targets --no-default-features --features 'all dist-client dist-server'
$CARGO check --target $target --all-targets --no-default-features --features 'all dist-client dist-tests'
$CARGO check --target $target --all-targets --no-default-features --features 'all dist-server dist-tests'
$CARGO check --target $target --all-targets --no-default-features --features 'all dist-client'
$CARGO check --target $target --all-targets --no-default-features --features 'all dist-server'
$CARGO check --target $target --all-targets --no-default-features --features 'all dist-tests'
$CARGO check --target $target --all-targets --no-default-features --features 'all'
$CARGO check --target $target --all-targets --no-default-features --features 'dist-client dist-server dist-tests'
$CARGO check --target $target --all-targets --no-default-features --features 'dist-client dist-server'
$CARGO check --target $target --all-targets --no-default-features --features 'dist-client dist-tests'
$CARGO check --target $target --all-targets --no-default-features --features 'dist-server dist-tests'
$CARGO check --target $target --all-targets --no-default-features --features 'dist-client'
$CARGO check --target $target --all-targets --no-default-features --features 'dist-server'
$CARGO check --target $target --all-targets --no-default-features --features 'dist-tests'
$CARGO check --target $target --all-targets --no-default-features --features ''
wintarget
$CARGO check --target $target --all-targets --features 'dist-client'
#$CARGO check --target $target --all-targets --features 'all-windows dist-client'
#$CARGO check --target $target --all-targets --features 'all-windows'
$CARGO check --target $target --all-targets --features ''


elif [ "$1" = test ]; then
# Musl tests segfault due to https://github.com/mozilla/sccache/issues/256#issuecomment-399254715
gnutarget
VERBOSE=
NOCAPTURE=
NORUN=
TESTTHREADS=
#VERBOSE="--verbose"
#NORUN=--no-run
#NOCAPTURE=--nocapture
TESTTHREADS="--test-threads 1"

# Since integration tests start up the sccache server they must be run sequentially. This only matters
# if you have multiple test functions in one file.

set +x
if ! which docker; then
echo -e "WARNING: =====\n\ndocker not present, some tests will fail\n\n=====\n\n\n\n\n"
sleep 5
fi
if ! which icecc-create-env; then
echo -e "WARNING: =====\n\nicecc-create-env not present, some tests will fail\n\n=====\n\n\n\n\n"
sleep 5
fi
set -x

RUST_BACKTRACE=1 $CARGO test $NORUN --target $target --features 'all dist-client dist-server dist-tests' $VERBOSE -- $NOCAPTURE $TESTTHREADS test_dist_nobuilder

else
echo invalid command
exit 1
fi
Loading

0 comments on commit f6ad408

Please sign in to comment.