You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/best-practices/faq.md
+38-1Lines changed: 38 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,13 @@ Parameter description:
71
71
-`-g, --good`: Specify a known good version (tag or commit)
72
72
-`-b, --bad`: Specify a known bad version (tag or commit)
73
73
-`--gitdir`: Specify the path to the xmake source repository
74
-
-`-c, --command`: Specify the test command to verify if the current version is working correctly
74
+
-`-c, --commands`: Specify test commands to verify if the current version is working correctly. Multiple commands can be executed, separated by semicolons
75
+
-`-s, --script`: Run the given Lua script file for testing
76
+
-`--`: Run an arbitrary command (specified after `--`)
77
+
78
+
::: tip NOTE
79
+
If using a Lua script for testing, `os.exec` will automatically raise an error on failure, and git bisect will automatically mark it as a bad commit. You only need to use `raise()` to throw an error when you need custom check logic (such as checking output content).
In the Lua script, you need to put the test logic in the `main` function as the entry point. `os.exec` will automatically raise an error on failure, and git bisect will automatically mark it as a bad commit. If you need custom check logic (such as checking output content), you can use `raise()` to throw an error:
127
+
128
+
```lua
129
+
-- test.lua
130
+
functionmain()
131
+
os.exec("xrepo remove --all -y")
132
+
os.exec("xmake f -a arm64 -cvD -y")
133
+
os.exec("xmake build")
134
+
135
+
-- If you need to check output content, you can use raise to throw an error
136
+
localoutput=os.iorun("xmake run hello")
137
+
ifnotoutput:find("expected output") then
138
+
raise("test output mismatch")
139
+
end
140
+
end
141
+
```
142
+
143
+
You can also use the `--` parameter to directly run arbitrary commands:
0 commit comments