2020-11-21 01:19:39 +01:00
|
|
|
#!/bin/sh
|
2012-11-01 23:17:31 +01:00
|
|
|
|
2020-11-21 01:19:39 +01:00
|
|
|
pecho() { printf %s\\n "$*"; }
|
|
|
|
log() { pecho "$@"; }
|
|
|
|
error() { log "ERROR: $@" >&2; }
|
|
|
|
fatal() { error "$@"; exit 1; }
|
|
|
|
try() { "$@" || fatal "'$@' failed"; }
|
2012-11-01 23:17:31 +01:00
|
|
|
|
2020-11-21 01:19:39 +01:00
|
|
|
[ -n "${SAUCE_USERNAME}" ] || fatal "SAUCE_USERNAME is unset - exiting"
|
|
|
|
[ -n "${SAUCE_ACCESS_KEY}" ] || fatal "SAUCE_ACCESS_KEY is unset - exiting"
|
|
|
|
|
|
|
|
MY_DIR=$(try cd "${0%/*}" && try pwd) || exit 1
|
2012-11-01 23:17:31 +01:00
|
|
|
|
tests: future proof travis/runner.sh and make it more robust
This change only slightly modifies the bahaviour of travis/runner.sh, but:
1. speeds up the tests, because it does not install dependencies before running
them. Dependencies are already installed by .travis.yml in its "install"
section;
2. if for some reason Etherpad does not start, there is a sudden failure,
instead of launching the front end tests anyway, and then having to wait 10
minutes for them to time out;
3. it is compatible with a different way of installing etherpad dependencies
("npm ci" instead of "npm install"), whereas the previous one broke. This
will probably be introduced in a while, so this change future-proofs for it
(see #3778).
4. it is more robust, because it detects more reliably the paths, and changes
between them correctly;
Please note that the script now requires bash instead of a generic posix shell.
This may break on platforms which default to a different shell (FreeBSD, MacOS?)
2020-03-29 22:32:54 +02:00
|
|
|
# reliably move to the etherpad base folder before running it
|
2020-11-21 01:19:39 +01:00
|
|
|
try cd "${MY_DIR}/../../../"
|
tests: future proof travis/runner.sh and make it more robust
This change only slightly modifies the bahaviour of travis/runner.sh, but:
1. speeds up the tests, because it does not install dependencies before running
them. Dependencies are already installed by .travis.yml in its "install"
section;
2. if for some reason Etherpad does not start, there is a sudden failure,
instead of launching the front end tests anyway, and then having to wait 10
minutes for them to time out;
3. it is compatible with a different way of installing etherpad dependencies
("npm ci" instead of "npm install"), whereas the previous one broke. This
will probably be introduced in a while, so this change future-proofs for it
(see #3778).
4. it is more robust, because it detects more reliably the paths, and changes
between them correctly;
Please note that the script now requires bash instead of a generic posix shell.
This may break on platforms which default to a different shell (FreeBSD, MacOS?)
2020-03-29 22:32:54 +02:00
|
|
|
|
2020-11-21 01:19:39 +01:00
|
|
|
log "Assuming bin/installDeps.sh has already been run"
|
2020-10-06 15:21:09 +02:00
|
|
|
node node_modules/ep_etherpad-lite/node/server.js --experimental-worker "${@}" &
|
2020-11-10 06:59:50 +01:00
|
|
|
ep_pid=$!
|
tests: future proof travis/runner.sh and make it more robust
This change only slightly modifies the bahaviour of travis/runner.sh, but:
1. speeds up the tests, because it does not install dependencies before running
them. Dependencies are already installed by .travis.yml in its "install"
section;
2. if for some reason Etherpad does not start, there is a sudden failure,
instead of launching the front end tests anyway, and then having to wait 10
minutes for them to time out;
3. it is compatible with a different way of installing etherpad dependencies
("npm ci" instead of "npm install"), whereas the previous one broke. This
will probably be introduced in a while, so this change future-proofs for it
(see #3778).
4. it is more robust, because it detects more reliably the paths, and changes
between them correctly;
Please note that the script now requires bash instead of a generic posix shell.
This may break on platforms which default to a different shell (FreeBSD, MacOS?)
2020-03-29 22:32:54 +02:00
|
|
|
|
2020-11-21 01:19:39 +01:00
|
|
|
log "Waiting for Etherpad to accept connections (http://localhost:9001)..."
|
|
|
|
connected=false
|
|
|
|
can_connect() {
|
|
|
|
curl -sSfo /dev/null http://localhost:9001/ || return 1
|
|
|
|
connected=true
|
|
|
|
}
|
|
|
|
now() { date +%s; }
|
|
|
|
start=$(now)
|
|
|
|
while [ $(($(now) - $start)) -le 15 ] && ! can_connect; do
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
[ "$connected" = true ] \
|
|
|
|
|| fatal "Timed out waiting for Etherpad to accept connections"
|
|
|
|
log "Successfully connected to Etherpad on http://localhost:9001"
|
tests: future proof travis/runner.sh and make it more robust
This change only slightly modifies the bahaviour of travis/runner.sh, but:
1. speeds up the tests, because it does not install dependencies before running
them. Dependencies are already installed by .travis.yml in its "install"
section;
2. if for some reason Etherpad does not start, there is a sudden failure,
instead of launching the front end tests anyway, and then having to wait 10
minutes for them to time out;
3. it is compatible with a different way of installing etherpad dependencies
("npm ci" instead of "npm install"), whereas the previous one broke. This
will probably be introduced in a while, so this change future-proofs for it
(see #3778).
4. it is more robust, because it detects more reliably the paths, and changes
between them correctly;
Please note that the script now requires bash instead of a generic posix shell.
This may break on platforms which default to a different shell (FreeBSD, MacOS?)
2020-03-29 22:32:54 +02:00
|
|
|
|
|
|
|
# start the remote runner
|
2020-11-15 21:09:31 +01:00
|
|
|
echo "Now starting the remote runner"
|
|
|
|
failed=0
|
|
|
|
node remote_runner.js || failed=1
|
|
|
|
|
|
|
|
kill $(cat /tmp/sauce.pid)
|
|
|
|
kill $ep_pid
|
|
|
|
|
|
|
|
cd "${MY_DIR}/../../../"
|
|
|
|
# print the start of every minified file for debugging
|
|
|
|
find var/ -type f -name "minified_*" -not -name "*.gz" |xargs head -n2
|
|
|
|
|
|
|
|
# is any package minified more than once?
|
|
|
|
find var/ -type f -name "minified_*" |xargs md5sum|cut -d" " -f1|sort|uniq -c|egrep "^\W+1\W" -v
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "FAILED: a resource is packaged multiple times"
|
|
|
|
failed=2
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit $failed
|