Forking sub-process in CppUnit?

Forking sub-process in CppUnit?

Post by Roy Smit » Sat, 05 Jul 2003 09:58:17

I'm writing a network application in C++, using CppUnit for unit
testing.  I'm thinking of forking a subprocess to run tcpdump in some of
my unit tests to watch actual packets on the wire as they are
transmitted and received.  Has anybody done anything like this?  Any
words of advice (or discouragement)?

1. Fork to run a sub -process

The Perl Cookbook from O'Reilly has nice examples, IMO.

The basic idea is really quite simple:

Iterative example:

    for my $server (qw(huey duey louie)) {

    sub do_lengthy_proces
        ... blah blah ...

Forking example:

    for my $server (qw(huey duey louie)) {
        defined(my $pid = fork) or die "Couldn't fork: $!";
        unless ($pid) {

That's really all you need to do.

2. rv campground info for palm vx

3. Exiting sub-process not returning in Emacs

4. TORONTO - ORACLE/UNIX/VAX/C Developers - Contract

5. fork exitting sub

6. Why is port 80 open?

7. LAM I/O with a forked process using mpirun

8. Fast hline OS routine - redirect to sprite?

9. ORB exits after forked process runs...

10. Forking a CORBA process

11. Process using interrupt and fork() don't work in boot image...???

12. Changing process name after fork?

13. fork problem - <zombie> process