-
Notifications
You must be signed in to change notification settings - Fork 133
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
adding windows test driver fix #293
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
I see the problem and how you solve it. Please fix and adjust your changes according my input (or discuss it when you see it different 🙂 ).
Please also add the test in the CI. This helps me to see the problem and protects us from similar problems in the future.
Due to the checks: Could you provide a clang-format file (.clang-format) or what should be used for clang-format as default style? Assume clang-format without any further options? |
The format file is checked in: https://github.com/cucumber/cucumber-cpp/blob/main/.clang-format |
Current StatusTLDR: Windows Tests integration, would only merge after some clarifications
Open IssuesOn Windows the QtTestDriver failes sometimes. Reason is that in one test the Text Error messages are compared.
Dont know how to fix. For the QtTests to work which are not part of ctest the Qt Runtime Path (bin on Windows) must be in PATH. |
Hi! Would it be possible to let the checks run on commit, so i can see open issues and fix them? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked through the changes shortly to see if I can run the tests, i.e. that no bad things are in there 😄
I haven't really understood the problem with Qt, Windows and tests, hence I have troubles to understand if the patch is good or not. Sorry for that, a bit short on time on my end.
😲 That would be a bad tests, timings shouldn't be compared in the tests. What test is it? |
Idea is that only the Qt version you specified is searched for. |
QtTestDriverTest, see open issues from above |
@kreuzberger please see my PR #296 to fix the flaky test. I also investigated if it is possible to capture the test log without needing the file. Unfortunately it seems not to be possible (without too much hacking). Meaning that this PR is quite relevant. |
Commented your PR #296. |
@kreuzberger unfortunetaly the Windows build has a problem with gtest. @cwellm did you also had this problem? Could you also help out with reviewing the windows code? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kreuzberger I think we get closer on your fix but still have troubles with the CI. I'd suggest that you split your changes to a small fix for the temporary file on Windows and we add the tests in a separate PR. This way you have the changes that you need integrated.
If you agree, I'd suggest that you open a second PR with the Windows-tests and only keep the functional changes here. Please also cleanup the history in order to only have relevant commits in it.
// wraps the QTemporaryFile creation | ||
// on Windows the file could not be written as long as QTemporaryFile owner of the file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling, I'd suggest (but I'm not a native speaker):
// Wraps the QTemporaryFile creation.
// Needed because on Windows, the file can not be written from QtTest as long as we keep it open.
const auto file = TemporaryFileWrapper::create(); | ||
if (!file.exists()) { | ||
return InvokeResult::failure("Unable to open temporary file needed for this test"); | ||
} | ||
file.close(); | ||
|
||
QtTestObject testObject(this); | ||
int returnValue = QTest::qExec( | ||
&testObject, | ||
QStringList() << "test" | ||
<< "-o" << file.fileName() | ||
<< "-o" << file.name() | ||
); | ||
|
||
if (returnValue == 0) { | ||
return InvokeResult::success(); | ||
} else { | ||
file.open(); | ||
QTextStream ts(&file); | ||
return InvokeResult::failure(ts.readAll().toLocal8Bit()); | ||
return InvokeResult::failure(file.read().toLocal8Bit()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
function(cuke_set_environment environment) | ||
set(options) | ||
set(oneValueArgs ) | ||
set(multiValueArgs RUNPATH) | ||
|
||
cmake_parse_arguments(CUKE_ENV "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||
|
||
if(NOT "${CUKE_ENV_UNPARSED_ARGUMENTS}" STREQUAL "") | ||
message( | ||
FATAL_ERROR | ||
"unparsed arguments in call to cuke_set_environment: ${CUKE_ENV_UNPARSED_ARGUMENTS} from ${CMAKE_CURRENT_LIST_FILE}" | ||
) | ||
endif() | ||
|
||
if( NOT "${CUKE_ENV_RUNPATH}" STREQUAL "") | ||
if(WIN32) | ||
string(REPLACE ";" "\;" CUKE_ENV_RUNPATH "${CUKE_ENV_RUNPATH}") | ||
endif() | ||
set(RUNPATH "$<IF:$<PLATFORM_ID:Windows>,PATH,LD_LIBRARY_PATH>") | ||
list(APPEND environment "$<IF:$<PLATFORM_ID:Windows>,PATH,LD_LIBRARY_PATH>=path_list_prepend:$<SHELL_PATH:${CUKE_ENV_RUNPATH}>") | ||
endif() | ||
set(${environment} ${${environment}} PARENT_SCOPE) | ||
endfunction() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a lot of code to just support Windows. Is it possible to move this to run-windows.ps1 (if it makes sense).
@cwellm any ideas from your side?
Summary
Fix #292
Details
Different QtTestDriver Implemenation to ensure no resource lock on windows.
Issue with undefined output format for qExec, add explicitly ".txt" extension
Motivation and Context
Fix #292
How Has This Been Tested?
Running internal tests with/without changes on ubuntu 22.04 and win10 vs2019
Types of changes
Checklist: