Comments (15)
CreateProcess
from munit.
My understanding is that CreateProcess is like to fork+exec, not just fork. The documentation seems to confirm, but I really don't know Windows; maybe there is a way to use it in a more fork-like fashion…
from munit.
There is parameter to disable exec.
from munit.
Hm, maybe I'm looking for the wrong keywords, but I don't see anything in the MSDN docs about that. Can you be more specific?
from munit.
AFAICT the best solution available is to use some undocumented APIs from NT (ZwCreateProcess or NtCreateProcess, I don't know which is preferred). The best thread I can find on the subject is hardly conclusive.
I'd be happy to merge a patch, but I'm probably not going to be writing this code myself; I don't really have a good way to do any development on Windows, and I'm not sure mingw will work for this.
from munit.
https://github.com/jonclayden/multicore/blob/master/src/forknt.c
from munit.
Nice. Seeing a full example instead of just a description helps.
It looks like that project is GPLv2. I could rewrite the code, but @s-u, would you mind licensing us a copy under the MIT license instead?
Modern versions of mingw seem to support winternl.h, so I think it should be possible to get rid of most (all?) of those types and typedefs.
from munit.
@nemequ I suggest do not only support for mingw, both mingw/ msvc need to be supported.
from munit.
Of course. Does winternl.h not exist for msvc? Based on line 16 I assumed windows had it but mingw didn't…
from munit.
Sure, I have added explicit MIT license (with non-binding copyleft) to the original file:
https://github.com/s-u/multicore/blob/master/src/forknt.c
But please keep me posted if you get it working - a lot of people would be very thankful. forknt
used to work, but it doesn't on more recent Windows releases (if I recall it started breaking in Vista).
from munit.
@s-u, thanks, I really appreciate the license change! I like that non-binding request, I'll have to think about adding that to µnit…
I'll try to play around with it a bit at some point, but I'm really not a Windows developer so don't get your hopes up. Regardless, it's a good starting point for anyone else with the desire to tackle this issue.
from munit.
Hi,
I don't want to create an issue, just a quick question: what is a correct way of running test application under Valgrind: with or without --no-fork option?
from munit.
@vitasam, it has been a while since I used valgrind (pretty much since AddressSanitizer came out), but IIRC you can pass --trace-children=yes
to have it check child processes, or you can pass --no-fork
to µnit so valgrind doesn't have to deal with it (though of course you lose the benefits that come with forking).
In the future, please file a new issue. It's actually much less disruptive since it won't cause notifications to be sent to people subscribed to the existing issue, and it helps keep the issues clean.
from munit.
@nemequ, thanks!
from munit.
I'm the author of Criterion, and it happens that I've been exploring the same set of issues since the inception of the project.
While I started with simple forking, I ended up ditching the idea of just doing that two years later. The fact is that I've had myriads of problems with libraries that are not fork-safe (and most of them aren't. Looking at you, CoreFoundation) in general. Similarly, I've had my fair share of issues with windows, but ended up implementing the horrible pile of hacks that is fork on Windows; and let me tell you that without controlling the whole toolchain, this was horribly fragile and broke between windows releases.
Instead, the new implementation forks, and re-executes the current executable while jumping on another main. All in all, this is just an order of magnitudes cleaner (in particular, since the parent's address space is not inherited, leaks from the parent don't propagate), but involves a lot of efforts to get somewhere.
I understand that this might not follow the design goals of munit, so I thought I would give my two cents on the matter. BoxFort might not be for you, but you might get some ideas out of it.
Good luck! :)
from munit.
Related Issues (20)
- PGCC Travis job fails: "make: pgcc: Command not found"
- Support for Apple M1 chipset HOT 1
- munit_assert_double_equal doesn't care about scale of the values
- Add CMake module for automatically discovering test cases from a CMake target
- First time compilation error HOT 2
- `Unresolved symbol clock_gettime` with MinGW 8.1 x64 (win32 threads)
- gcc-11 and "declared with mismatched bound" warnings HOT 3
- Paramatised tests but not every combination HOT 2
- Number of iterations of chained suites not used. HOT 1
- Lack of consistent releasing / Versioning
- Iterate all children test suites
- Test results to XML HOT 2
- MunitParameterEnum with NULL value at the beginning leads to segfault
- Debugging with munit and visual studio code HOT 6
- Document how to set up test directory with subfolders HOT 1
- Segmentation fault with nested suites HOT 2
- macOS on Intel: floating point exception in munit_rand_int_range(), but only inside a test HOT 2
- Please tag a new release HOT 6
- Compilation fails on TCC
- Linking fails on PCC
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from munit.