summaryrefslogtreecommitdiff
path: root/cpp/test/IceStorm/single
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2016-11-25 13:13:22 +0100
committerBenoit Foucher <benoit@zeroc.com>2016-11-25 13:13:22 +0100
commitdcdc32af1fced49d80a8ccd93230e15d91ab45d8 (patch)
treeeb69e2555fbd54496fce8a33f4dd610e1473ff51 /cpp/test/IceStorm/single
parentC# IceSSL/configuration log expired certificate exceptions. (diff)
downloadice-dcdc32af1fced49d80a8ccd93230e15d91ab45d8.tar.bz2
ice-dcdc32af1fced49d80a8ccd93230e15d91ab45d8.tar.xz
ice-dcdc32af1fced49d80a8ccd93230e15d91ab45d8.zip
Refactored test scripts
Diffstat (limited to 'cpp/test/IceStorm/single')
-rw-r--r--cpp/test/IceStorm/single/0.db/.gitignore1
-rw-r--r--cpp/test/IceStorm/single/1.db/.gitignore1
-rw-r--r--cpp/test/IceStorm/single/2.db/.gitignore1
-rw-r--r--cpp/test/IceStorm/single/Publisher.cpp4
-rw-r--r--cpp/test/IceStorm/single/Subscriber.cpp3
-rw-r--r--cpp/test/IceStorm/single/db/.gitignore1
-rwxr-xr-xcpp/test/IceStorm/single/run.py89
-rw-r--r--cpp/test/IceStorm/single/test.py39
8 files changed, 44 insertions, 95 deletions
diff --git a/cpp/test/IceStorm/single/0.db/.gitignore b/cpp/test/IceStorm/single/0.db/.gitignore
deleted file mode 100644
index 72e8ffc0db8..00000000000
--- a/cpp/test/IceStorm/single/0.db/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/cpp/test/IceStorm/single/1.db/.gitignore b/cpp/test/IceStorm/single/1.db/.gitignore
deleted file mode 100644
index 72e8ffc0db8..00000000000
--- a/cpp/test/IceStorm/single/1.db/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/cpp/test/IceStorm/single/2.db/.gitignore b/cpp/test/IceStorm/single/2.db/.gitignore
deleted file mode 100644
index 72e8ffc0db8..00000000000
--- a/cpp/test/IceStorm/single/2.db/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/cpp/test/IceStorm/single/Publisher.cpp b/cpp/test/IceStorm/single/Publisher.cpp
index 8c06e428955..a88dff82add 100644
--- a/cpp/test/IceStorm/single/Publisher.cpp
+++ b/cpp/test/IceStorm/single/Publisher.cpp
@@ -9,6 +9,7 @@
#include <Ice/Ice.h>
#include <IceStorm/IceStorm.h>
+#include <TestCommon.h>
#include <Single.h>
using namespace std;
@@ -70,7 +71,8 @@ main(int argc, char* argv[])
try
{
- communicator = initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/single/Subscriber.cpp b/cpp/test/IceStorm/single/Subscriber.cpp
index f2ee78ee554..7b4c0a17351 100644
--- a/cpp/test/IceStorm/single/Subscriber.cpp
+++ b/cpp/test/IceStorm/single/Subscriber.cpp
@@ -251,7 +251,8 @@ main(int argc, char* argv[])
try
{
- communicator = initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/single/db/.gitignore b/cpp/test/IceStorm/single/db/.gitignore
deleted file mode 100644
index 39af5887579..00000000000
--- a/cpp/test/IceStorm/single/db/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-# Dummy file, so that git retains this otherwise empty directory.
diff --git a/cpp/test/IceStorm/single/run.py b/cpp/test/IceStorm/single/run.py
deleted file mode 100755
index 162854b9084..00000000000
--- a/cpp/test/IceStorm/single/run.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-import time
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceStormUtil
-
-publisher = os.path.join(os.getcwd(), TestUtil.getTestExecutable("publisher"))
-subscriber = os.path.join(os.getcwd(), TestUtil.getTestExecutable("subscriber"))
-
-#
-# Make sure IceStorm and the subscriber use the same buffer size for
-# sending/receiving datagrams. This ensures the test works with bogus
-# OS configurations where the reicever buffer size is smaller than the
-# send buffer size (causing the received messages to be
-# truncated). See also bug #6070.
-#
-iceStormArgs = " --Ice.UDP.SndSize=4096"
-subscriberArgs = " --Ice.UDP.RcvSize=4096"
-
-targets = []
-if TestUtil.appverifier:
- targets = [TestUtil.getIceBox(), publisher, subscriber, TestUtil.getIceBoxAdmin(), TestUtil.getIceStormAdmin()]
- TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd())
-
-def dotest(type):
- icestorm = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, additional=iceStormArgs)
- icestorm.start()
-
- sys.stdout.write("creating topic... ")
- sys.stdout.flush()
- icestorm.admin("create single")
- print("ok")
-
- sys.stdout.write("starting subscriber... ")
- sys.stdout.flush()
- subscriberProc = TestUtil.startServer(subscriber, icestorm.reference() + subscriberArgs + " " + type, count = 3)
- print("ok")
-
- #
- # Start the publisher. This should publish 10 events which eventually
- # causes subscriber to terminate.
- #
- sys.stdout.write("starting publisher... ")
- sys.stdout.flush()
- publisherProc = TestUtil.startClient(publisher, icestorm.reference(), startReader = False)
- print("ok")
- publisherProc.startReader()
-
- subscriberProc.waitTestSuccess()
- publisherProc.waitTestSuccess()
-
- #
- # Destroy the topic.
- #
- sys.stdout.write("destroy topic... ")
- sys.stdout.flush()
- icestorm.admin("destroy single")
- print("ok")
-
- #
- # Shutdown icestorm.
- #
- icestorm.stop()
-
-dotest("persistent")
-dotest("transient")
-dotest("replicated")
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd([targets], cwd = os.getcwd())
-
-sys.exit(0)
diff --git a/cpp/test/IceStorm/single/test.py b/cpp/test/IceStorm/single/test.py
new file mode 100644
index 00000000000..b4e5848e2b0
--- /dev/null
+++ b/cpp/test/IceStorm/single/test.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+#
+# Make sure IceStorm and the subscriber use the same buffer size for
+# sending/receiving datagrams. This ensures the test works with bogus
+# OS configurations where the reicever buffer size is smaller than the
+# send buffer size (causing the received messages to be
+# truncated). See also bug #6070.
+#
+props = { "Ice.UDP.SndSize" : 4096, "Ice.Warn.Dispatch" : 0 }
+persistent = IceStorm(props = props)
+transient = IceStorm(props = props, transient=True)
+replicated = [ IceStorm(replica=i, nreplicas=3, props = props) for i in range(0,3) ]
+
+sub = Subscriber(args=["{testcase.parent.name}"], props = { "Ice.UDP.RcvSize" : 4096 }, readyCount=3)
+pub = Publisher(args=["{testcase.parent.name}"])
+
+class IceStormSingleTestCase(IceStormTestCase):
+
+ def setupClientSide(self, current):
+ self.runadmin(current, "create single")
+
+ def teardownClientSide(self, current, success):
+ self.runadmin(current, "destroy single")
+ self.shutdown(current)
+
+TestSuite(__file__, [
+ IceStormSingleTestCase("persistent", icestorm=persistent, client=ClientServerTestCase(client=pub, server=sub)),
+ IceStormSingleTestCase("transient", icestorm=transient, client=ClientServerTestCase(client=pub, server=sub)),
+ IceStormSingleTestCase("replicated", icestorm=replicated, client=ClientServerTestCase(client=pub, server=sub)),
+], multihost=False)