Example #1
0
File: run.py Project: citms/freeze
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# **********************************************************************

import os, sys

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", "FreezeTestUtil.py")) ]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")
sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

dbdir = os.path.join(os.getcwd(), "db")
TestUtil.cleanDbDir(dbdir)

testOptions = ' --Freeze.Warn.Deadlocks=0 --Freeze.DbEnv.db.DbHome="%s/db" --Ice.Config="%s/config" ' % (os.getcwd(), os.getcwd())

TestUtil.clientServerTest(testOptions, testOptions)
Example #2
0
File: run.py Project: citms/freeze
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# **********************************************************************

import os, sys

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", "FreezeTestUtil.py"))
]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")
sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

dbdir = os.path.join(os.getcwd(), "db")
TestUtil.cleanDbDir(dbdir)

if TestUtil.appverifier:
    TestUtil.setAppVerifierSettings([client])

client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
TestUtil.simpleTest(client, ' --Freeze.Warn.Rollback=0 "%s"' % os.getcwd())

if TestUtil.appverifier:
    TestUtil.appVerifierAfterTestEnd([client])
Example #3
0
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", "FreezeTestUtil.py")) ]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")
sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

#
# Clean the contents of the database directory.
#
dbdir = os.path.join(os.getcwd(), "db")
TestUtil.cleanDbDir(dbdir)

sys.stdout.write("starting populate... ")
sys.stdout.flush()
populateProc = TestUtil.startClient("test.Freeze.complex.Client", ' --dbdir "%s" populate' % os.getcwd(),
                                    startReader=False)
print("ok")
populateProc.startReader()

populateProc.waitTestSuccess()

sys.stdout.write("starting verification client... ")
sys.stdout.flush()
clientProc = TestUtil.startClient("test.Freeze.complex.Client", ' --dbdir "%s" validate' % os.getcwd(), startReader=False)

print("ok")
Example #4
0
#
# **********************************************************************

import os, sys, re, shutil

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", "FreezeTestUtil.py")) ]
if len(path) == 0:
    raise RuntimeError("can't find toplevel os.getcwd()!")
sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

transformdb = TestUtil.getFreezeExe("transformdb")

if TestUtil.appverifier:
    TestUtil.setAppVerifierSettings([transformdb])

dbdir = os.path.join(os.getcwd(), "db")
TestUtil.cleanDbDir(dbdir)

check_dbdir = os.path.join(os.getcwd(), "db_check")
if os.path.exists(check_dbdir):
    shutil.rmtree(check_dbdir)
os.mkdir(check_dbdir)

tmp_dbdir = os.path.join(os.getcwd(), "db_tmp")
if os.path.exists(tmp_dbdir):
    shutil.rmtree(tmp_dbdir)
Example #5
0
File: run.py Project: citms/freeze
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", "FreezeTestUtil.py"))
]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")
sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

#
# Clean the contents of the database directory.
#
dbdir = os.path.join(os.getcwd(), "db")
TestUtil.cleanDbDir(dbdir)

sys.stdout.write("starting populate... ")
sys.stdout.flush()
populateProc = TestUtil.startClient("test.Freeze.complex.Client",
                                    ' --dbdir "%s" populate' % os.getcwd(),
                                    startReader=False)
print("ok")
populateProc.startReader()

populateProc.waitTestSuccess()

sys.stdout.write("starting verification client... ")
sys.stdout.flush()
clientProc = TestUtil.startClient("test.Freeze.complex.Client",
                                  ' --dbdir "%s" validate' % os.getcwd(),
Example #6
0
    os.path.abspath(p) for p in path
    if os.path.exists(os.path.join(p, "scripts", "FreezeTestUtil.py"))
]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")
sys.path.append(os.path.join(path[0], "scripts"))

import FreezeTestUtil as TestUtil

testdir = os.path.dirname(os.path.abspath(__file__))

#
# Clean the contents of the database directory.
#
dbdir = os.path.join(os.getcwd(), "db")
TestUtil.cleanDbDir(dbdir)

client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))

if TestUtil.appverifier:
    TestUtil.setAppVerifierSettings([client])

sys.stdout.write("starting populate... ")
sys.stdout.flush()
populateProc = TestUtil.startClient(client,
                                    ' --dbdir "%s" populate' % os.getcwd(),
                                    startReader=False)
print("ok")
populateProc.startReader()
populateProc.waitTestSuccess()
Example #7
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", "FreezeTestUtil.py")) ]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")
sys.path.append(os.path.join(path[0], "scripts"))

import FreezeTestUtil as TestUtil

testdir = os.path.dirname(os.path.abspath(__file__))

