diff options
author | Matthew Newhook <matthew@zeroc.com> | 2015-03-18 12:58:16 -0230 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2015-03-18 12:58:16 -0230 |
commit | 9b7668c7c92cf9cb311fe444cdddb489cd2a219d (patch) | |
tree | 5016567c58c81f5654e9d01935e199c6bf4761d2 /cpp/demo/Freeze/backup/expect.py | |
parent | VS add-in & build updates: (diff) | |
download | ice-9b7668c7c92cf9cb311fe444cdddb489cd2a219d.tar.bz2 ice-9b7668c7c92cf9cb311fe444cdddb489cd2a219d.tar.xz ice-9b7668c7c92cf9cb311fe444cdddb489cd2a219d.zip |
Removed demos.
Moved demoscript to distribution.
Diffstat (limited to 'cpp/demo/Freeze/backup/expect.py')
-rwxr-xr-x | cpp/demo/Freeze/backup/expect.py | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/cpp/demo/Freeze/backup/expect.py b/cpp/demo/Freeze/backup/expect.py deleted file mode 100755 index 5e48ab7c193..00000000000 --- a/cpp/demo/Freeze/backup/expect.py +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2015 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 sys, os, shutil, signal, 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, "demoscript")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(path[0]) - -from demoscript import Util - -def cleandb(): - shutil.rmtree("db.save", True) - Util.cleanDbDir("db/data") - Util.cleanDbDir("db/logs") - for filename in [ os.path.join("db", f) for f in os.listdir("db") if f.startswith("__db") ]: - os.remove(filename) - -sys.stdout.write("cleaning databases... ") -sys.stdout.flush() -cleandb() -for d in os.listdir('.'): - if d.startswith('hotbackup'): - shutil.rmtree(d) -print("ok") - -client = Util.spawn('./client') - -sys.stdout.write("populating map... ") -sys.stdout.flush() -client.expect('Updating map', timeout=60) -time.sleep(3) # Let the client do some work for a bit. -print("ok") - -sys.stdout.write("performing full backup... ") -sys.stdout.flush() -if Util.isWin32(): - backup = Util.spawn('./backup.bat full') -else: - backup = Util.spawn('./backup full') -backup.expect('hot backup started', timeout=30) -backup.waitTestSuccess(timeout=30) -print("ok") - -sys.stdout.write("sleeping 5s... ") -sys.stdout.flush() -time.sleep(5) -print("ok") - -sys.stdout.write("performing incremental backup... ") -sys.stdout.flush() -if Util.isWin32(): - backup = Util.spawn('./backup.bat incremental') -else: - backup = Util.spawn('./backup incremental') -backup.expect('hot backup started', timeout=30) -backup.waitTestSuccess(timeout=30) -print("ok") - -sys.stdout.write("sleeping 30s... ") -sys.stdout.flush() -time.sleep(30) -print("ok") - -assert os.path.isdir('hotbackup') - -sys.stdout.write("killing client with SIGTERM... ") -sys.stdout.flush() -client.kill(signal.SIGTERM) -client.waitTestSuccess(-signal.SIGTERM) -print("ok") - -sys.stdout.write("Client output: ") -print("%s" % (client.before)) - -sys.stdout.write("restarting client... ") -sys.stdout.flush() -cleandb() -# Annoying. shutil.copytree cannot be used since db already exists -# (and cannot be removed since it contains .gitignore. -#os.system('cp -Rp hotbackup/* db') -for root, dirnames, filesnames in os.walk("hotbackup"): - dbroot = os.path.join("db", root[len("hotbackup")+1:]) - for d in dirnames: - try: - os.mkdir(os.path.join("db", d)) - except OSError: - pass - for f in filesnames: - shutil.copy2(os.path.join(root, f), os.path.join(dbroot, f)) -sys.stdout.flush() - -client = Util.spawn('./client') -client.expect('(.*)Updating map', timeout=60) -assert client.match.group(1).find('Creating new map') == -1 -print("ok") - -sys.stdout.write("sleeping 5s... ") -sys.stdout.flush() -time.sleep(5) -print("ok") - -sys.stdout.write("killing client with SIGTERM... ") -client.kill(signal.SIGTERM) -client.waitTestSuccess(-signal.SIGTERM) -print("ok") - -sys.stdout.write("Restarted client output: ") -print("%s" % (client.before)) |