2017-04-06 22:59:41 +00:00
|
|
|
#!/usr/bin/env bash
|
2016-03-18 03:18:16 +00:00
|
|
|
set -e
|
|
|
|
|
2018-06-07 13:34:47 +00:00
|
|
|
# Brings in _ROOT, _DIR, _DIRS globals.
|
2016-10-02 08:18:37 +00:00
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2017-07-29 04:34:59 +00:00
|
|
|
source "${SCRIPT_DIR}/config.sh"
|
2016-03-18 03:18:16 +00:00
|
|
|
|
2016-08-07 03:59:51 +00:00
|
|
|
# Add Cargo to PATH.
|
|
|
|
export PATH=${HOME}/.cargo/bin:${PATH}
|
2020-07-21 17:24:18 +00:00
|
|
|
export CARGO_INCREMENTAL=0
|
|
|
|
CARGO="cargo"
|
2016-08-07 03:59:51 +00:00
|
|
|
|
2016-09-30 03:50:06 +00:00
|
|
|
# Checks that the versions for Cargo projects $@ all match
|
|
|
|
function check_versions_match() {
|
|
|
|
local last_version=""
|
2017-07-29 04:34:59 +00:00
|
|
|
for dir in "${@}"; do
|
2016-09-30 03:50:06 +00:00
|
|
|
local cargo_toml="${dir}/Cargo.toml"
|
|
|
|
if ! [ -f "${cargo_toml}" ]; then
|
|
|
|
echo "Cargo configuration file '${cargo_toml}' does not exist."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-07-29 04:34:59 +00:00
|
|
|
local version=$(grep version "${cargo_toml}" | head -n 1 | cut -d' ' -f3)
|
2016-09-30 03:50:06 +00:00
|
|
|
if [ -z "${last_version}" ]; then
|
|
|
|
last_version="${version}"
|
|
|
|
elif ! [ "${version}" = "${last_version}" ]; then
|
|
|
|
echo "Versions differ in '${cargo_toml}'. ${version} != ${last_version}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2017-03-16 02:26:15 +00:00
|
|
|
# Ensures there are no tabs in any file.
|
2016-12-29 04:33:56 +00:00
|
|
|
function ensure_tab_free() {
|
2016-12-29 04:47:15 +00:00
|
|
|
local tab=$(printf '\t')
|
2018-06-07 13:34:47 +00:00
|
|
|
local matches=$(git grep -E -I "${tab}" "${PROJECT_ROOT}" | grep -v 'LICENSE')
|
2016-12-29 04:33:56 +00:00
|
|
|
if ! [ -z "${matches}" ]; then
|
|
|
|
echo "Tab characters were found in the following:"
|
|
|
|
echo "${matches}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2017-03-16 02:26:15 +00:00
|
|
|
# Ensures there are no files with trailing whitespace.
|
|
|
|
function ensure_trailing_whitespace_free() {
|
2020-01-16 00:53:57 +00:00
|
|
|
local matches=$(git grep -E -I "\s+$" "${PROJECT_ROOT}" | grep -v -F '.stderr:')
|
2017-03-16 02:26:15 +00:00
|
|
|
if ! [ -z "${matches}" ]; then
|
|
|
|
echo "Trailing whitespace was found in the following:"
|
|
|
|
echo "${matches}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.
This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.
The summary of changes in this commit are:
* Config 'secret_key' success and failure are now tested.
* 'secret_key' validation was moved to pre-launch from 'Config:from()'.
* 'Config::from()' only extracts the config.
* Added 'Config::try_from()' for non-panicking extraction.
* 'Config' now knows the profile it was extracted from.
* The 'Config' provider sets a profile of 'Config.profile'.
* 'Rocket', 'Client', 'Fairings', implement 'Debug'.
* 'fairing::Info' implements 'Copy', 'Clone'.
* 'Fairings' keeps track of, logs attach fairings.
* 'Rocket::reconfigure()' was added to allow modifying a config.
Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.
Resolves #1543.
Fixes #1564.
2021-03-09 08:07:43 +00:00
|
|
|
function test_contrib() {
|
2018-08-18 23:52:45 +00:00
|
|
|
FEATURES=(
|
|
|
|
json
|
|
|
|
msgpack
|
|
|
|
tera_templates
|
|
|
|
handlebars_templates
|
2019-08-29 02:56:33 +00:00
|
|
|
serve
|
2018-11-08 17:01:58 +00:00
|
|
|
helmet
|
2018-08-18 23:52:45 +00:00
|
|
|
diesel_postgres_pool
|
|
|
|
diesel_sqlite_pool
|
|
|
|
diesel_mysql_pool
|
|
|
|
postgres_pool
|
2018-10-27 20:04:52 +00:00
|
|
|
mysql_pool
|
2018-08-18 23:52:45 +00:00
|
|
|
sqlite_pool
|
2019-01-04 16:19:09 +00:00
|
|
|
memcache_pool
|
2019-08-29 02:56:33 +00:00
|
|
|
brotli_compression
|
|
|
|
gzip_compression
|
2018-08-18 23:52:45 +00:00
|
|
|
)
|
2017-01-15 10:33:45 +00:00
|
|
|
|
Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.
This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.
The summary of changes in this commit are:
* Config 'secret_key' success and failure are now tested.
* 'secret_key' validation was moved to pre-launch from 'Config:from()'.
* 'Config::from()' only extracts the config.
* Added 'Config::try_from()' for non-panicking extraction.
* 'Config' now knows the profile it was extracted from.
* The 'Config' provider sets a profile of 'Config.profile'.
* 'Rocket', 'Client', 'Fairings', implement 'Debug'.
* 'fairing::Info' implements 'Copy', 'Clone'.
* 'Fairings' keeps track of, logs attach fairings.
* 'Rocket::reconfigure()' was added to allow modifying a config.
Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.
Resolves #1543.
Fixes #1564.
2021-03-09 08:07:43 +00:00
|
|
|
echo ":: Building and testing contrib [default]..."
|
|
|
|
|
2018-08-18 23:52:45 +00:00
|
|
|
pushd "${CONTRIB_LIB_ROOT}" > /dev/null 2>&1
|
Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.
This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.
The summary of changes in this commit are:
* Config 'secret_key' success and failure are now tested.
* 'secret_key' validation was moved to pre-launch from 'Config:from()'.
* 'Config::from()' only extracts the config.
* Added 'Config::try_from()' for non-panicking extraction.
* 'Config' now knows the profile it was extracted from.
* The 'Config' provider sets a profile of 'Config.profile'.
* 'Rocket', 'Client', 'Fairings', implement 'Debug'.
* 'fairing::Info' implements 'Copy', 'Clone'.
* 'Fairings' keeps track of, logs attach fairings.
* 'Rocket::reconfigure()' was added to allow modifying a config.
Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.
Resolves #1543.
Fixes #1564.
2021-03-09 08:07:43 +00:00
|
|
|
$CARGO test $@
|
2018-08-18 23:52:45 +00:00
|
|
|
|
Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.
This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.
The summary of changes in this commit are:
* Config 'secret_key' success and failure are now tested.
* 'secret_key' validation was moved to pre-launch from 'Config:from()'.
* 'Config::from()' only extracts the config.
* Added 'Config::try_from()' for non-panicking extraction.
* 'Config' now knows the profile it was extracted from.
* The 'Config' provider sets a profile of 'Config.profile'.
* 'Rocket', 'Client', 'Fairings', implement 'Debug'.
* 'fairing::Info' implements 'Copy', 'Clone'.
* 'Fairings' keeps track of, logs attach fairings.
* 'Rocket::reconfigure()' was added to allow modifying a config.
Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.
Resolves #1543.
Fixes #1564.
2021-03-09 08:07:43 +00:00
|
|
|
for feature in "${FEATURES[@]}"; do
|
|
|
|
echo ":: Building and testing contrib [${feature}]..."
|
|
|
|
$CARGO test --no-default-features --features "${feature}" $@
|
|
|
|
done
|
2018-11-05 20:29:03 +00:00
|
|
|
popd > /dev/null 2>&1
|
Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.
This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.
The summary of changes in this commit are:
* Config 'secret_key' success and failure are now tested.
* 'secret_key' validation was moved to pre-launch from 'Config:from()'.
* 'Config::from()' only extracts the config.
* Added 'Config::try_from()' for non-panicking extraction.
* 'Config' now knows the profile it was extracted from.
* The 'Config' provider sets a profile of 'Config.profile'.
* 'Rocket', 'Client', 'Fairings', implement 'Debug'.
* 'fairing::Info' implements 'Copy', 'Clone'.
* 'Fairings' keeps track of, logs attach fairings.
* 'Rocket::reconfigure()' was added to allow modifying a config.
Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.
Resolves #1543.
Fixes #1564.
2021-03-09 08:07:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function test_core() {
|
2018-11-05 20:29:03 +00:00
|
|
|
FEATURES=(
|
2020-07-22 19:21:19 +00:00
|
|
|
secrets
|
2018-11-05 20:29:03 +00:00
|
|
|
tls
|
|
|
|
)
|
|
|
|
|
2018-11-09 07:37:37 +00:00
|
|
|
pushd "${CORE_LIB_ROOT}" > /dev/null 2>&1
|
Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.
This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.
The summary of changes in this commit are:
* Config 'secret_key' success and failure are now tested.
* 'secret_key' validation was moved to pre-launch from 'Config:from()'.
* 'Config::from()' only extracts the config.
* Added 'Config::try_from()' for non-panicking extraction.
* 'Config' now knows the profile it was extracted from.
* The 'Config' provider sets a profile of 'Config.profile'.
* 'Rocket', 'Client', 'Fairings', implement 'Debug'.
* 'fairing::Info' implements 'Copy', 'Clone'.
* 'Fairings' keeps track of, logs attach fairings.
* 'Rocket::reconfigure()' was added to allow modifying a config.
Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.
Resolves #1543.
Fixes #1564.
2021-03-09 08:07:43 +00:00
|
|
|
echo ":: Building and testing core [no features]..."
|
|
|
|
$CARGO test --no-default-features $@
|
|
|
|
|
|
|
|
for feature in "${FEATURES[@]}"; do
|
|
|
|
echo ":: Building and testing core [${feature}]..."
|
|
|
|
$CARGO test --no-default-features --features "${feature}" $@
|
|
|
|
done
|
|
|
|
popd > /dev/null 2>&1
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_examples() {
|
2021-03-09 23:32:04 +00:00
|
|
|
echo ":: Building and testing examples..."
|
|
|
|
|
|
|
|
pushd "${EXAMPLES_DIR}" > /dev/null 2>&1
|
|
|
|
# Rust compiles Rocket once with the `secrets` feature enabled, so when run
|
|
|
|
# in production, we need a secret key or tests will fail needlessly. We
|
|
|
|
# ensure in core that secret key failing/not failing works as expected.
|
|
|
|
ROCKET_SECRET_KEY="itlYmFR2vYKrOmFhupMIn/hyB6lYCCTXz4yaQX89XVg=" \
|
|
|
|
$CARGO test --all $@
|
2018-08-18 23:52:45 +00:00
|
|
|
popd > /dev/null 2>&1
|
Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.
This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.
The summary of changes in this commit are:
* Config 'secret_key' success and failure are now tested.
* 'secret_key' validation was moved to pre-launch from 'Config:from()'.
* 'Config::from()' only extracts the config.
* Added 'Config::try_from()' for non-panicking extraction.
* 'Config' now knows the profile it was extracted from.
* The 'Config' provider sets a profile of 'Config.profile'.
* 'Rocket', 'Client', 'Fairings', implement 'Debug'.
* 'fairing::Info' implements 'Copy', 'Clone'.
* 'Fairings' keeps track of, logs attach fairings.
* 'Rocket::reconfigure()' was added to allow modifying a config.
Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.
Resolves #1543.
Fixes #1564.
2021-03-09 08:07:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function test_default() {
|
2021-03-09 23:32:04 +00:00
|
|
|
echo ":: Building and testing core libraries..."
|
Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.
This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.
The summary of changes in this commit are:
* Config 'secret_key' success and failure are now tested.
* 'secret_key' validation was moved to pre-launch from 'Config:from()'.
* 'Config::from()' only extracts the config.
* Added 'Config::try_from()' for non-panicking extraction.
* 'Config' now knows the profile it was extracted from.
* The 'Config' provider sets a profile of 'Config.profile'.
* 'Rocket', 'Client', 'Fairings', implement 'Debug'.
* 'fairing::Info' implements 'Copy', 'Clone'.
* 'Fairings' keeps track of, logs attach fairings.
* 'Rocket::reconfigure()' was added to allow modifying a config.
Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.
Resolves #1543.
Fixes #1564.
2021-03-09 08:07:43 +00:00
|
|
|
|
2021-03-11 06:52:37 +00:00
|
|
|
pushd "${PROJECT_ROOT}" > /dev/null 2>&1
|
2021-03-09 23:32:04 +00:00
|
|
|
$CARGO test --all --all-features $@
|
|
|
|
popd > /dev/null 2>&1
|
Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.
This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.
The summary of changes in this commit are:
* Config 'secret_key' success and failure are now tested.
* 'secret_key' validation was moved to pre-launch from 'Config:from()'.
* 'Config::from()' only extracts the config.
* Added 'Config::try_from()' for non-panicking extraction.
* 'Config' now knows the profile it was extracted from.
* The 'Config' provider sets a profile of 'Config.profile'.
* 'Rocket', 'Client', 'Fairings', implement 'Debug'.
* 'fairing::Info' implements 'Copy', 'Clone'.
* 'Fairings' keeps track of, logs attach fairings.
* 'Rocket::reconfigure()' was added to allow modifying a config.
Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.
Resolves #1543.
Fixes #1564.
2021-03-09 08:07:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if [[ $1 == +* ]]; then
|
|
|
|
CARGO="$CARGO $1"
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
|
|
|
# The kind of test we'll be running.
|
|
|
|
TEST_KIND="default"
|
2021-03-09 23:32:04 +00:00
|
|
|
KINDS=("contrib" "core" "examples" "default" "all")
|
Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.
This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.
The summary of changes in this commit are:
* Config 'secret_key' success and failure are now tested.
* 'secret_key' validation was moved to pre-launch from 'Config:from()'.
* 'Config::from()' only extracts the config.
* Added 'Config::try_from()' for non-panicking extraction.
* 'Config' now knows the profile it was extracted from.
* The 'Config' provider sets a profile of 'Config.profile'.
* 'Rocket', 'Client', 'Fairings', implement 'Debug'.
* 'fairing::Info' implements 'Copy', 'Clone'.
* 'Fairings' keeps track of, logs attach fairings.
* 'Rocket::reconfigure()' was added to allow modifying a config.
Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.
Resolves #1543.
Fixes #1564.
2021-03-09 08:07:43 +00:00
|
|
|
|
|
|
|
if [[ " ${KINDS[@]} " =~ " ${1#"--"} " ]]; then
|
|
|
|
TEST_KIND=${1#"--"}
|
|
|
|
shift
|
2018-08-18 23:52:45 +00:00
|
|
|
fi
|
Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.
This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.
The summary of changes in this commit are:
* Config 'secret_key' success and failure are now tested.
* 'secret_key' validation was moved to pre-launch from 'Config:from()'.
* 'Config::from()' only extracts the config.
* Added 'Config::try_from()' for non-panicking extraction.
* 'Config' now knows the profile it was extracted from.
* The 'Config' provider sets a profile of 'Config.profile'.
* 'Rocket', 'Client', 'Fairings', implement 'Debug'.
* 'fairing::Info' implements 'Copy', 'Clone'.
* 'Fairings' keeps track of, logs attach fairings.
* 'Rocket::reconfigure()' was added to allow modifying a config.
Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.
Resolves #1543.
Fixes #1564.
2021-03-09 08:07:43 +00:00
|
|
|
|
|
|
|
echo ":: Preparing. Environment is..."
|
|
|
|
print_environment
|
|
|
|
echo " CARGO: $CARGO"
|
|
|
|
echo " EXTRA FLAGS: $@"
|
|
|
|
|
|
|
|
echo ":: Ensuring all crate versions match..."
|
|
|
|
check_versions_match "${ALL_PROJECT_DIRS[@]}"
|
|
|
|
|
|
|
|
echo ":: Checking for tabs..."
|
|
|
|
ensure_tab_free
|
|
|
|
|
|
|
|
echo ":: Checking for trailing whitespace..."
|
|
|
|
ensure_trailing_whitespace_free
|
|
|
|
|
|
|
|
echo ":: Updating dependencies..."
|
|
|
|
if ! $CARGO update ; then
|
|
|
|
echo " WARNING: Update failed! Proceeding with possibly outdated deps..."
|
|
|
|
fi
|
|
|
|
|
|
|
|
case $TEST_KIND in
|
|
|
|
core) test_core $@ ;;
|
2021-03-09 23:32:04 +00:00
|
|
|
contrib) test_contrib $@ ;;
|
Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.
This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.
The summary of changes in this commit are:
* Config 'secret_key' success and failure are now tested.
* 'secret_key' validation was moved to pre-launch from 'Config:from()'.
* 'Config::from()' only extracts the config.
* Added 'Config::try_from()' for non-panicking extraction.
* 'Config' now knows the profile it was extracted from.
* The 'Config' provider sets a profile of 'Config.profile'.
* 'Rocket', 'Client', 'Fairings', implement 'Debug'.
* 'fairing::Info' implements 'Copy', 'Clone'.
* 'Fairings' keeps track of, logs attach fairings.
* 'Rocket::reconfigure()' was added to allow modifying a config.
Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.
Resolves #1543.
Fixes #1564.
2021-03-09 08:07:43 +00:00
|
|
|
examples) test_examples $@ ;;
|
2021-03-09 23:32:04 +00:00
|
|
|
default) test_default $@ ;;
|
Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.
This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.
The summary of changes in this commit are:
* Config 'secret_key' success and failure are now tested.
* 'secret_key' validation was moved to pre-launch from 'Config:from()'.
* 'Config::from()' only extracts the config.
* Added 'Config::try_from()' for non-panicking extraction.
* 'Config' now knows the profile it was extracted from.
* The 'Config' provider sets a profile of 'Config.profile'.
* 'Rocket', 'Client', 'Fairings', implement 'Debug'.
* 'fairing::Info' implements 'Copy', 'Clone'.
* 'Fairings' keeps track of, logs attach fairings.
* 'Rocket::reconfigure()' was added to allow modifying a config.
Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.
Resolves #1543.
Fixes #1564.
2021-03-09 08:07:43 +00:00
|
|
|
all)
|
2021-03-11 06:52:37 +00:00
|
|
|
test_default $@ & default=$!
|
|
|
|
test_examples $@ & examples=$!
|
Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.
This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.
The summary of changes in this commit are:
* Config 'secret_key' success and failure are now tested.
* 'secret_key' validation was moved to pre-launch from 'Config:from()'.
* 'Config::from()' only extracts the config.
* Added 'Config::try_from()' for non-panicking extraction.
* 'Config' now knows the profile it was extracted from.
* The 'Config' provider sets a profile of 'Config.profile'.
* 'Rocket', 'Client', 'Fairings', implement 'Debug'.
* 'fairing::Info' implements 'Copy', 'Clone'.
* 'Fairings' keeps track of, logs attach fairings.
* 'Rocket::reconfigure()' was added to allow modifying a config.
Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.
Resolves #1543.
Fixes #1564.
2021-03-09 08:07:43 +00:00
|
|
|
test_core $@ & core=$!
|
|
|
|
test_contrib $@ & contrib=$!
|
|
|
|
|
2021-03-11 06:52:37 +00:00
|
|
|
failures=()
|
|
|
|
if ! wait $default ; then failures+=("ROOT WORKSPACE"); fi
|
|
|
|
if ! wait $examples ; then failures+=("EXAMPLES"); fi
|
|
|
|
if ! wait $core ; then failures+=("CORE"); fi
|
|
|
|
if ! wait $contrib ; then failures+=("CONTRIB"); fi
|
|
|
|
|
|
|
|
if [ ${#failures[@]} -ne 0 ]; then
|
|
|
|
tput setaf 1;
|
|
|
|
echo -e "\n!!! ${#failures[@]} TEST SUITE FAILURE(S) !!!"
|
|
|
|
for failure in "${failures[@]}"; do
|
|
|
|
echo " :: ${failure}"
|
|
|
|
done
|
|
|
|
|
|
|
|
tput sgr0
|
|
|
|
exit ${#failures[@]}
|
|
|
|
fi
|
|
|
|
|
Test 'secret_key' validation, now on pre-launch.
Prior to this commit, it was not possible to test Rocket crates in
production mode without setting a global secret key or bypassing secret
key checking - the testing script did the latter. The consequence is
that it became impossible to test secret key related failures because
the tests passed regardless.
This commit undoes this. As a consequence, all tests are now aware of
the difference between debug and release configurations, the latter of
which validates 'secret_key' by default. New 'Client::debug()' and
'Client::debug_with()' simplify creating an instance of 'Client' with
configuration in debug mode to avoid undesired test failures.
The summary of changes in this commit are:
* Config 'secret_key' success and failure are now tested.
* 'secret_key' validation was moved to pre-launch from 'Config:from()'.
* 'Config::from()' only extracts the config.
* Added 'Config::try_from()' for non-panicking extraction.
* 'Config' now knows the profile it was extracted from.
* The 'Config' provider sets a profile of 'Config.profile'.
* 'Rocket', 'Client', 'Fairings', implement 'Debug'.
* 'fairing::Info' implements 'Copy', 'Clone'.
* 'Fairings' keeps track of, logs attach fairings.
* 'Rocket::reconfigure()' was added to allow modifying a config.
Internally, the testing script was refactored to properly test the
codebase with the new changes. In particular, it no longer sets a rustc
'cfg' to avoid secret-key checking.
Resolves #1543.
Fixes #1564.
2021-03-09 08:07:43 +00:00
|
|
|
;;
|
|
|
|
esac
|