#
# Clean the contents of the database directory.
#
dbdir = os.path.join(os.getcwd(), "db")
TestUtil.cleanDbDir(dbdir)

client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))

if TestUtil.appverifier:
    TestUtil.setAppVerifierSettings([client])

sys.stdout.write("starting populate... ")
sys.stdout.flush()
populateProc = TestUtil.startClient(client, ' --dbdir "%s" populate' % os.getcwd(), startReader = False)
print("ok")
populateProc.startReader()
populateProc.waitTestSuccess()

sys.stdout.write("starting verification client... ")
sys.stdout.flush()
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# **********************************************************************

import os, sys, imp

sys.path.append(os.path.join(os.path.dirname(__file__), "scripts"))
import FreezeTestUtil as TestUtil

testGroups = []

languages = ["cpp", "java"]

for d in languages:

    filename = os.path.abspath(os.path.join(os.path.dirname(__file__), d, "allTests.py"))
    f = open(filename, "r")
    current_mod = imp.load_module("allTests", f, filename, (".py", "r", imp.PY_SOURCE))
    f.close()

    tests = []

    tests = [(os.path.join(d, "test", x), y) for x, y in current_mod.tests]
    if len(tests) > 0:
        testGroups.extend(tests)

TestUtil.run(testGroups, root=True)
Example #9
0
File: run.py Project: citms/freeze
import os, sys

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", "FreezeTestUtil.py")) ]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")
sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

dbdir = os.path.join(os.getcwd(), "db")
TestUtil.cleanDbDir(dbdir)

sys.stdout.write("testing Freeze file lock... ")
sys.stdout.flush()

client = os.path.join("test.Freeze.fileLock.Client")
clientFail = os.path.join("test.Freeze.fileLock.ClientFail")

clientExe = TestUtil.startClient(client, "", None, None, False)
clientExe.expect('File lock acquired.\.*')

clientFailExe = TestUtil.startClient(clientFail, "", None, None, False)
clientFailExe.expect('File lock not acquired.')
clientFailExe.wait()

# send some output to client to terminate it.
Example #10
0
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# **********************************************************************

import os, sys

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", "FreezeTestUtil.py")) ]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")
sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

dbdir = os.path.join(os.getcwd(), "db")
TestUtil.cleanDbDir(dbdir)

sys.stdout.write("starting client... ")
sys.stdout.flush()
clientProc = TestUtil.startClient("test.Freeze.dbmap.Client", '"' + os.getcwd() + '"', startReader=False)
print("ok")
clientProc.startReader()
clientProc.waitTestSuccess()
Example #11
0
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# **********************************************************************

import os, sys

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", "FreezeTestUtil.py")) ]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")
sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

dbdir = os.path.join(os.getcwd(), "db")
TestUtil.cleanDbDir(dbdir)

testOptions = ' --Freeze.DbEnv.db.DbHome="%s" --Ice.Config="%s"' % (dbdir, os.path.join(os.getcwd(), "config"))

TestUtil.clientServerTest(additionalServerOptions= testOptions, additionalClientOptions= testOptions)
Example #12
0
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", "FreezeTestUtil.py"))
]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")

sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

#
# List of all basic tests.
#
tests = [
    ("Freeze/dbmap", ["once"]),
    ("Freeze/complex", ["once"]),
    ("Freeze/evictor", ["once"]),
    ("Freeze/fileLock", ["once"]),
    ("FreezeScript/dbmap", ["once"]),
    ("FreezeScript/evictor", ["once"]),
]

if __name__ == "__main__":
    TestUtil.run(tests)
Example #13
0
#
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# **********************************************************************

import os, sys, imp

sys.path.append(os.path.join(os.path.dirname(__file__), "scripts"))
import FreezeTestUtil as TestUtil

testGroups = []

languages = ["cpp", "java"]

for d in languages:

    filename = os.path.abspath(
        os.path.join(os.path.dirname(__file__), d, "allTests.py"))
    f = open(filename, "r")
    current_mod = imp.load_module("allTests", f, filename,
                                  (".py", "r", imp.PY_SOURCE))
    f.close()

    tests = []

    tests = [(os.path.join(d, "test", x), y) for x, y in current_mod.tests]
    if len(tests) > 0:
        testGroups.extend(tests)

TestUtil.run(testGroups, root=True)
Example #14
0
File: run.py Project: citms/freeze
path = [
    os.path.abspath(p) for p in path
    if os.path.exists(os.path.join(p, "scripts", "FreezeTestUtil.py"))
]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")
sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

sys.stdout.write("testing process file lock... ")
sys.stdout.flush()

