This commit is contained in:
Thulinma 2011-10-20 22:02:45 +02:00
parent 32ffc09f0e
commit bce0cda879
18 changed files with 13 additions and 326 deletions

20
tools/spawntest/Makefile Normal file
View file

@ -0,0 +1,20 @@
SRC = main.cpp ../../util/util.cpp
OBJ = $(SRC:.cpp=.o)
OUT = spawntest
INCLUDES =
DEBUG = 4
OPTIMIZE = -g
CCFLAGS = -Wall -Wextra -funsigned-char $(OPTIMIZE) -DDEBUG=$(DEBUG)
CC = $(CROSS)g++
LD = $(CROSS)ld
AR = $(CROSS)ar
LIBS =
.SUFFIXES: .cpp
.PHONY: clean default
default: $(OUT)
.cpp.o:
$(CC) $(INCLUDES) $(CCFLAGS) $(LIBS) -c $< -o $@
$(OUT): $(OBJ)
$(CC) $(LIBS) -o $(OUT) $(OBJ)
clean:
rm -rf $(OBJ) $(OUT) Makefile.bak *~

26
tools/spawntest/main.cpp Normal file
View file

@ -0,0 +1,26 @@
/// \file spawntest/main.cpp
/// Contains a testing program for the Util::Proc utility class.
#include <iostream>
#include <string>
#include "../../util/util.h" //Process utility
/// Sleeps a maximum of five seconds, each second being interruptable by a signal.
void sleepFive(){
sleep(1); sleep(1); sleep(1); sleep(1); sleep(1);
}
/// Testing program for Util::Proc utility class.
int main(){
Util::Procs::Start("number1", "./test.sh Koekjes");
sleepFive();
Util::Procs::Start("number2", "./testpipein.sh", "./testpipeout.sh");
sleepFive();
Util::Procs::Start("number3", "./infitest.sh");
sleepFive();
Util::Procs::Stop("number3");
Util::Procs::Start("number4", "./infitest.sh", "./testpipeout.sh");
sleepFive();
Util::Procs::Stop("number4");
return 0;
}//main

6
tools/spawntest/test.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
echo "I am a test!"
echo "I was called as $0"
echo "My first param is $1"
echo "Exiting now..."

5
tools/spawntest/testpipein.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
echo "Sending something through the pipe..." 1>&2
echo "something"
echo "Exiting pipewriter" 1>&2

6
tools/spawntest/testpipeout.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
echo "Reading stdin..."
read meh
echo "I read $meh"
echo "Exiting pipereader now..."