Adding testing functions.
This commit is contained in:
parent
e9cf447512
commit
f9c12f4ba2
32
testing/compile
Executable file
32
testing/compile
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
for file in *.cpp
|
||||||
|
do
|
||||||
|
filename="${file%.*}"
|
||||||
|
list="$list $filename.o"
|
||||||
|
echo -n "Compiling $filename..."
|
||||||
|
g++ -g -c -std=c++23 -I../../CoreUtils -I../../ServerCore $file &
|
||||||
|
if [ $? = '0' ]
|
||||||
|
then
|
||||||
|
echo "OK"
|
||||||
|
else
|
||||||
|
echo "ERROR"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
wait
|
||||||
|
echo -n "Building executable consoleserver..."
|
||||||
|
g++ -g -o consoleserver $list -std=c++23 -L../../CoreUtils -lCoreUtils -L../../ServerCore -lServerCore -lpthread -luuid -lssl -lcrypto
|
||||||
|
if [ $? = '0' ]
|
||||||
|
then
|
||||||
|
echo "OK"
|
||||||
|
else
|
||||||
|
echo "ERROR"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm *.o
|
||||||
|
|
||||||
|
|
40
testing/main.cpp
Normal file
40
testing/main.cpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#include "EPoll.h"
|
||||||
|
#include "ConsoleServer.h"
|
||||||
|
#include "Exception.h"
|
||||||
|
#include "File.h"
|
||||||
|
#include "Log.h"
|
||||||
|
#include "IPAddress.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
coreutils::Log(new coreutils::File("/tmp/http.log", O_WRONLY | O_APPEND | O_CREAT, 0644));
|
||||||
|
coreutils::Log(coreutils::LOG_INFO) << "Terminal Server starting. Build " << __DATE__ << " " << __TIME__;
|
||||||
|
|
||||||
|
std::string ipAddress = "0.0.0.0";
|
||||||
|
|
||||||
|
core::EPoll ePoll;
|
||||||
|
|
||||||
|
core::TerminalServer terminals(ePoll, core::IPAddress(ipAddress, 1026));
|
||||||
|
core::ConsoleServer console(ePoll, core::IPAddress(ipAddress, 1027));
|
||||||
|
|
||||||
|
console.commands.add(ePoll, "threads");
|
||||||
|
console.commands.add(httpSessions, "sessions");
|
||||||
|
console.commands.add(console, "consoles");
|
||||||
|
console.commands.add(console.commands, "help");
|
||||||
|
ePoll.start(2, 1000);
|
||||||
|
|
||||||
|
while(true)
|
||||||
|
sleep(300);
|
||||||
|
|
||||||
|
ePoll.stop();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
catch(coreutils::Exception exception) {
|
||||||
|
std::cout << exception.text << " Error reason is '" << strerror(exception.errorNumber) << "' in file " << exception.file << " at line " << exception.line << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user