-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·44 lines (35 loc) · 1.48 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
set -eu
# set -e # exit immediately on non-zero status of a command
# set -u # fail on undefined variables
readonly PROGNAME=$(basename $0)
readonly PROGDIR=$(readlink -m "$(dirname "$0")")
readonly ARGS="$@"
cd "$PROGDIR"
source "$PROGDIR/scripts/common.lib.sh"
TEST_INSTALL_DIR="/tmp/micro-tojour-test-installation-deleteme"
rm -rf "$TEST_INSTALL_DIR" > /dev/null
mkdir -p "$TEST_INSTALL_DIR" > /dev/null
PLUG_DIR="$PROGDIR"
# Only copy files that are in git
for gitfile in $(git ls-files); do
mkdir -p "$(realpath --relative-to=. "$(dirname "$TEST_INSTALL_DIR/$gitfile")")" > /dev/null
cp "$gitfile" "$TEST_INSTALL_DIR/$gitfile"
done
# tree -a "$TEST_INSTALL_DIR"
cd "$TEST_INSTALL_DIR"
CONFIG_DEPLOY_DIR="/tmp/micro-tojour-test-deploy-deleteme"
# Make backup of old config
rm -rf "/tmp/micro-tojour-test-old-deleteme/" > /dev/null || :
mv "$CONFIG_DEPLOY_DIR" "/tmp/micro-tojour-test-old-deleteme/" > /dev/null || :
journalDir="$CONFIG_DEPLOY_DIR/plug/tojour/journals"
./install.sh --config-dir "$CONFIG_DEPLOY_DIR" --journal-dir "$journalDir"
TOJOUR_DEVMODE=true "$CONFIG_DEPLOY_DIR/tojour" "$CONFIG_DEPLOY_DIR/tojour.tutorial.md" || Die "Error in installing test instance"
if [[ -f "/tmp/micro-tojour-test-result.log" ]]; then
notify-send "$(cat "/tmp/micro-tojour-test-result.log")"
echo "$(cat "/tmp/micro-tojour-test-result.log")"
echo "SOME UNIT TEST FAILURES, check 'cat /tmp/luajournal.txt | grep FAILED'"
exit 1
else
echo "All tests passed"
fi