2020-10-30 07:54:13 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2017-07-03 09:38:19 +02:00
|
|
|
|
2016-01-04 12:35:25 +01:00
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
|
|
|
|
ROOT=$(dirname $(dirname $(realpath "$0")))
|
|
|
|
else
|
|
|
|
ROOT=$(dirname $(dirname $(readlink -f $0)))
|
2021-05-04 11:18:19 +02:00
|
|
|
# --disable-dev-shm-usage --use-gl=swiftshader: when run on docker containers where size of /dev/shm
|
|
|
|
# partition < 64MB which causes OOM failure for chromium compositor that uses the partition for shared memory
|
2021-06-22 17:42:30 +02:00
|
|
|
LINUX_EXTRA_ARGS="--disable-dev-shm-usage --use-gl=swiftshader"
|
2016-01-04 12:35:25 +01:00
|
|
|
fi
|
|
|
|
|
2016-05-10 16:42:47 +02:00
|
|
|
cd $ROOT
|
2016-05-10 16:15:48 +02:00
|
|
|
|
2016-08-09 17:13:08 +02:00
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
2016-08-09 17:56:05 +02:00
|
|
|
NAME=`node -p "require('./product.json').nameLong"`
|
2016-08-09 17:13:08 +02:00
|
|
|
CODE="./.build/electron/$NAME.app/Contents/MacOS/Electron"
|
|
|
|
else
|
|
|
|
NAME=`node -p "require('./product.json').applicationName"`
|
2016-08-09 17:57:09 +02:00
|
|
|
CODE=".build/electron/$NAME"
|
2016-08-09 17:13:08 +02:00
|
|
|
fi
|
|
|
|
|
2016-04-21 02:41:11 +02:00
|
|
|
# Node modules
|
2017-11-16 10:47:02 +01:00
|
|
|
test -d node_modules || yarn
|
2016-04-21 02:41:11 +02:00
|
|
|
|
|
|
|
# Get electron
|
2019-10-16 11:15:43 +02:00
|
|
|
yarn electron
|
2016-04-21 02:41:11 +02:00
|
|
|
|
2016-01-04 12:35:25 +01:00
|
|
|
# Unit Tests
|
2017-07-03 11:45:11 +02:00
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
2017-04-10 10:20:56 +02:00
|
|
|
cd $ROOT ; ulimit -n 4096 ; \
|
2019-09-02 09:30:31 +02:00
|
|
|
ELECTRON_ENABLE_LOGGING=1 \
|
2016-08-09 17:13:08 +02:00
|
|
|
"$CODE" \
|
2020-02-07 09:51:24 +01:00
|
|
|
test/unit/electron/index.js "$@"
|
2016-01-04 12:35:25 +01:00
|
|
|
else
|
2017-04-10 10:20:56 +02:00
|
|
|
cd $ROOT ; \
|
2019-09-02 09:30:31 +02:00
|
|
|
ELECTRON_ENABLE_LOGGING=1 \
|
2016-08-09 17:13:08 +02:00
|
|
|
"$CODE" \
|
2020-12-09 19:46:35 +01:00
|
|
|
test/unit/electron/index.js $LINUX_EXTRA_ARGS "$@"
|
2016-01-04 12:35:25 +01:00
|
|
|
fi
|