2019-07-16 00:41:50 -04:00
|
|
|
# This script takes care of testing your crate
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
# TODO This is the "test phase", tweak it as you see fit
|
|
|
|
main() {
|
2020-07-23 00:37:12 -04:00
|
|
|
cross rustc --bin wireguard-proxy --target $TARGET --release --no-default-features --features $CARGO_FEATURES
|
|
|
|
cross rustc --bin udp-test --target $TARGET --release --no-default-features --features $CARGO_FEATURES
|
|
|
|
|
|
|
|
# to check how they are built
|
|
|
|
file target/$TARGET/release/wireguard-proxy* target/$TARGET/release/udp-test* || echo 'file failed'
|
2019-07-16 00:41:50 -04:00
|
|
|
|
|
|
|
if [ ! -z $DISABLE_TESTS ]; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
# first make sure udp-test succeeds running against itself
|
2020-07-23 00:37:12 -04:00
|
|
|
cross run --target $TARGET --release --no-default-features --features $CARGO_FEATURES --bin udp-test
|
2019-07-16 00:41:50 -04:00
|
|
|
|
|
|
|
# now run udp-test through proxy/proxyd
|
2020-07-23 00:37:12 -04:00
|
|
|
cross run --target $TARGET --release --no-default-features --features $CARGO_FEATURES --bin udp-test -- -is
|
2019-12-16 21:44:07 -05:00
|
|
|
|
2020-07-23 00:37:12 -04:00
|
|
|
if [ $CARGO_FEATURES != "verbose" ]; then
|
2019-12-16 21:44:07 -05:00
|
|
|
# run TLS tests then too
|
2020-07-23 00:37:12 -04:00
|
|
|
cross run --target $TARGET --release --no-default-features --features $CARGO_FEATURES --bin udp-test -- -is --tls-key ci/cert.key --tls-cert ci/cert.pem
|
2019-12-17 01:11:19 -05:00
|
|
|
|
|
|
|
# now pubkey tests
|
|
|
|
|
|
|
|
# one that should fail (wrong pinnedpubkey lowercase e at end instead of uppercase E)
|
2020-07-23 00:37:12 -04:00
|
|
|
cross run --target $TARGET --release --no-default-features --features $CARGO_FEATURES --bin udp-test -- -is --tls-key ci/cert.key --tls-cert ci/cert.pem --pinnedpubkey sha256//BEyQeSjwwUBLXXNuCILHRWyV1gLmY31CdMHNA4VH4de= && exit 1 || true
|
2019-12-17 01:11:19 -05:00
|
|
|
|
|
|
|
# and one that should pass
|
2020-07-23 00:37:12 -04:00
|
|
|
cross run --target $TARGET --release --no-default-features --features $CARGO_FEATURES --bin udp-test -- -is --tls-key ci/cert.key --tls-cert ci/cert.pem --pinnedpubkey sha256//BEyQeSjwwUBLXXNuCILHRWyV1gLmY31CdMHNA4VH4dE=
|
2019-12-16 21:44:07 -05:00
|
|
|
fi
|
2019-07-16 00:41:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
# we don't run the "test phase" when doing deploys
|
|
|
|
if [ -z $TRAVIS_TAG ]; then
|
|
|
|
main
|
|
|
|
fi
|