summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-02-12 12:18:02 (GMT)
committerKevin Smith <kevin.smith@isode.com>2015-02-16 16:47:07 (GMT)
commit45eec1d00d5b9fabee1ce44f7dd8addd7d0cf6b3 (patch)
tree5483798e909c8d552acdcb73d114fe3f1ee73534
parent40d02d4969bb4fd3c0ec8a6268df1b87c6b9e667 (diff)
downloadswift-45eec1d00d5b9fabee1ce44f7dd8addd7d0cf6b3.zip
swift-45eec1d00d5b9fabee1ce44f7dd8addd7d0cf6b3.tar.bz2
Run FileTransferTest correctly as part of the system integration tests
If Scons is configured to run system unit tests, it will run FileTransferTest and test for working IBB transfer, direct S5B transfer and proxied S5B transfer. Test-Information: Tested ./scons test=all is working on Linux and OS X. Change-Id: Id70c9e1e9db9c897d9bfc7dd03b874afe5262207
-rw-r--r--Swiften/QA/FileTransferTest/FileTransferTest.cpp48
-rw-r--r--Swiften/QA/FileTransferTest/SConscript3
2 files changed, 41 insertions, 10 deletions
diff --git a/Swiften/QA/FileTransferTest/FileTransferTest.cpp b/Swiften/QA/FileTransferTest/FileTransferTest.cpp
index 764dffb..2d2d6c8 100644
--- a/Swiften/QA/FileTransferTest/FileTransferTest.cpp
+++ b/Swiften/QA/FileTransferTest/FileTransferTest.cpp
@@ -6,6 +6,7 @@
#include <fstream>
+#include <boost/algorithm/string.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/filesystem.hpp>
@@ -299,19 +300,46 @@ int main(int argc, char** argv) {
std::vector<std::pair<int, int> > failedTestPairs;
std::cout << "Swiften File-Transfer Connectivity Test Suite" << std::endl;
if (argc == 1) {
- for (int n = 0; n < (1 << 7); n++) {
- int senderCandidates = n & 0xF;
- int receiverCandidates = (n >> 4) & 0xF;
- std::cout << "Run test " << n + 1 << " of " << (1 << 7) << ", (" << senderCandidates << ", " << receiverCandidates << ")" << std::endl;
- if (!runTest(senderCandidates, receiverCandidates)) {
- failedTests++;
- failedTestPairs.push_back(std::pair<int, int>(senderCandidates, receiverCandidates));
+ if (getenv("SWIFT_FILETRANSFERTEST_CONFIG")) {
+ // test configuration described in SWIFT_FILETRANSFERTEST_CONFIG environment variable, e.g. "1:1|2:2"
+ std::vector<std::string> configurations;
+ std::string configs_env = std::string(getenv("SWIFT_FILETRANSFERTEST_CONFIG"));
+ boost::split(configurations, configs_env, boost::is_any_of("|"));
+ foreach(const std::string& config, configurations) {
+ std::vector<std::string> split_config;
+ boost::split(split_config, config, boost::is_any_of(":"));
+ assert(split_config.size() == 2);
+
+ int senderCandidates = atoi(split_config[0].c_str());
+ int receiverCandidates = atoi(split_config[1].c_str());
+
+ if (!runTest(senderCandidates, receiverCandidates)) {
+ failedTests++;
+ failedTestPairs.push_back(std::pair<int, int>(senderCandidates, receiverCandidates));
+ }
+ }
+
+ typedef std::pair<int, int> IntPair;
+ foreach(IntPair failedTest, failedTestPairs) {
+ std::cout << "Failed test: " << "( " << failedTest.first << ", " << failedTest.second << ") " << std::endl;
}
}
+ else {
+ // test all configurations
+ for (int n = 0; n < (1 << 7); n++) {
+ int senderCandidates = n & 0xF;
+ int receiverCandidates = (n >> 4) & 0xF;
+ std::cout << "Run test " << n + 1 << " of " << (1 << 7) << ", (" << senderCandidates << ", " << receiverCandidates << ")" << std::endl;
+ if (!runTest(senderCandidates, receiverCandidates)) {
+ failedTests++;
+ failedTestPairs.push_back(std::pair<int, int>(senderCandidates, receiverCandidates));
+ }
+ }
- typedef std::pair<int, int> IntPair;
- foreach(IntPair failedTest, failedTestPairs) {
- std::cout << "Failed test: " << "( " << failedTest.first << ", " << failedTest.second << ") " << std::endl;
+ typedef std::pair<int, int> IntPair;
+ foreach(IntPair failedTest, failedTestPairs) {
+ std::cout << "Failed test: " << "( " << failedTest.first << ", " << failedTest.second << ") " << std::endl;
+ }
}
}
else if (argc == 3) {
diff --git a/Swiften/QA/FileTransferTest/SConscript b/Swiften/QA/FileTransferTest/SConscript
index d17b12a..3275985 100644
--- a/Swiften/QA/FileTransferTest/SConscript
+++ b/Swiften/QA/FileTransferTest/SConscript
@@ -13,5 +13,8 @@ if env["TEST"] :
elif os.environ.get(i, "") :
myenv["ENV"][i] = os.environ[i]
+ # test in-band transfers, direct SOCKS5 bytestream transfers and proxied SOCKS5 bytestream transfers
+ myenv["ENV"]["SWIFT_FILETRANSFERTEST_CONFIG"] = "1:1|2:2|4:4"
+
tester = myenv.Program("FileTransferTest", ["FileTransferTest.cpp"])
myenv.Test(tester, "system")