summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgeronimo <geronimo013@gmx.de>2012-07-30 16:24:14 (GMT)
committergeronimo <geronimo013@gmx.de>2012-07-30 16:24:14 (GMT)
commitcedb1ef9230b87b7f92bbec39970a0fccb49bb56 (patch)
treec961a83578553e88f1c71f80b33885c3045d3232
parent881b190d7fea7ef2a56569760654b481f246cf9b (diff)
downloadcmp-cedb1ef9230b87b7f92bbec39970a0fccb49bb56.tar.gz
cmp-cedb1ef9230b87b7f92bbec39970a0fccb49bb56.tar.bz2
removed obsolete sample code
-rw-r--r--tests/MetaScanTest/main.cpp80
1 files changed, 0 insertions, 80 deletions
diff --git a/tests/MetaScanTest/main.cpp b/tests/MetaScanTest/main.cpp
index 8d21293..0236865 100644
--- a/tests/MetaScanTest/main.cpp
+++ b/tests/MetaScanTest/main.cpp
@@ -31,15 +31,9 @@
#include <iostream>
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
-#include <wait.h>
#include <tr1/tuple>
-#include <util.h>
-
-void testPipe(const char *chk = NULL);
static void parseConfig(const char *FileName)
{
@@ -132,80 +126,6 @@ static void testCommandReader()
delete lr;
};
-void testPipe(const char *chk)
-{
- int parent2Child[2];
- int child2Parent[2];
- pid_t pid;
- std::string dataReadFromChild;
- char buffer[BufferSize + 1];
- ssize_t readResult;
- bool run = true;
- int status;
-
- ASSERT_IS(0, pipe(parent2Child));
- ASSERT_IS(0, pipe(child2Parent));
-
- switch (pid = fork()) {
- case -1:
- FAIL("fork failed");
- exit(-1);
-
- case 0: /* child */
- ASSERT_NOT(-1, dup2(parent2Child[READ_FD], STDIN_FILENO));
- ASSERT_NOT(-1, dup2(child2Parent[WRITE_FD], STDOUT_FILENO));
- ASSERT_NOT(-1, dup2(child2Parent[WRITE_FD], STDERR_FILENO));
- ASSERT_IS(0, close(parent2Child[WRITE_FD]));
- ASSERT_IS(0, close(child2Parent[READ_FD]));
-
- if (chk) {
- execlp("mediainfo", "mediainfo", chk, NULL);
- }
- else execlp("ls", "ls", "-al", "--color", NULL);
- FAIL("this line should never be reached!");
- exit(-1);
-
- default: /* parent */
- std::cout << "child " << pid << " process running ..." << std::endl;
-
- ASSERT_IS(0, close(parent2Child[READ_FD]));
- ASSERT_IS(0, close(child2Parent[WRITE_FD]));
-
- while (run) {
- switch (readResult = read(child2Parent[READ_FD], buffer, BufferSize)) {
- case 0: /* end of file, or non-blocking read. */
- std::cout << "End of File reached ..." << std::endl
- << "Data received was ("
- << dataReadFromChild.size() << "):" << std::endl
- << dataReadFromChild << std::endl;
- ASSERT_IS(pid, waitpid(pid, &status, 0));
-
- std::cout << std::endl
- << "child exit status is: " << WEXITSTATUS(status) << std::endl << std::endl;
-// exit(0);
- run = false;
- break;
-
- case -1:
- if ((errno == EINTR) || (errno == EAGAIN)) {
- errno = 0;
- }
- else {
- FAIL("read() failed");
- run = false;
- } break;
-
- default:
- dataReadFromChild.append(buffer, readResult);
- break;
- }
- }
- }
-}
-
-
-// mediainfo ${media} | grep "Scan type"
-// ffmpeg -i ${media}
int main()
{
dumpTextfile("srclient.conf");