client = os.path.join("test.Freeze.simpleFileLock.Client")
clientFail = os.path.join("test.Freeze.simpleFileLock.ClientFail")

clientExe = TestUtil.startClient(client, "", None, None, False)
clientExe.expect('File lock acquired.\.*')

#
# Ensure that the file lock exists.
#
assert (os.path.exists("file.lock"))

clientFailExe = TestUtil.startClient(clientFail, "", None, None, False)
clientFailExe.expect('File lock not acquired.')
clientFailExe.wait()

# send some output to client to terminate it.
clientExe.sendline('go')
clientExe.expect('File lock released.')
clientExe.wait()
Example #15
0
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", "FreezeTestUtil.py")) ]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")
sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

sys.stdout.write("testing process file lock... ")
sys.stdout.flush()

client = os.path.join("test.Freeze.simpleFileLock.Client")
clientFail = os.path.join("test.Freeze.simpleFileLock.ClientFail")

clientExe = TestUtil.startClient(client, "", None, None, False)
clientExe.expect('File lock acquired.\.*')

#
# Ensure that the file lock exists.
#
assert(os.path.exists("file.lock"));

clientFailExe = TestUtil.startClient(clientFail, "", None, None, False)
clientFailExe.expect('File lock not acquired.')
clientFailExe.wait()

# send some output to client to terminate it.
clientExe.sendline('go')
clientExe.expect('File lock released.')
clientExe.wait()
Example #16
0
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# **********************************************************************

import os, sys

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", "FreezeTestUtil.py")) ]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")
sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

dbdir = os.path.join(os.getcwd(), "db")
TestUtil.cleanDbDir(dbdir)

if TestUtil.appverifier:
    TestUtil.setAppVerifierSettings([client])

client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
TestUtil.simpleTest(client, ' --Freeze.Warn.Rollback=0 "%s"' % os.getcwd())

if TestUtil.appverifier:
    TestUtil.appVerifierAfterTestEnd([client])
Example #17
0
File: run.py Project: citms/freeze
import os, sys, re, shutil

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", "FreezeTestUtil.py"))
]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")
sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

transformdb = TestUtil.getFreezeExe("transformdb")

if TestUtil.appverifier:
    TestUtil.setAppVerifierSettings([transformdb])

dbdir = os.path.join(os.getcwd(), "db")
TestUtil.cleanDbDir(dbdir)

init_dbdir = os.path.join(os.getcwd(), "db_init")
if os.path.exists(init_dbdir):
    shutil.rmtree(init_dbdir)
os.mkdir(init_dbdir)

check_dbdir = os.path.join(os.getcwd(), "db_check")
if os.path.exists(check_dbdir):
    shutil.rmtree(check_dbdir)
Example #18
0
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# **********************************************************************

import os, sys

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", "FreezeTestUtil.py"))
]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")
sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

dbdir = os.path.join(os.getcwd(), "db")
TestUtil.cleanDbDir(dbdir)

testOptions = ' --Freeze.DbEnv.db.DbHome="%s" --Ice.Config="%s"' % (
    dbdir, os.path.join(os.getcwd(), "config"))

TestUtil.clientServerTest(additionalServerOptions=testOptions,
                          additionalClientOptions=testOptions)
Example #19
0
import os, sys, re, getopt

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", "FreezeTestUtil.py")) ]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")

sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

#
# List of all basic tests.
#
tests = [
    ("Freeze/dbmap", ["once"]),
    ("Freeze/complex", ["once"]),
    ("Freeze/evictor", ["once"]),
    ("Freeze/fileLock", ["once"]),
    ("FreezeScript/dbmap", ["once"]),
    ("FreezeScript/evictor", ["once"]),
    ]

if __name__ == "__main__":
    TestUtil.run(tests)
Example #20
0
import os, sys

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", "FreezeTestUtil.py")) ]
if len(path) == 0:
    raise RuntimeError("can't find toplevel directory!")
sys.path.append(os.path.join(path[0], "scripts"))
import FreezeTestUtil as TestUtil

sys.stdout.write("testing Freeze file lock... ")
sys.stdout.flush()

client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
clientExe = TestUtil.startClient(client, "", None, None, False)
clientExe.expect('File lock acquired.\.*')

clientFail = os.path.join(os.getcwd(), TestUtil.getTestExecutable("clientFail"))
clientFailExe = TestUtil.startClient(clientFail, "", None, None, False)
clientFailExe.expect('File lock not acquired')

clientFailExe.waitTestSuccess()

# send some output to client to terminate it.
clientExe.sendline('go')
clientExe.expect('File lock released.')
clientExe.waitTestSuccess()

# The lock is gone try to acquire it again.