-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
130 lines (121 loc) · 4.96 KB
/
Copy pathtest.sh
File metadata and controls
130 lines (121 loc) · 4.96 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env bash
# DeepCode 本地开发验证入口。测试直接调用真实构建与运行路径,不经过自定义控制器。
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT_DIR"
source "$ROOT_DIR/scripts/source-identity.sh"
profile='required'
skipped_checks=0
if [ "${1:-}" = '--profile' ]; then
[ "$#" -eq 2 ] || { printf '用法:%s --profile <static|required|cli|full>\n' "$0" >&2; exit 2; }
profile="$2"
elif [ "$#" -eq 1 ]; then
profile="$1"
elif [ "$#" -ne 0 ]; then
printf '用法:%s [static|required|cli|full]\n' "$0" >&2
exit 2
fi
case "$profile" in
static|required|cli|full) ;;
help|-h|--help)
printf '用法:%s [static|required|cli|full]\n' "$0"
exit 0
;;
*) printf '未知验证范围:%s\n' "$profile" >&2; exit 2 ;;
esac
if [ "$profile" != 'static' ]; then
if [ ! -f /.dockerenv ] && ! grep -qaE '(docker|containerd|kubepods)' /proc/1/cgroup 2>/dev/null; then
printf 'required/cli/full 验证必须在开发容器内执行;请先运行 make shell。\n' >&2
exit 3
fi
for tool in cargo node pnpm python3; do
command -v "$tool" >/dev/null 2>&1 || { printf '缺少命令:%s\n' "$tool" >&2; exit 1; }
done
fi
run_static() {
printf '[test] 脚本语法与 diff 格式\n'
local script
for script in ./test.sh ./build.sh ./entrypoint.sh ./scripts/*.sh; do
bash -n "$script"
done
if deepcode_source_git_available "$ROOT_DIR"; then
git -C "$ROOT_DIR" diff --check
else
printf '[test] Git diff check: SKIP (Git metadata is host-owned and unavailable in this compile/test snapshot)\n'
skipped_checks=$((skipped_checks + 1))
fi
}
run_required() {
run_static
printf '[test] Rust workspace\n'
cargo fmt --all -- --check
cargo test --workspace
printf '[test] 构建编排与程序发布\n'
python3 -I -S ./scripts/tests/build-platforms.py
printf '[test] GUI 资源发布\n'
python3 -I -S ./scripts/tests/ui-update.py
printf '[test] Userspace 共享依赖\n'
pnpm --store-dir "${PNPM_STORE_DIR:-${PNPM_HOME:-$HOME/.local/share/pnpm}/store}" install --frozen-lockfile
pnpm build:userspace-shared
printf '[test] Session 数据流\n'
pnpm --filter @deepcode/session-core test
printf '[test] GUI 投影合同与状态交互\n'
pnpm --filter @deepcode/client test
printf '[test] GUI 类型接线(共享包已编译)\n'
pnpm --filter @deepcode/client typecheck
}
run_workspace_shell() {
printf '[test] Workspace Shell CLI\n'
local workspace_status=0
python3 -I -S ./scripts/tests/workspace-shell-cli.py || workspace_status=$?
case "$workspace_status" in
0) ;;
77)
skipped_checks=$((skipped_checks + 1))
printf '[test] Workspace Shell CLI: SKIP (sandbox UNAVAILABLE; see the reason above; isolation was not verified)\n'
;;
*)
printf '[test] Workspace Shell CLI: FAIL (exit=%s)\n' "$workspace_status" >&2
return "$workspace_status"
;;
esac
}
# E2E scripts consume the outputs selected here; direct calls must supply these paths.
if [ "$profile" = cli ] || [ "$profile" = full ]; then
test_target_dir="${CARGO_TARGET_DIR:-$ROOT_DIR/target}"
export DEEPCODE_E2E_DAEMON="${DEEPCODE_E2E_DAEMON:-$test_target_dir/debug/deepcode-kernel-daemon}"
export DEEPCODE_E2E_CLI="${DEEPCODE_E2E_CLI:-$test_target_dir/debug/deepcode-cli}"
export DEEPCODE_E2E_TUI="${DEEPCODE_E2E_TUI:-$test_target_dir/debug/deepcode-tui}"
export DEEPCODE_E2E_SESSION_BRIDGE="${DEEPCODE_E2E_SESSION_BRIDGE:-$ROOT_DIR/userspace/session-core/dist/sessionServiceBridge.js}"
fi
case "$profile" in
static) run_static ;;
required) run_required ;;
cli)
run_required
printf '[test] CLI 与 daemon 正式入口\n'
cargo build -p deepcode-first-party-tools -p deepcode-kernel-daemon -p deepcode-cli
python3 -I -S ./scripts/tests/tool-input-cli-e2e.py
python3 -I -S ./scripts/tests/permission-delegation-cli.py
python3 -I -S ./scripts/tests/file-access-cli.py
run_workspace_shell
python3 -I -S ./scripts/tests/managed-process-cli.py
python3 -I -S ./scripts/tests/conversation-storage.py
;;
full)
run_required
printf '[test] CLI、TUI 与 GUI 正式包入口\n'
cargo build -p deepcode-first-party-tools -p deepcode-kernel-daemon -p deepcode-cli -p deepcode-tui -p deepcode-host-web
pnpm --filter @deepcode/client build:web
printf '[test] 本地 Agent 真实链路与共享投影壳\n'
python3 -I -S ./scripts/tests/tool-input-cli-e2e.py
python3 -I -S ./scripts/tests/permission-delegation-cli.py
python3 -I -S ./scripts/tests/file-access-cli.py
run_workspace_shell
python3 -I -S ./scripts/tests/managed-process-cli.py
python3 -I -S ./scripts/tests/conversation-storage.py
python3 -I -S ./scripts/tests/local-agent-e2e.py
python3 -I -S ./scripts/tests/document-render-e2e.py
;;
esac
printf '[test] 登记链路检查完成 profile=%s,入口跳过=%s(SKIP 不计通过;测试不等于效果、稳定性、真实 Provider 或发布验收)\n' "$profile" "$skipped_checks"