vxx / vlib / x / executor / tools / validate.sh
46 lines · 36 sloc · 1.01 KB · e80386b6af8a071a2e13fd654ebcdb2105fb9202
Raw
1#!/usr/bin/env sh
2set -eu
3
4script_dir=$(CDPATH= cd "$(dirname "$0")" && pwd)
5repo_root=$(CDPATH= cd "$script_dir/../../../.." && pwd)
6cd "$repo_root"
7
8if [ ! -x ./v ]; then
9 echo "x.executor validation must be run from a V checkout with local ./v" >&2
10 exit 1
11fi
12
13tmp_root=$(mktemp -d "${TMPDIR:-/tmp}/xexecutor-validate.XXXXXX")
14cleanup() {
15 rm -rf "$tmp_root"
16}
17trap cleanup EXIT INT TERM
18
19vtmp="$tmp_root/vtmp"
20vcache="$tmp_root/vcache"
21mkdir -p "$vtmp" "$vcache"
22
23run_v() {
24 seconds=$1
25 shift
26 echo "+ ./v $*"
27 if command -v timeout >/dev/null 2>&1; then
28 timeout "$seconds" env VTMP="$vtmp" VCACHE="$vcache" ./v "$@"
29 else
30 env VTMP="$vtmp" VCACHE="$vcache" ./v "$@"
31 fi
32}
33
34sh vlib/x/executor/tools/check_no_async_dependency.sh
35
36v_files=$(find vlib/x/executor -type f -name '*.v' | sort)
37example_files=$(find vlib/x/executor/examples -type f -name '*.v' | sort)
38
39run_v 60 fmt -verify $v_files
40
41for example in $example_files; do
42 run_v 60 run "$example"
43done
44
45run_v 120 test vlib/x/executor
46run_v 180 -prod test vlib/x/executor
47