Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xmake test -v 显示更多内容 #4571

Closed
x1244 opened this issue Jan 5, 2024 · 11 comments
Closed

xmake test -v 显示更多内容 #4571

x1244 opened this issue Jan 5, 2024 · 11 comments

Comments

@x1244
Copy link
Contributor

x1244 commented Jan 5, 2024

你在什么场景下需要该功能?

使用xmake test框架,添加doctest测试用例。
默认情况下只输出测试是否通过,但是想通过-v-vD来看到更多信息,但是只有在测试用例失败的情况下,-v才能给出错的位置提示,以及测试用例数量和断言数量。

当测试用例都通过时,无论是-v还是-vD都看不到测试向控制台的输出,虽然测试已经通过,这些输出可能不再重要,但是既然提供了细节查看,这些信息还是应该反馈出来的更好吧。
001
002
我其实想要添加-v-vD能输出doctest的输出内容,最好是格式化后的,带颜色的输出。
003

描述可能的解决方案

可以接受另外一个标识来输出测试用例自身的输出,现在的-v是与xmake复用的,给出了一些编译参数。其实测试时的'-vD并不太关心编译的细节,而是测试本身断言的细节。 如果测试失败,-D`给出的Lua栈的输出,这对于测试来说也没什么帮助。

描述你认为的候选方案

现在的测试已经很好用了,希望能再改进。

其他信息

还有一个小问题,如果测试都通过的的话,0 tests failed中的0能不能不用红色标注,太显示眼了。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: xmake test -v show more content

In what scenario do you need this function?

Use the xmake test framework to add doctest test cases.
By default, it only outputs whether the test passes, but you want to see more information through -v or -vD, but only when the test case fails, -v can give a hint of the error location, and Number of test cases and number of assertions.

When all test cases pass, neither -v nor -vD can see the output of the test to the console. Although the test has passed, these outputs may no longer be important, but since detailed viewing is provided, this information It should be better to give feedback.
001
002
I actually want to add -v or -vD to output the output content of doctest, preferably formatted and colored output.
003

Describe possible solutions

Another flag can be accepted to output the output of the test case itself. The current -v is reused with xmake and gives some compilation parameters. In fact, '-vD' during testing does not care much about the details of compilation, but the details of the assertions in the test itself.
If the test fails, -D gives the output of the Lua stack, which is not helpful for testing.

Describe your alternatives

The current test is already very useful, and I hope it can be improved.

other information

There is also a small question. If all the tests pass, can the 0 in 0 tests failed not be marked in red? It is too eye-catching.

waruqi added a commit that referenced this issue Jan 5, 2024
@waruqi
Copy link
Member

waruqi commented Jan 5, 2024

再试试 xmake update -s dev

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Try xmake update -s dev again

@x1244
Copy link
Contributor Author

x1244 commented Jan 5, 2024

没效果呢。

PS D:\laboratory\runtest> xmake update -s dev
update version dev from official source ..
  => download https://gitee.com/tboox/xmake.git .. ok
  => install script to C:\Program Files\xmake .. ok
PS D:\laboratory\runtest> xmake test
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.38.33130
running tests ...
[ 50%]: runtest/unit1 .................................... passed 0.000s
[100%]: runtest/unit2 .................................... passed 0.016s

100% tests passed, 0 tests failed out of 2, spent 0.016s
PS D:\laboratory\runtest> xmake test -v
running tests ...
[ 50%]: runtest/unit1 .................................... passed 0.000s
[100%]: runtest/unit2 .................................... passed 0.015s

100% tests passed, 0 tests failed out of 2, spent 0.015s
PS D:\laboratory\runtest> xmake test -vD

build cache stats:
cache directory: build\.build_cache
cache hit rate: 0%
cache hit: 0
cache miss: 0
new cached files: 0
remote cache hit: 0
remote new cached files: 0
preprocess failed: 0
compile fallback count: 0

running tests ...
[ 50%]: runtest/unit1 .................................... passed 0.016s
[100%]: runtest/unit2 .................................... passed 0.000s

100% tests passed, 0 tests failed out of 2, spent 0.016s

附加版本信息。

PS D:\laboratory\runtest> xmake --version
xmake v2.8.5+HEAD.debbd3ac3, A cross-platform build utility based on Lua
Copyright (C) 2015-present Ruki Wang, tboox.org, xmake.io
                         _
    __  ___ __  __  __ _| | ______
    \ \/ / |  \/  |/ _  | |/ / __ \
     >  <  | \__/ | /_| |   <  ___/
    /_/\_\_|_|  |_|\__ \|_|\_\____|
                         by ruki, xmake.io

    👉  Manual: https://xmake.io/#/getting_started
    🙏  Donate: https://xmake.io/#/sponsor

   ==========================================================================
  | A new version of xmake is available!                                     |
  |                                                                          |
  | To update to the latest version v2.8.6, run "xmake update".              |
   ==========================================================================

waruqi added a commit that referenced this issue Jan 8, 2024
@waruqi
Copy link
Member

waruqi commented Jan 8, 2024

再试试

@waruqi waruqi added this to the v2.8.7 milestone Jan 8, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


try again

@x1244
Copy link
Contributor Author

x1244 commented Jan 8, 2024

-v可以输出doctest的内容了,虽然没有了颜色。
也可以输出cout的内容,但是cerr的内容没有输出。
能否再改进一下。
感谢。
另,当测试全部通过时,0 tests failed中的0能不能不用红色标注。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


-v can output the content of doctest, although there is no color.
The content of cout can also be output, but the content of cerr is not output.
Can it be improved further?
grateful.
Also, when all tests pass, can the 0 in 0 tests failed not be marked in red?

waruqi added a commit that referenced this issue Jan 8, 2024
@waruqi
Copy link
Member

waruqi commented Jan 8, 2024

#4583

再试试

xmake update -s github:xmake-io/xmake#tests

@x1244
Copy link
Contributor Author

x1244 commented Jan 9, 2024

OK,在-v时可以输出cout和cerr内容了。

@x1244 x1244 closed this as completed Jan 9, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


OK, cout and cerr contents can be output when using -v.

waruqi added a commit that referenced this issue Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants