Files
clice/docs/zh/dev/test-and-debug.md
ykiko c14b8de18f chore: remove xmake, clean up unused files, simplify CLI parsing (#392)
## Summary
- **Remove xmake build system**: delete `xmake.lua`, `test-xmake.yml`
workflow, and all xmake-related pixi tasks
- **Migrate packaging to CMake**: `publish-clice.yml` now uses `cmake
-DCLICE_RELEASE=ON` instead of xmake pack
- **Clean up**: remove unused `tests/uv.lock`, `.xmake/` from
`.gitignore`, xmake references from docs
- **Benchmark CI**: change trigger from `pull_request` to
`workflow_dispatch` (manual only)
- **Simplify CLI parsing**: use `DecoKV(style =
KVStyle::JoinedOrSeparate)` in `clice.cc` and `unit_tests.cc`, replacing
verbose `DecoKVStyled` with manual `static_cast` bitmask; use comma
separators; explicit `names` only for underscore fields

## Test plan
- [x] `pixi run cmake-build RelWithDebInfo` compiles successfully
- [x] Verify `pixi run test` passes
- [x] Verify `pixi run package` produces correct archives via CMake
release build
- [x] Verify benchmark workflow can be triggered manually via `gh
workflow run benchmark`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Consolidated CI workflows; some automated triggers converted to manual
invocation
* Standardized shell for workflow steps and removed legacy build
workflow
* Switched packaging/build tasks to a CMake/Ninja flow and updated
artifact paths
  * Adjusted ignore rules to include previously-ignored build metadata

* **Documentation**
* Removed XMake-specific build and test instructions; docs now reflect
the CMake-based workflow

* **Style**
* Updated CLI option declaration style (no user-facing flag name
changes)

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 17:33:20 +08:00

78 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Test and Debug
## Run Tests
clice 有两种形式的测试,单元测试和集成测试。
- 运行单元测试
```bash
$ ./build/bin/unit_tests --test-dir="./tests/data"
```
- 运行集成测试
我们使用 pytest 来运行集成测试,请参考 `pyproject.toml` 安装依赖的 python 库
```bash
$ pytest -s --log-cli-level=INFO tests/integration --executable=./build/bin/clice
```
## Debug
如果想在 clice 上附加调试器并进行调试,推荐先单独以 socket 模式启动 clice然后再将客户端连接到 clice 上
```shell
$ ./build/bin/clice --mode=socket --port=50051
```
在服务器启动之后,可以通过以下两种方式启动客户端连接到服务器
- 使用 pytest 运行特定测试进行连接
你可以运行一个单独的集成测试用例来连接正在运行的 clice。这对于复现和调试特定场景非常有用。
```shell
$ pytest -s --log-cli-level=INFO tests/integration/test_file_operation.py::test_did_open --mode=socket --port=50051
```
- 使用 vscode 进行实际的测试
你也可以通过配置 clice-vscode 插件来连接正在运行的 clice 服务,从而在实际使用场景中进行调试。
1. 在插件市场下载插件 [clice-vscode](https://marketplace.visualstudio.com/items?itemName=ykiko.clice-vscode)
2. 配置 `settings.json`: 在你的项目根目录下创建 `.vscode/settings.json` 文件,并填入以下内容:
```jsonc
{
// Point this to the clice binary you downloaded.
"clice.executable": "/path/to/your/clice/executable",
// Enable socket mode.
"clice.mode": "socket",
"clice.port": 50051,
// Optional: Set this to an empty string to turn off the clangd.
"clangd.path": "",
}
```
3. 重新加载窗口:修改配置后,在 vscode 中执行 Developer: Reload Window 命令使配置生效。插件会自动连接到正在 50051 端口监听的 clice。
如果你需要修改或调试 clice-vscode 插件本身,可以按以下步骤操作:
1. 克隆并安装依赖:
```shell
$ git clone https://github.com/clice-io/clice-vscode
$ cd clice-vscode
$ npm install
```
2. 使用 vscode 打开插件项目:用一个新的 vscode 窗口打开 clice-vscode 文件夹
3. 创建调试配置:在 clice-vscode 项目中,也创建一个 `.vscode/settings.json` 文件,内容与上方相同
4. 按下 `F5` 键。这会启动一个【扩展开发宿主】窗口。这是一个加载了你本地 clice-vscode 插件代码的新的 vscode 窗口,在这个新窗口中打开你的 C++ 项目,它应该会自动连接到 clice