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 在windows平台无法正确同时设置多个add_test("test",{run_timeout(1000)}) #5458

Open
ZtRXR opened this issue Aug 10, 2024 · 9 comments
Labels

Comments

@ZtRXR
Copy link

ZtRXR commented Aug 10, 2024

Xmake 版本

xmake v2.9.4+dev.af3090adb

操作系统版本和架构

Windows11 x86-64 22631.3880 mingw64

描述问题

xmake test 在windows平台无法正确add_test("test",{run_timeout(1000)})
会出现

error: wait events in poller failed!

linux平台是正常的

期待的结果

在设置的run_timeout()正确kill掉程序并显示结果

工程配置

最小实现如下
lua文件

target("test")
    add_files("./src/*.cpp")
    for v=1,4 do
        local s=tostring(v)
        add_tests(s,files="./src/*.cpp",{run_timeout=10000})
    end

src/main.cpp

#include<bits/stdc++.h>
int main(){
    while(1)getchar();
}

附加信息和错误日志

> xmake test
running tests ...
[ 10%]: running.test P3372/1
[ 20%]: running.test P5431/1
[ 30%]: running.test binExp/binExp
[ 40%]: running.test fperfect/1
[ 50%]: running.test fperfect/2
[ 60%]: running.test fperfect/3
[ 70%]: running.test fperfect/4
[ 80%]: running.test inverse/1
[ 90%]: running.test inverse/2
[100%]: running.test test/1
error: wait events in poller failed!
@ZtRXR ZtRXR added the bug label Aug 10, 2024
@Issues-translate-bot
Copy link

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


Title: xmake test cannot correctly add_test("test",{run_timeout(1000)}) on the windows platform

Xmake version

xmake v2.9.4+dev.af3090adb

Operating system version and architecture

Windows11 22631.3880

Describe the problem

xmake test cannot correctly add_test("test",{run_timeout(1000)}) on the windows platform
will appear

error: wait events in poller failed!

The linux platform is normal

Expected results

Correctly kill the program and display the results in the set run_timeout()

Project configuration

The minimum implementation is as follows
lua file

target("test")
    add_files("./src/*.cpp")
    add_tests("test",{run_timeout=1000})
end

src/main.cpp

#include<bits/stdc++.h>
int main(){
    int n;
    std::cin>>n;
}

Additional information and error logs

> xmake test
running tests...
[10%]: running.test P3372/1
[20%]: running.test P5431/1
[30%]: running.test binExp/binExp
[40%]: running.test fperfect/1
[50%]: running.test fperfect/2
[60%]: running.test fperfect/3
[70%]: running.test fperfect/4
[80%]: running.test inverse/1
[90%]: running.test inverse/2
[100%]: running.test test/1
error: wait events in poller failed!

@ZtRXR ZtRXR changed the title xmake test 在windows平台无法正确add_test("test",{run_timeout(1000)}) xmake test 在windows平台无法正确同时设置多个add_test("test",{run_timeout(1000)}) Aug 11, 2024
@ZtRXR
Copy link
Author

ZtRXR commented Aug 11, 2024

我更新了一下最小实现,希望作者能修复

@Issues-translate-bot
Copy link

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


I updated the minimal implementation, I hope the author can fix it

@waruqi
Copy link
Member

waruqi commented Aug 16, 2024

给个完整工程。

@Issues-translate-bot
Copy link

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


Give a complete project.

@waruqi
Copy link
Member

waruqi commented Aug 16, 2024

目前的实现,timeout 后,kill process 会导致 WaitForMultipleObjects 直接 failed,不太好搞,需要花时间重新处理下这块的 timeout 逻辑,等后面有时间再看看

proc:kill()

https://github.com/tboox/tbox/blob/861513a0caec926d62f90dc9839c5a209bf100a5/src/tbox/platform/windows/poller_process.c#L176

@Issues-translate-bot
Copy link

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


In the current implementation, after timeout, the kill process will cause WaitForMultipleObjects to fail directly, which is not easy to do. You need to spend time to reprocess this timeout logic and look at it later when you have time.

proc:kill()

https://github.com/tboox/tbox/blob/861513a0caec926d62f90dc9839c5a209bf100a5/src/tbox/platform/windows/poller_process.c#L176

@ZtRXR
Copy link
Author

ZtRXR commented Aug 18, 2024

最小实现github链接
这里是最小工程项目git仓库

@Issues-translate-bot
Copy link

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


Minimum implementation github link
Here is the minimal project git repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants