Skip to content

Commit 3006fe3

Browse files
committed
fix docs
1 parent 249bcb5 commit 3006fe3

File tree

3 files changed

+35
-33
lines changed

3 files changed

+35
-33
lines changed

docs/posts/quickstart-12-custom-scripts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This article mainly explains in detail how to achieve more complex and flexible
1818

1919
xmake.lua uses the 80/20 principle to achieve two-layer separated configuration: description domain and script domain.
2020

21-
What is the 80/20 principle? Simply put, for most project configurations, 80% of the time, they are basic常规配置, such as: `add_cxflags`, `add_links`, etc.
21+
What is the 80/20 principle? Simply put, for most project configurations, 80% of the time, they are basic regular configurations, such as: `add_cxflags`, `add_links`, etc.
2222
Only the remaining less than 20% of places need additional complexity to meet some special configuration requirements.
2323

2424
And this remaining 20% of configurations are usually more complex. If they are directly filled throughout xmake.lua, it will make the entire project configuration very messy and unreadable.
@@ -74,7 +74,7 @@ However, it should be noted that although the description domain supports lua sc
7474
:::
7575

7676
And in the description domain, the main purpose is to set configuration items, so xmake does not fully open all module interfaces. Many interfaces are prohibited from being called in the description domain.
77-
Even some of the callable interfaces that are opened are completely read-only, non-time-consuming safe interfaces, such as: `os.getenv()` to read some常规系统信息, used for configuration logic control.
77+
Even some of the callable interfaces that are opened are completely read-only, non-time-consuming safe interfaces, such as: `os.getenv()` to read some regular system information, used for configuration logic control.
7878

7979
:::note
8080
Also note that xmake.lua will be parsed multiple times, used to parse different configuration domains at different stages: such as: `option()`, `target()` and other domains.

docs/posts/quickstart-8-switch-build-mode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ If it's release mode, it will enable compilation optimization and strip all debu
8989

9090
### Customized Mode Configuration
9191

92-
Of course, the compilation configurations set by these two built-in rules by default can only meet the常规需求 of most scenarios. If users want to customize some personal compilation configurations in different compilation modes, they need to make judgments in xmake.lua themselves.
92+
Of course, the compilation configurations set by these two built-in rules by default can only meet the regular needs of most scenarios. If users want to customize some personal compilation configurations in different compilation modes, they need to make judgments in xmake.lua themselves.
9393

9494
For example, if we want to enable debugging symbols in release mode as well, we just need to:
9595

docs/posts/xmake-update-v2.8.5.md

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -253,132 +253,134 @@ running tests...
253253

254254
![](/assets/img/manual/xmake-test1.png)
255255

256-
我们也可以执行 `xmake test -vD` 查看详细的测试失败的错误信息:
256+
We can also execute `xmake test -vD` to view detailed error information about test failures:
257257

258258
![](/assets/img/manual/xmake-test2.png)
259259

260-
#### 运行指定测试目标
260+
#### Running Specified Test Targets
261261

262-
我们也可以指定运行指定 target 的某个测试:
262+
We can also specify to run a specific test of a target:
263263

264264
```bash
265265
$ xmake test targetname/testname
266266
```
267267

268-
或者按模式匹配的方式,运行一个 target 的所有测试,或者一批测试:
268+
Or run all tests of a target, or a batch of tests, by pattern matching:
269269

270270
```bash
271271
$ xmake test targetname/*
272272
$ xmake test targetname/foo*
273273
```
274274

275-
也可以运行所有 target 的同名测试:
275+
We can also run tests with the same name across all targets:
276276

277277
```bash
278278
$ xmake test */testname
279279
```
280280

281-
#### 并行化运行测试
281+
#### Parallel Test Execution
282282

283-
其实,默认就是并行化运行的,但是我们可以通过 `-jN` 调整运行的并行度。
283+
Actually, it runs in parallel by default, but we can adjust the parallelism level through `-jN`.
284284

285285
```bash
286286
$ xmake test -jN
287287
```
288288

289-
#### 分组运行测试
289+
#### Group Test Execution
290290

291291
```bash
292292
$ xmake test -g "foo"
293293
$ xmake test -g "foo*"
294294
```
295295

296-
#### 添加测试到目标(无参数)
296+
#### Adding Tests to Target (No Parameters)
297297

298-
如果没有配置任何参数,仅仅配置了测试名到 `add_tests`,那么仅仅测试这个目标程序的是否会运行失败,根据退出代码来判断是否通过测试。
298+
If no parameters are configured, and only the test name is configured to `add_tests`, it will only test whether the target program will run and fail, judging whether the test passes based on the exit code.
299299

300300
```
301301
target("test")
302302
add_tests("testname")
303303
```
304304

305-
#### 配置运行参数
305+
#### Configuring Run Arguments
306306

307-
我们也可以通过 `{runargs = {"arg1", "arg2"}}` 的方式,给 `add_tests` 配置指定测试需要运行的参数。
307+
We can also configure the arguments that the test needs to run through `{runargs = {"arg1", "arg2"}}` in `add_tests`.
308308

309-
另外,一个 target 可以同时配置多个测试用例,每个测试用例可独立运行,互不冲突。
309+
In addition, a target can configure multiple test cases at the same time, and each test case can run independently without conflicts.
310310

311311
```lua
312312
target("test")
313313
add_tests("testname", {runargs = "arg1"})
314314
add_tests("testname", {runargs = {"arg1", "arg2"}})
315315
```
316316

317-
如果我们没有配置 runargs `add_tests`,那么我们也会尝试从被绑定的 target 中,获取 `set_runargs` 设置的运行参数。
317+
If we haven't configured runargs to `add_tests`, we will also try to get the run arguments set by `set_runargs` from the bound target.
318318

319319
```lua
320320
target("test")
321321
add_tests("testname")
322322
set_runargs("arg1", "arg2")
323323
```
324324

325-
#### 配置运行目录
325+
#### Configuring Run Directory
326326

327-
我们也可以通过 rundir 设置测试运行的当前工作目录,例如:
327+
We can also set the current working directory for test execution through rundir, for example:
328328

329329
```lua
330330
target("test")
331331
add_tests("testname", {rundir = os.projectdir()})
332332
```
333333

334-
如果我们没有配置 rundir `add_tests`,那么我们也会尝试从被绑定的 target 中,获取 `set_rundir` 设置的运行目录。
334+
If we haven't configured rundir to `add_tests`, we will also try to get the run directory set by `set_rundir` from the bound target.
335335

336336
```lua
337337
target("test")
338338
add_tests("testname")
339339
set_rundir("$(projectdir)")
340340
```
341341

342-
#### 配置运行环境
342+
#### Configuring Run Environment
343343

344-
我们也可以通过 runenvs 设置一些运行时候的环境变量,例如:
344+
We can also set some environment variables at runtime through runenvs, for example:
345345

346346
```lua
347347
target("test")
348348
add_tests("testname", {runenvs = {LD_LIBRARY_PATH = "/lib"}})
349349
```
350350

351-
如果我们没有配置 runenvs `add_tests`,那么我们也会尝试从被绑定的 target 中,获取 `add_runenvs` 设置的运行环境。
351+
If we haven't configured runenvs to `add_tests`, we will also try to get the run environment set by `add_runenvs` from the bound target.
352352

353353
```lua
354354
target("test")
355355
add_tests("testname")
356356
add_runenvs("LD_LIBRARY_PATH", "/lib")
357357
```
358358

359-
#### 匹配输出结果
359+
#### Matching Output Results
360360

361-
默认情况下,`xmake test` 会根据测试运行的退出代码是否为 0,来判断是否测试通过。
361+
By default, `xmake test` will judge whether the test passes based on whether the exit code of the test run is 0.
362362

363-
当然,我们也可以通过配置测试运行的输出结果是否满足我们的指定的匹配模式,来判断是否测试通过。
363+
Of course, we can also judge whether the test passes by configuring whether the output results of the test run meet our specified matching patterns.
364364

365-
主要通过这两个参数控制:
365+
Mainly controlled by these two parameters:
366366

367-
| 参数 | 说明 |
367+
| Parameter | Description |
368368
| --- | --- |
369-
| pass_outputs | 如果输出匹配,则测试通过 |
370-
| fail_outputs | 如果输出匹配,则测试失败 |
369+
| pass_outputs | If output matches, test passes |
370+
| fail_outputs | If output matches, test fails |
371371

372-
传入 `pass_outputs` `fail_outputs` 的是一个 lua 匹配模式的列表,但模式稍微做了一些简化,比如对 `*` 的处理。
372+
The `pass_outputs` and `fail_outputs` passed in are a list of lua matching patterns, but the patterns have been slightly simplified, such as the handling of `*`.
373373

374-
如果要匹配成功,则测试通过,可以这么配置:
374+
If the match is successful, the test passes. You can configure it like this:
375375

376376
```lua
377377
target("test")
378378
add_tests("testname1", {pass_outputs = "hello"})
379379
add_tests("testname2", {pass_outputs = "hello *"})
380380
add_tests("testname3", {pass_outputs = {"hello", "hello *"}})
381-
```If the match is successful, the test fails. You can configure it like this:
381+
```
382+
383+
If the match is successful, the test fails. You can configure it like this:
382384

383385
```lua
384386
target("test")

0 commit comments

Comments
 (0)