dup() and dup2() ?

support for the ARM toolchain
Post Reply
Lakedaemon
Posts: 4
Joined: Mon Aug 16, 2010 8:48 pm

dup() and dup2() ?

Post by Lakedaemon » Mon Aug 16, 2010 8:55 pm

I have been playing with unit testing with google test for nds homebrew inside desmume.
It works great so far but I would like to have access to advance features of google test (streams redirection to be able to capture stdout) yet this require dup and dup2().

The headers for these 2 system calls are in sys\system_unistd.h so my homebrew compiles but it doesn't link,
because of undefined references to dup() and dup2().

Is this my fault ? can some other devkitarm users use dup() ans dup2() ?

If the answer is yes, could you tell me in which .a library or .o file the objects for those 2 system calls are suposed to be ?
If the answer is no, could someone send me the dup.c and dup2.c files ?

Best regards,
Lakedaemon

WinterMute
Site Admin
Posts: 1862
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: dup() and dup2() ?

Post by WinterMute » Mon Aug 16, 2010 11:39 pm

stream redirection isn't supported, sorry. Despite appearances to the contrary there is no underlying OS and some things don't work.
Help keep devkitPro toolchains free, Donate today

Personal Blog

Lakedaemon
Posts: 4
Joined: Mon Aug 16, 2010 8:48 pm

Re: dup() and dup2() ?

Post by Lakedaemon » Wed Aug 18, 2010 9:38 am

It's okey ^^;
Don't worry about it.

Knowing this already helps me a lot (that explains why I couldn't capture stdout with googletest) :
I won't spend more time trying to make streams redirection work when it's not possible.

Thanks for the helpful answer

If you are interested, I managed to make google test work (by using a different event listener) and it has already been very helpfull to find bugs for me (that I wouldn't have found otherwise) :

The googletest code runs in a .nds rom that you launch in a custom build of desmume (that listens to some signal from the .nds rom it is emulating)
and that passes through the content of the stdout of the .nds rom to the stdout of desmume

It allows you to make unit testing a breeze.
(of course it is as perfect as desmume's emultion, but well, that means that it's quite good).

alexAG76
Posts: 1
Joined: Sun Feb 22, 2009 4:28 pm

Re: dup() and dup2() ?

Post by alexAG76 » Thu Jul 07, 2011 5:24 pm

Lakedaemon, I know this is a bit old, but would you be willing to post your code here under the Apache 2.0 license? Explanations would also be helpful, of course. :-)

I've been trying to use Boost's library with little success. Printing test results to the tiny screen isn't that great, either. I think perhaps integrating more with the emulator would be better, as you had done with DeSmuMe.

Lakedaemon
Posts: 4
Joined: Mon Aug 16, 2010 8:48 pm

Re: dup() and dup2() ?

Post by Lakedaemon » Thu Jul 07, 2011 5:42 pm

I'm living away from home for the next 2 months.
And the code is on the computer at home...

Some of it has been published on the internet in a google group about googletest and maybee the desmume/devkitpro forums
try googling for "googletest nintendo ds"

It was working real fine...but I only used it for like 2 weeks and then lost focus...had to work on other stuff

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests