tests[ChronoShare]: Create integrated tests for ChronoShare
Change-Id: If3f2a803b41dedb060971d07d9564e9ec5f77f4b
diff --git a/.gitignore b/.gitignore
index 3e8ce4a..d3701d9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
build/
.lock*
gui/html.qrc
+osx/
diff --git a/gui/chronosharegui.cpp b/gui/chronosharegui.cpp
index 8df191f..cce3a2a 100644
--- a/gui/chronosharegui.cpp
+++ b/gui/chronosharegui.cpp
@@ -26,6 +26,7 @@
#include <QFileInfo>
#include <QValidator>
+#include <boost/throw_exception.hpp>
#include <thread>
namespace ndn {
@@ -110,6 +111,7 @@
if (!loadSettings() || m_username.isNull() || m_username == "" || m_sharedFolderName.isNull() ||
m_sharedFolderName == "" || m_dirPath.isNull() || m_dirPath == "") {
// prompt user to choose folder
+ _LOG_DEBUG("First Time Setup");
openMessageBox("First Time Setup",
"Please enter a username, shared folder name and choose the shared folder path on your local filesystem.");
viewSettings();
@@ -121,6 +123,22 @@
}
}
+ChronoShareGui::ChronoShareGui(QString dirPath, QString username, QString sharedFolderName, QWidget* parent)
+ : QDialog(parent)
+ , m_dirPath(dirPath)
+ , m_username(username)
+ , m_sharedFolderName(sharedFolderName)
+{
+ if (m_username.isNull() || m_username == "" || m_sharedFolderName.isNull() ||
+ m_sharedFolderName == "" || m_dirPath.isNull() || m_dirPath == "") {
+ // prompt user to choose folder
+ BOOST_THROW_EXCEPTION(Error("Some error with init info"));
+ }
+ else {
+ startBackend();
+ }
+}
+
void
ChronoShareGui::startBackend(bool restart /*=false*/)
{
@@ -140,9 +158,9 @@
m_dispatcher.reset(); // stop dispatcher ASAP, but after watcher(to prevent triggering callbacks
// on deleted object)
m_ioServiceWork.reset();
- m_ioSerciceManager->handle_stop();
+ m_ioServiceManager->handle_stop();
m_NetworkThread.join();
- delete m_ioSerciceManager;
+ delete m_ioServiceManager;
}
fs::path realPathToFolder(m_dirPath.toStdString());
@@ -162,8 +180,8 @@
bind(&Dispatcher::Did_LocalFile_AddOrModify, m_dispatcher.get(), _1),
bind(&Dispatcher::Did_LocalFile_Delete, m_dispatcher.get(), _1)));
try {
- m_ioSerciceManager = new IoServiceManager(*m_ioService);
- m_NetworkThread = std::thread(&IoServiceManager::run, m_ioSerciceManager);
+ m_ioServiceManager = new IoServiceManager(*m_ioService);
+ m_NetworkThread = std::thread(&IoServiceManager::run, m_ioServiceManager);
}
catch (const std::exception& e) {
_LOG_ERROR("Start IO service or Face failed");
@@ -212,10 +230,9 @@
m_dispatcher.reset();
m_ioServiceWork.reset();
- m_ioSerciceManager->handle_stop();
- m_chronoshareThread.join();
+ m_ioServiceManager->handle_stop();
m_NetworkThread.join();
- delete m_ioSerciceManager;
+ delete m_ioServiceManager;
if (m_httpServer != 0) {
m_httpServer->handle_stop();
@@ -583,8 +600,6 @@
// QSettings settings(m_settingsFilePath, QSettings::NativeFormat);
QSettings settings(QSettings::NativeFormat, QSettings::UserScope, "irl.cs.ucla.edu", "ChronoShare");
- // _LOG_DEBUG(lexical_cast<string>(settings.allKeys()));
-
if (settings.contains("username")) {
m_username = settings.value("username", "admin").toString();
}
diff --git a/gui/chronosharegui.hpp b/gui/chronosharegui.hpp
index f9844da..c23fcf9 100644
--- a/gui/chronosharegui.hpp
+++ b/gui/chronosharegui.hpp
@@ -57,9 +57,21 @@
Q_OBJECT
public:
+ class Error : public std::runtime_error
+ {
+ public:
+ explicit Error(const std::string& what)
+ : std::runtime_error(what)
+ {
+ }
+ };
+
+public:
// constructor
explicit ChronoShareGui(QWidget* parent = 0);
+ explicit ChronoShareGui(QString dirPath, QString username, QString sharedFolderName, QWidget* parent = 0);
+
// destructor
~ChronoShareGui();
@@ -156,7 +168,7 @@
QString m_sharedFolderName; // shared folder name
http::server::server* m_httpServer;
- IoServiceManager* m_ioSerciceManager;
+ IoServiceManager* m_ioServiceManager;
std::thread m_httpServerThread;
QLabel* labelUsername;
@@ -175,7 +187,6 @@
// QString m_settingsFilePath; // settings file path
// QString m_settings;
- std::thread m_chronoshareThread;
std::thread m_NetworkThread;
std::unique_ptr<boost::asio::io_service> m_ioService;
std::unique_ptr<boost::asio::io_service::work> m_ioServiceWork;
diff --git a/tests/unit-tests/dummy-forwarder.cpp b/tests/dummy-forwarder.cpp
similarity index 100%
rename from tests/unit-tests/dummy-forwarder.cpp
rename to tests/dummy-forwarder.cpp
diff --git a/tests/unit-tests/dummy-forwarder.hpp b/tests/dummy-forwarder.hpp
similarity index 100%
rename from tests/unit-tests/dummy-forwarder.hpp
rename to tests/dummy-forwarder.hpp
diff --git a/tests/integrated-tests/chronoshare.cpp b/tests/integrated-tests/chronoshare.cpp
new file mode 100644
index 0000000..415f24d
--- /dev/null
+++ b/tests/integrated-tests/chronoshare.cpp
@@ -0,0 +1,281 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2017 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+#define BOOST_TEST_MAIN 1
+#define BOOST_TEST_DYN_LINK 1
+#define BOOST_TEST_MODULE ChronoShare Integrated Tests (ChronoShare)
+
+#include "gui/chronosharegui.hpp"
+#include "test-common.hpp"
+#include "dummy-forwarder.hpp"
+
+#include <boost/make_shared.hpp>
+#include <boost/test/unit_test.hpp>
+#include <boost/bind.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
+#include <boost/lexical_cast.hpp>
+#include <thread>
+#include <chrono>
+
+namespace ndn {
+namespace chronoshare {
+namespace tests {
+
+using namespace std;
+namespace fs = boost::filesystem;
+
+_LOG_INIT(Test.Integrated.ChronoShare);
+
+class ChronoShareFixture : public IdentityManagementFixture
+{
+public:
+ ChronoShareFixture()
+ : forwarder(m_io, m_keyChain)
+ , folder("sharefolder")
+ , dir1(fs::path(fs::path(UNIT_TEST_CONFIG_PATH) / "sharefolder1"))
+ , dir2(fs::path(fs::path(UNIT_TEST_CONFIG_PATH) / "sharefolder2"))
+ , argc(0)
+ {
+
+ if (fs::exists(dir1)) {
+ fs::remove_all(dir1);
+ }
+
+ if (fs::exists(dir2)) {
+ fs::remove_all(dir2);
+ }
+
+ fs::create_directory(dir1);
+ fs::create_directory(dir2);
+ }
+
+ ~ChronoShareFixture()
+ {
+ //delete app;
+ // cleanup
+ if (fs::exists(dir1)) {
+ fs::remove_all(dir1);
+ }
+
+ // cleanup
+ if (fs::exists(dir2)) {
+ fs::remove_all(dir2);
+ }
+ }
+
+ void
+ advanceClocks(std::chrono::seconds delay)
+ {
+ std::chrono::milliseconds step = delay;
+ step /= 50;
+ for (int i = 0; i < 50; ++i) {
+ std::this_thread::sleep_for(step);
+ m_io.poll();
+ m_io.reset();
+ }
+ }
+
+ void
+ create_file(const fs::path& ph, const std::string& contents)
+ {
+ std::ofstream f(ph.string().c_str());
+ if (!f) {
+ abort();
+ }
+ if (!contents.empty()) {
+ f << contents;
+ }
+ }
+
+ void
+ run()
+ {
+ std::this_thread::sleep_for(std::chrono::seconds(5));
+
+ _LOG_DEBUG("======created files===========");
+ create_file(dir1 / folder / "test.txt", "hello");
+
+ std::this_thread::sleep_for(std::chrono::seconds(10));
+
+
+ BOOST_REQUIRE_MESSAGE(fs::exists(dir2 / folder / "test.txt"), "user1 failed to notify user2 about test.txt");
+ BOOST_CHECK_EQUAL(fs::file_size(dir1 / folder / "test.txt"), fs::file_size(dir2 / folder / "test.txt"));
+
+
+ fs::path subdir1 = dir1 / folder / "sub";
+ fs::path subdir2 = dir2 / folder / "sub";
+ fs::create_directory(subdir1);
+ for (int i = 0; i < 10; i++) {
+ string filename = boost::lexical_cast<string>(i);
+ create_file(subdir1 / filename.c_str(), boost::lexical_cast<string>(i));
+ }
+
+ std::this_thread::sleep_for(std::chrono::seconds(10));
+ for (int i = 0; i < 10; i++) {
+ string filename = boost::lexical_cast<string>(i);
+ BOOST_REQUIRE_MESSAGE(fs::exists(subdir2 / filename), "user1 failed to notify user2 about"<< filename);
+ }
+
+ //=========check copy file to sub directory==========
+ fs::create_directory(dir1 / folder / "sub1");
+ fs::path subsubdir1 = dir1 / folder / "sub1" / "sub2";
+ fs::path subsubdir2 = dir2 / folder / "sub1" / "sub2";
+ fs::copy_directory(subdir1, subsubdir1);
+ for (int i = 0; i < 5; i++) {
+ string filename = boost::lexical_cast<string>(i);
+ fs::copy(subdir1 / filename.c_str(), subsubdir1 / filename.c_str());
+ }
+
+ std::this_thread::sleep_for(std::chrono::seconds(10));
+ // test.txt
+ // sub/0..9
+ // sub1/sub2/0..4
+ for (int i = 0; i < 5; i++) {
+ string filename = boost::lexical_cast<string>(i);
+ BOOST_REQUIRE_MESSAGE(fs::exists(subsubdir2 / filename), "user1 failed to notify user2 about"<< filename);
+ }
+
+ // =============== check remove files =========================
+ for (int i = 0; i < 7; i++) {
+ string filename = boost::lexical_cast<string>(i);
+ fs::remove(subdir1 / filename.c_str());
+ }
+
+ std::this_thread::sleep_for(std::chrono::seconds(10));
+ // test.txt
+ // sub/7..9
+ // sub1/sub2/0..4
+ for (int i = 0; i < 10; i++) {
+ string filename = boost::lexical_cast<string>(i);
+ if (i < 7)
+ BOOST_REQUIRE_MESSAGE(!fs::exists(subdir2 / filename), "user1 failed to notify user2 about"<< filename);
+ else
+ BOOST_REQUIRE_MESSAGE(fs::exists(subdir2 / filename), "user1 failed to notify user2 about"<< filename);
+ }
+
+ // =================== check remove files again, remove the whole dir this time
+ // ===================
+ // before remove check
+ for (int i = 0; i < 5; i++) {
+ string filename = boost::lexical_cast<string>(i);
+ BOOST_REQUIRE_MESSAGE(fs::exists(subsubdir2 / filename), "user1 failed to notify user2 about"<< filename);
+ }
+ fs::remove_all(subsubdir1);
+
+ std::this_thread::sleep_for(std::chrono::seconds(10));
+ // test.txt
+ // sub/7..9
+ BOOST_REQUIRE_MESSAGE(!fs::exists(subsubdir2), "user1 failed to notify user2 about sub1/sub2");
+
+ // =================== check rename files =======================
+ for (int i = 7; i < 10; i++) {
+ string filename = boost::lexical_cast<string>(i);
+ fs::rename(subdir1 / filename.c_str(), dir1 / folder / filename.c_str());
+ }
+ std::this_thread::sleep_for(std::chrono::seconds(10));
+ // test.txt
+ // 7
+ // 8
+ // 9
+ // sub
+ for (int i = 7; i < 10; i++) {
+ string filename = boost::lexical_cast<string>(i);
+
+ BOOST_REQUIRE_MESSAGE(!fs::exists(subdir2 / filename), "user1 failed to notify user2 about"<< filename);
+ BOOST_REQUIRE_MESSAGE(fs::exists(dir2 / folder / filename), "user1 failed to notify user2 about"<< filename);
+ }
+
+ create_file(dir1 / folder / "add-removal-check.txt", "add-removal-check");
+ std::this_thread::sleep_for(std::chrono::seconds(4));
+ BOOST_REQUIRE_MESSAGE(fs::exists(dir2 / folder / "add-removal-check.txt"),
+ "user1 failed to notify user2 about add-removal-check.txt");
+
+ fs::remove(dir1 / folder / "add-removal-check.txt");
+ std::this_thread::sleep_for(std::chrono::seconds(4));
+ BOOST_REQUIRE_MESSAGE(!fs::exists(dir2 / folder / "add-removal-check.txt"),
+ "user1 failed to notify user2 about add-removal-check.txt");
+
+ create_file(dir1 / folder / "add-removal-check.txt", "add-removal-check");
+ std::this_thread::sleep_for(std::chrono::seconds(4));
+ BOOST_REQUIRE_MESSAGE(fs::exists(dir2 / folder / "add-removal-check.txt"),
+ "user1 failed to notify user2 about add-removal-check.txt");
+
+ fs::remove(dir1 / folder / "add-removal-check.txt");
+ std::this_thread::sleep_for(std::chrono::seconds(4));
+ BOOST_REQUIRE_MESSAGE(!fs::exists(dir2 / folder / "add-removal-check.txt"),
+ "user1 failed to notify user2 about add-removal-check.txt");
+
+ create_file(dir1 / folder / "add-removal-check.txt", "add-removal-check");
+ std::this_thread::sleep_for(std::chrono::seconds(4));
+ BOOST_REQUIRE_MESSAGE(fs::exists(dir2 / folder / "add-removal-check.txt"),
+ "user1 failed to notify user2 about add-removal-check.txt");
+
+ fs::remove(dir1 / folder / "add-removal-check.txt");
+ std::this_thread::sleep_for(std::chrono::seconds(4));
+ BOOST_REQUIRE_MESSAGE(!fs::exists(dir2 / folder / "add-removal-check.txt"),
+ "user1 failed to notify user2 about add-removal-check.txt");
+
+ _LOG_DEBUG("======finish thread===========");
+ }
+
+public:
+ DummyForwarder forwarder;
+ std::string folder;
+ fs::path dir1;
+ fs::path dir2;
+
+ int argc;
+ //TestApp* app;
+};
+
+BOOST_FIXTURE_TEST_SUITE(TestChronoShare, ChronoShareFixture)
+
+BOOST_AUTO_TEST_CASE(Chronoshare)
+{
+ QApplication app(argc, nullptr);
+
+ // do not quit when last window closes
+ app.setQuitOnLastWindowClosed(false);
+ // invoke gui
+ ndn::chronoshare::ChronoShareGui gui1(QString::fromStdString(dir1.generic_string()),
+ QString::fromStdString("user1"),
+ QString::fromStdString("sharefolder"));
+
+ // invoke gui
+ ndn::chronoshare::ChronoShareGui gui2(QString::fromStdString(dir2.generic_string()),
+ QString::fromStdString("user2"),
+ QString::fromStdString("sharefolder"));
+
+ QTimer::singleShot(95000, &app, SLOT(quit()));
+
+ _LOG_DEBUG("run thread");
+ std::thread workThread(boost::bind(&ChronoShareFixture::run, this));
+
+ app.exec();
+ workThread.join();
+ _LOG_DEBUG("thread finished");
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace chronoshare
+} // namespace ndn
diff --git a/tests/integrated-tests/fs-watcher.t.cpp b/tests/integrated-tests/fs-watcher.cpp
similarity index 95%
rename from tests/integrated-tests/fs-watcher.t.cpp
rename to tests/integrated-tests/fs-watcher.cpp
index 05f9764..c29da56 100644
--- a/tests/integrated-tests/fs-watcher.t.cpp
+++ b/tests/integrated-tests/fs-watcher.cpp
@@ -17,6 +17,9 @@
*
* See AUTHORS.md for complete list of ChronoShare authors and contributors.
*/
+#define BOOST_TEST_MAIN 1
+#define BOOST_TEST_DYN_LINK 1
+#define BOOST_TEST_MODULE ChronoShare Integrated Tests (FsWatcher)
#include "fs-watcher.hpp"
#include "test-common.hpp"
@@ -32,8 +35,7 @@
#include <iostream>
#include <thread>
#include <set>
-
-#include "fs-watcher.t.hpp"
+#include <QtWidgets>
using namespace std;
namespace fs = boost::filesystem;
@@ -44,14 +46,6 @@
namespace chronoshare {
namespace tests {
-fsWatcherApp::fsWatcherApp(int& argc, char** argv)
- : QCoreApplication(argc, argv)
-{
- connect(this, SIGNAL(stopApp()), this, SLOT(quit()), Qt::QueuedConnection);
-}
-
-fsWatcherApp::~fsWatcherApp() = default;
-
class TestFSWatcherFixture : public IdentityManagementFixture
{
public:
@@ -115,19 +109,21 @@
void
run()
{
- app = new fsWatcherApp(argc, nullptr);
+ QApplication app(argc, nullptr);
new FsWatcher(m_io, dir.string().c_str(),
std::bind(&TestFSWatcherFixture::onChange, this, std::ref(files), _1),
std::bind(&TestFSWatcherFixture::onDelete, this, std::ref(files), _1),
- app);
- app->exec();
+ &app);
+
+ QTimer::singleShot(21000, &app, SLOT(quit()));
+ app.exec();
}
public:
fs::path dir;
set<string> files;
int argc;
- fsWatcherApp* app;
+ //fsWatcherApp* app;
};
BOOST_FIXTURE_TEST_SUITE(TestFsWatcher, TestFSWatcherFixture)
@@ -255,7 +251,7 @@
this->advanceClocks(std::chrono::seconds(2));
BOOST_CHECK(files.find("add-removal-check.txt") == files.end());
- emit app->stopApp();
+ //emit app->stopApp();
workThread.join();
}
diff --git a/tests/integrated-tests/fs-watcher.t.hpp b/tests/integrated-tests/fs-watcher.t.hpp
deleted file mode 100644
index 40c524b..0000000
--- a/tests/integrated-tests/fs-watcher.t.hpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017, Regents of the University of California.
- *
- * This file is part of ChronoShare, a decentralized file sharing application over NDN.
- *
- * ChronoShare is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation, either
- * version 3 of the License, or (at your option) any later version.
- *
- * ChronoShare is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received copies of the GNU General Public License along with
- * ChronoShare, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ChronoShare authors and contributors.
- */
-
-#include <QtWidgets>
-
-namespace ndn {
-namespace chronoshare {
-namespace tests {
-
-class fsWatcherApp : public QCoreApplication
-{
-Q_OBJECT
-
-signals:
- void
- stopApp();
-
-public:
- fsWatcherApp(int& argc, char** argv);
- ~fsWatcherApp();
-};
-
-} // namespace tests
-} // namespace chronoshare
-} // namespace ndn
diff --git a/tests/integrated-tests/wscript b/tests/integrated-tests/wscript
new file mode 100644
index 0000000..3898a81
--- /dev/null
+++ b/tests/integrated-tests/wscript
@@ -0,0 +1,15 @@
+from waflib import Utils
+
+top = '..'
+
+def build(bld):
+
+ for i in bld.path.ant_glob(['*.cpp']):
+ name = str(i)[str.rfind(str(i),'/'):-len(".cpp")]
+ bld(features='qt5 cxx cxxprogram',
+ target=name,
+ source=[i],
+ use='chronoshare core-objects adhoc http_server chronoshare_gui boost-tests-base QT5CORE QT5WIDGETS',
+ includes='..',
+ defines=['UNIT_TEST_CONFIG_PATH=\"%s/tmp-files/\"' % (bld.bldnode)],
+ install_path=None)
diff --git a/tests/wscript b/tests/wscript
index e900761..d624a7c 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -8,32 +8,37 @@
if not bld.env['WITH_TESTS']:
return
+ # precompiled headers (if enabled)
bld(features='cxx',
- target='tests-base',
name='tests-base',
+ target='tests-base',
+ headers=['boost-test.hpp'],
+ use='NDN_CXX BOOST',
+ includes='.')
+
+ # core modules that can be shared between unit and integrated tests
+ bld(features="cxx",
+ target="boost-tests-base",
source=bld.path.ant_glob(['*.cpp'], excl='main.cpp'),
- use='core-objects',
- includes='.. .',
- defines='UNIT_TEST_CONFIG_PATH=\"%s/tmp-files/\"' % (bld.bldnode)
- )
+ use='core-objects tests-base BOOST',
+ includes='.',
+ defines=['UNIT_TEST_CONFIG_PATH=\"%s/tmp-files/\"' % (bld.bldnode)],
+ install_path=None)
- for module, name in {"unit": "Unit Tests",
- "integrated": "Integrated Tests"}.items():
- bld(target='%s-tests-main' % module,
- name='%s-tests-main' % module,
- features='cxx',
- use='core-objects BOOST',
- source='main.cpp',
- defines=['BOOST_TEST_MODULE=%s' % name]
- )
+ bld(target='unit-tests-main',
+ name='unit-tests-main',
+ features='cxx',
+ use='tests-base boost-tests-base BOOST',
+ source='main.cpp',
+ defines=['BOOST_TEST_MODULE=Unit Test'])
- tests = bld.program(
- target='../%s-tests' % module,
- features='qt5 cxx cxxprogram',
- moc='' if module == 'unit' else 'integrated-tests/fs-watcher.t.hpp',
- source=bld.path.ant_glob(['%s-tests/*.cpp' % module]),
- use='chronoshare core-objects fs-watcher tests-base %s-tests-main QT5CORE QT5WIDGETS' % module,
- install_path=None,
- defines=['UNIT_TEST_CONFIG_PATH=\"%s/tmp-files/\"' % (bld.bldnode)],
- includes='.. ../src .',
- )
+ unit_tests=bld(
+ target='../unit-tests',
+ features='cxx cxxprogram',
+ source=bld.path.ant_glob(['unit-tests/*.cpp']),
+ use='core-objects adhoc chronoshare http_server chronoshare_gui unit-tests-main',
+ install_path=None,
+ defines=['UNIT_TEST_CONFIG_PATH=\"%s/tmp-files/\"' % (bld.bldnode)],
+ includes='.. ../src .')
+
+ bld.recurse('integrated-tests')
\ No newline at end of file
diff --git a/wscript b/wscript
index 78b5cd3..5199d2c 100644
--- a/wscript
+++ b/wscript
@@ -116,21 +116,33 @@
source = bld.path.ant_glob(['server/*.cpp']),
includes = "server src .",
use = 'BOOST QT5CORE',
+ export_includes="server"
)
- qt = bld(
- target = "ChronoShare",
- features = "qt5 cxx cxxprogram html_resources",
+ chronoshare_gui = bld(
+ target = "chronoshare_gui",
+ features = "qt5 cxx",
defines = "WAF",
- source = bld.path.ant_glob(['gui/*.cpp', 'gui/images.qrc']),
+ source = bld.path.ant_glob(['gui/*.cpp'], excl='gui/main.cpp'),
includes = "fs-watcher gui src adhoc server . ",
use = "fs-watcher chronoshare http_server QT5CORE QT5GUI QT5WIDGETS",
moc = "gui/chronosharegui.hpp",
+ export_includes='gui',
+ )
+
+ gui = bld(
+ target = "ChronoShare",
+ features = "qt5 cxx cxxprogram html_resources",
+ defines = "WAF",
+ source = bld.path.ant_glob(['gui/main.cpp']),
+ includes = "fs-watcher gui src adhoc server . ",
+ use = "fs-watcher chronoshare http_server chronoshare_gui QT5CORE QT5GUI QT5WIDGETS",
html_resources = bld.path.find_dir("gui/html").ant_glob([
'**/*.js', '**/*.png', '**/*.css',
'**/*.html', '**/*.gif', '**/*.ico'
]),
- )
+ export_includes='gui',
+ )
# if Utils.unversioned_sys_platform() == "darwin":
# app_plist = '''<?xml version="1.0" encoding="UTF-8"?>
@@ -188,14 +200,14 @@
defines = "WAF",
source = 'cmd/csd.cpp',
moc = 'cmd/csd.hpp',
- use = "fs-watcher chronoshare http_server QT5CORE",
+ use = "fs-watcher chronoshare http_server chronoshare_gui QT5CORE",
)
dump_db = bld(
target = "dump-db",
features = "cxx cxxprogram",
source = bld.path.ant_glob(['cmd/dump-db.cpp']),
- use = "fs-watcher chronoshare http_server QT5CORE",
+ use = "fs-watcher chronoshare http_server chronoshare_gui QT5CORE",
)
bld.recurse('tests');