mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:08:54 +02:00
initial version of UDTTest tool
This commit is contained in:
parent
4529eea5f8
commit
532ac69091
5 changed files with 106 additions and 1 deletions
|
@ -5,6 +5,8 @@ set_target_properties(mtc PROPERTIES FOLDER "Tools")
|
||||||
add_subdirectory(scribe)
|
add_subdirectory(scribe)
|
||||||
set_target_properties(scribe PROPERTIES FOLDER "Tools")
|
set_target_properties(scribe PROPERTIES FOLDER "Tools")
|
||||||
|
|
||||||
|
add_subdirectory(udt-test)
|
||||||
|
set_target_properties(udt-test PROPERTIES FOLDER "Tools")
|
||||||
|
|
||||||
add_subdirectory(vhacd-util)
|
add_subdirectory(vhacd-util)
|
||||||
set_target_properties(vhacd-util PROPERTIES FOLDER "Tools")
|
set_target_properties(vhacd-util PROPERTIES FOLDER "Tools")
|
||||||
|
|
||||||
|
|
6
tools/udt-test/CMakeLists.txt
Normal file
6
tools/udt-test/CMakeLists.txt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
set(TARGET_NAME udt-test)
|
||||||
|
setup_hifi_project()
|
||||||
|
|
||||||
|
link_hifi_libraries(networking)
|
||||||
|
|
||||||
|
copy_dlls_beside_windows_executable()
|
46
tools/udt-test/src/UDTTest.cpp
Normal file
46
tools/udt-test/src/UDTTest.cpp
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
//
|
||||||
|
// UDTTest.cpp
|
||||||
|
// tools/udt-test/src
|
||||||
|
//
|
||||||
|
// Created by Stephen Birarda on 2015-07-30.
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "UDTTest.h"
|
||||||
|
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
|
const QCommandLineOption PORT_OPTION { "p", "listening port for socket (defaults to random)", "port", 0 };
|
||||||
|
|
||||||
|
UDTTest::UDTTest(int& argc, char** argv) :
|
||||||
|
QCoreApplication(argc, argv)
|
||||||
|
{
|
||||||
|
parseArguments();
|
||||||
|
|
||||||
|
_socket.bind(QHostAddress::LocalHost, _argumentParser.value(PORT_OPTION).toUInt());
|
||||||
|
qDebug() << "Test socket is listening on" << _socket.localPort();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDTTest::parseArguments() {
|
||||||
|
// use a QCommandLineParser to setup command line arguments and give helpful output
|
||||||
|
_argumentParser.setApplicationDescription("High Fidelity Assignment Client");
|
||||||
|
_argumentParser.addHelpOption();
|
||||||
|
|
||||||
|
const QCommandLineOption helpOption = _argumentParser.addHelpOption();
|
||||||
|
|
||||||
|
_argumentParser.addOption(PORT_OPTION);
|
||||||
|
|
||||||
|
if (!_argumentParser.parse(QCoreApplication::arguments())) {
|
||||||
|
qCritical() << _argumentParser.errorText();
|
||||||
|
_argumentParser.showHelp();
|
||||||
|
Q_UNREACHABLE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_argumentParser.isSet(helpOption)) {
|
||||||
|
_argumentParser.showHelp();
|
||||||
|
Q_UNREACHABLE();
|
||||||
|
}
|
||||||
|
}
|
32
tools/udt-test/src/UDTTest.h
Normal file
32
tools/udt-test/src/UDTTest.h
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
//
|
||||||
|
// UDTTest.h
|
||||||
|
// tools/udt-test/src
|
||||||
|
//
|
||||||
|
// Created by Stephen Birarda on 2015-07-30.
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef hifi_UDTTest_h
|
||||||
|
#define hifi_UDTTest_h
|
||||||
|
|
||||||
|
#include <QtCore/QCoreApplication>
|
||||||
|
#include <QtCore/QCommandLineParser>
|
||||||
|
|
||||||
|
#include <udt/socket.h>
|
||||||
|
|
||||||
|
class UDTTest : public QCoreApplication {
|
||||||
|
public:
|
||||||
|
UDTTest(int& argc, char** argv);
|
||||||
|
private:
|
||||||
|
void parseArguments();
|
||||||
|
|
||||||
|
QCommandLineParser _argumentParser;
|
||||||
|
udt::Socket _socket;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_UDTTest_h
|
19
tools/udt-test/src/main.cpp
Normal file
19
tools/udt-test/src/main.cpp
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
//
|
||||||
|
// main.cpp
|
||||||
|
// tools/udt-test/src
|
||||||
|
//
|
||||||
|
// Created by Stephen Birarda on 7/30/15.
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
|
#include <QtCore/QCoreApplication>
|
||||||
|
|
||||||
|
#include "UDTTest.h"
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
UDTTest app(argc, argv);
|
||||||
|
return app.exec();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue