summaryrefslogtreecommitdiff
path: root/tests/test_tools_2.cc
blob: 0cf4cad1e6981ac2eaafb300d13167eacc6f9b81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "simple_sink.hh"
#include "testtools.hh"

using namespace rtfl::tools;
using namespace rtfl::tests;

int main (int argc, char *argv[])
{
   int fd1 = openPipe ("echo Hello; sleep 2");
   BlockingLinesSource s1 (fd1);
   // Both commands start at the same time, even if fd2 is processed later; thus
   // the "sleep" at the beginning of the second command.
   int fd2 = openPipe ("sleep 2; echo World; sleep 2");
   BlockingLinesSource s2 (fd2);

   LinesSourceSequence lss (false);
   lss.add (&s1);
   lss.add (&s2);
   lss.addTimeout(1, 123);
   lss.addTimeout(3, 124);

   SimpleSink sink;
   lss.setup (&sink);

   return 0;
}