2018-07-27 16:08:14 +03:00
|
|
|
#!/bin/bash
|
2018-09-25 20:45:08 +03:00
|
|
|
set -e
|
2018-07-27 19:44:01 +03:00
|
|
|
|
2019-10-09 18:37:41 +03:00
|
|
|
BASE_DIR=$(cd $(dirname $0) && pwd)
|
|
|
|
pushd $BASE_DIR
|
2019-10-09 18:37:57 +03:00
|
|
|
|
|
|
|
if [ ! -d "synapse/installations" ] || [ ! -d "node_modules" ]; then
|
2019-10-18 15:33:32 +03:00
|
|
|
echo "Please first run $BASE_DIR/install.sh"
|
2019-10-09 18:37:57 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-12-03 16:56:27 +03:00
|
|
|
has_custom_app=$(node has-custom-app.js $@)
|
2022-03-25 22:45:52 +03:00
|
|
|
synapse_log_file=$(node pick-synapse-log-file.js $@)
|
|
|
|
touch $synapse_log_file
|
2019-10-09 17:59:00 +03:00
|
|
|
|
2020-12-03 16:56:27 +03:00
|
|
|
if [ ! -d "element/element-web" ] && [ $has_custom_app -ne "1" ]; then
|
2021-01-31 11:53:15 +03:00
|
|
|
echo "Please provide an instance of Element to test against by passing --app-url <url> or running $BASE_DIR/element/install.sh"
|
2019-10-09 18:37:57 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-07-27 19:44:01 +03:00
|
|
|
stop_servers() {
|
2020-12-03 16:56:27 +03:00
|
|
|
if [ $has_custom_app -ne "1" ]; then
|
|
|
|
./element/stop.sh
|
2019-10-09 17:59:00 +03:00
|
|
|
fi
|
|
|
|
./synapse/stop.sh
|
2018-07-27 19:44:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
handle_error() {
|
|
|
|
EXIT_CODE=$?
|
2022-03-25 22:45:52 +03:00
|
|
|
echo "Tests fell over with a non-zero exit code: stopping servers"
|
2018-07-27 19:44:01 +03:00
|
|
|
stop_servers
|
|
|
|
exit $EXIT_CODE
|
|
|
|
}
|
|
|
|
|
|
|
|
trap 'handle_error' ERR
|
|
|
|
|
2022-03-25 22:45:52 +03:00
|
|
|
LOGFILE=$synapse_log_file ./synapse/start.sh
|
2022-02-11 20:03:22 +03:00
|
|
|
reg_secret=`./synapse/getcfg.sh registration_shared_secret`
|
2020-12-03 16:56:27 +03:00
|
|
|
if [ $has_custom_app -ne "1" ]; then
|
|
|
|
./element/start.sh
|
2019-10-09 17:59:00 +03:00
|
|
|
fi
|
2021-12-06 01:59:06 +03:00
|
|
|
yarn build
|
2022-02-11 20:03:22 +03:00
|
|
|
node lib/start.js --registration-shared-secret=$reg_secret $@
|
2018-07-27 19:44:01 +03:00
|
|
|
stop_servers
|