Skip to content

Commit a92bd63

Browse files
committed
fix(live-tests): make live scripts cwd-safe
1 parent 6f94fea commit a92bd63

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- Contacts: support `contacts update --birthday` and `--notes`; unify shared date parsing and docs. (#233) — thanks @rosssivertsen.
1818

1919
### Fixed
20+
- Live tests: make `scripts/live-test.sh` and `scripts/live-chat-test.sh` CWD-safe (repo-root aware builds and sourcing).
2021
- Calendar: interpret date-only and relative day `--to` values as inclusive end-of-day while keeping `--to now` as a point-in-time bound. (#204) — thanks @mjaskolski.
2122
- Auth: improve remote/server-friendly manual OAuth flow (`auth add --remote`). (#187) — thanks @salmonumbrella.
2223
- Gmail: avoid false quoted-printable detection for already-decoded URLs with uppercase hex-like tokens while still decoding unambiguous markers (`=3D`, chained escapes, soft breaks). (#186) — thanks @100menotu001.

scripts/live-chat-test.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ set -euo pipefail
33

44
ACCOUNT=""
55
ALLOW_NONTEST=false
6+
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
7+
ROOT_DIR="$(cd -- "$SCRIPT_DIR/.." && pwd)"
68

79
usage() {
810
cat <<'USAGE'
@@ -46,9 +48,9 @@ while [ $# -gt 0 ]; do
4648
shift
4749
done
4850

49-
BIN="${GOG_BIN:-./bin/gog}"
51+
BIN="${GOG_BIN:-$ROOT_DIR/bin/gog}"
5052
if [ ! -x "$BIN" ]; then
51-
make build >/dev/null
53+
make -C "$ROOT_DIR" build >/dev/null
5254
fi
5355

5456
PY="${PYTHON:-python3}"

scripts/live-test.sh

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ ACCOUNT=""
88
SKIP=""
99
AUTH_SERVICES=""
1010
CLIENT=""
11+
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
12+
ROOT_DIR="$(cd -- "$SCRIPT_DIR/.." && pwd)"
1113

1214
usage() {
1315
cat <<'USAGE'
@@ -108,9 +110,9 @@ if [ "$FAST" = true ]; then
108110
fi
109111
fi
110112

111-
BIN="${GOG_BIN:-./bin/gog}"
113+
BIN="${GOG_BIN:-$ROOT_DIR/bin/gog}"
112114
if [ ! -x "$BIN" ]; then
113-
make build >/dev/null
115+
make -C "$ROOT_DIR" build >/dev/null
114116
fi
115117

116118
if [ -n "$CLIENT" ]; then
@@ -142,19 +144,19 @@ TS=$(date +%Y%m%d%H%M%S)
142144
LIVE_TMP=$(mktemp -d "${TMPDIR:-/tmp}/gog-live-$TS-XXXX")
143145
trap 'rm -rf "$LIVE_TMP"' EXIT
144146

145-
source scripts/live-tests/common.sh
146-
source scripts/live-tests/core.sh
147-
source scripts/live-tests/gmail.sh
148-
source scripts/live-tests/drive.sh
149-
source scripts/live-tests/docs.sh
150-
source scripts/live-tests/sheets.sh
151-
source scripts/live-tests/slides.sh
152-
source scripts/live-tests/calendar.sh
153-
source scripts/live-tests/tasks.sh
154-
source scripts/live-tests/contacts.sh
155-
source scripts/live-tests/people.sh
156-
source scripts/live-tests/workspace.sh
157-
source scripts/live-tests/classroom.sh
147+
source "$ROOT_DIR/scripts/live-tests/common.sh"
148+
source "$ROOT_DIR/scripts/live-tests/core.sh"
149+
source "$ROOT_DIR/scripts/live-tests/gmail.sh"
150+
source "$ROOT_DIR/scripts/live-tests/drive.sh"
151+
source "$ROOT_DIR/scripts/live-tests/docs.sh"
152+
source "$ROOT_DIR/scripts/live-tests/sheets.sh"
153+
source "$ROOT_DIR/scripts/live-tests/slides.sh"
154+
source "$ROOT_DIR/scripts/live-tests/calendar.sh"
155+
source "$ROOT_DIR/scripts/live-tests/tasks.sh"
156+
source "$ROOT_DIR/scripts/live-tests/contacts.sh"
157+
source "$ROOT_DIR/scripts/live-tests/people.sh"
158+
source "$ROOT_DIR/scripts/live-tests/workspace.sh"
159+
source "$ROOT_DIR/scripts/live-tests/classroom.sh"
158160

159161
ensure_test_account
160162

0 commit comments

Comments
 (0)