Skip to content

Commit f7585f0

Browse files
author
Will
committed
tool/test: accept the watcher to use for testing as an env var, WATCHER
1 parent f36aa90 commit f7585f0

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

.github/workflows/macos.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
- uses: chetan/git-restore-mtime-action@v2
3636
- run: tool/build --verbose --no-run
3737
- run: tool/test/all
38+
env:
39+
WATCHER: ${{github.workspace}}/out/${{matrix.target-platform}}/Debug/wtr.watcher.asan
3840
- run: tool/build --verbose --no-build --no-run-perf
3941
- run: tool/build --verbose --no-build --no-run-unit
4042
- run: ls -al out/${{matrix.target-platform}}/Debug

.github/workflows/ubuntu.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
- uses: chetan/git-restore-mtime-action@v2
3434
- run: tool/build --verbose --no-run
3535
- run: tool/test/all
36+
env:
37+
WATCHER: ${{github.workspace}}/out/${{matrix.target-platform}}/Debug/wtr.watcher.asan
3638
- run: tool/build --verbose --no-build --no-run-perf
3739
- run: tool/build --verbose --no-build --no-run-unit
3840
- run: ls -al out/${{matrix.target-platform}}/Debug

tool/test/.ctx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,21 @@
88
# shellcheck disable=SC2317
99
# SC2317: Command can be reached.
1010

11-
beganat=$(date -u +"%Y-%m-%dT%H:%M:%SZ") # or date --iso=ns -u on non-bsd
12-
builddir=$( (cd "$(dirname "$0")/../../out" && pwd) )
13-
testdir=$builddir/tst-$beganat
11+
testdir=$(mktemp -d -t tst-XXXXXX) || exit 1
12+
WATCHER=$(realpath "${WATCHER:-$(command -v wtr.watcher)}") || {
13+
echo WATCHER env var not set to a valid path and wtr.watcher not found in PATH 1>&2
14+
exit 1
15+
}
1416
export testdir
1517

1618
trap "cd '$PWD' ; rm -rf '$testdir' '$testdir.json'" EXIT
17-
mkdir -p "$testdir" || exit 1
1819
cd "$testdir" || exit 1
1920

20-
PATH=$builddir/this/Debug:$PATH
21-
22-
# Otherwise, the Darwin watcher will the testdir's creation event
21+
# Otherwise, the Darwin watcher will see the testdir's creation event
2322
[ "$(uname -s)" = Darwin ] && sleep 0.2
2423

2524
watch-async() {
26-
watcher-via-nix() { nix run --quiet .\#watcher -- "$@"; }
27-
watcher=$(command -v wtr.watcher || echo 'watcher-via-nix')
28-
29-
"$watcher" "$@" &
25+
"$WATCHER" "$@" &
3026
sleep 0.1
3127
}
3228
export -f watch-async

0 commit comments

Comments
 (0)