Skip to content

Commit

Permalink
- fix for issue #37 - de-queue test cases for cli.py
Browse files Browse the repository at this point in the history
- fix for issue #42 - Testcase Filename contains '//' in CLI log
- fix for issue #56 - cli.py version number not correctly reported
- fix for issue #35 - log slider panel updated to show full messages
- added test button for email configuration
- added mechanism to backup the client log files
- added mechanism to stop execution of the test cases if the pre-execution
  script fails
- exported internal variables twister_user, twister_ce_ip and twister_ep_os
  they can be saved into DB
- updated UserGuide document
- applet changes for User Management prototype
  • Loading branch information
bogdanpopescu committed Aug 2, 2013
1 parent ff1fa71 commit bb18584
Show file tree
Hide file tree
Showing 32 changed files with 1,509 additions and 878 deletions.
15 changes: 15 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
02nd August 2013

- fix for issue #37 - de-queue test cases for cli.py
- fix for issue #42 - Testcase Filename contains '//' in CLI log
- fix for issue #56 - cli.py version number not correctly reported
- fix for issue #35 - log slider panel updated to show full messages
- added test button for email configuration
- added mechanism to backup the client log files
- added mechanism to stop execution of the test cases if the pre-execution
script fails
- exported internal variables twister_user, twister_ce_ip and twister_ep_os
they can be saved into DB
- updated UserGuide document
- applet changes for User Management prototype

18th July 2013

- issue #48 ; code changes to fix start_client for EP's where EP_HOST is commented out or there
Expand Down
53 changes: 43 additions & 10 deletions bin/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# version: 2.006
# version: 2.010

# File: cli.py ; This file is part of Twister.

Expand Down Expand Up @@ -197,7 +197,20 @@ def queueTest(proxy, user, suite, fname):
if r:
print('Test `{}` was queued in suite `{}`.'.format(fname, suite))
else:
print('Failed to queue test `{}` was queued in suite `{}`!'.format(fname, suite))
print('Failed to queue test `{}` was queued in suite `{}`! Check Central Engine logs.'.format(fname, suite))

print


def deQueueTest(proxy, user, epname, file_id):
"""
Un-Queue a file, from the current project.
"""
r = proxy.deQueueFile(user, epname, file_id)
if r:
print('Test `{}` was removed from the project.'.format(file_id))
else:
print('Failed to dequeue test `{}`! Check Central Engine logs.'.format(file_id))

print

Expand All @@ -209,12 +222,19 @@ def queueTest(proxy, user, suite, fname):
if __name__ == '__main__':

usage = "Usage: %prog --server <ip:port> --command [...parameters]"
version = "%prog v2.0"

version = ""
for line in open(__file__):
li=line.strip()
if li.startswith("# version:"):
version = "%prog " + line.split("version:")[1]
if version: break

parser = OptionParser(usage=usage, version=version)

# The most important option is the server. By default, it's localhost:8000.
parser.add_option("--server", action="store", default="http://127.0.0.1:8000/",
help="Central engine server IP and Port (default: http://127.0.0.1:8000/).")
# The most important option is the server. By default, it's user:password@127.0.0.1:8000.
parser.add_option("--server", action="store", default="http://user:password@127.0.0.1:8000/",
help="Your user and password @ central engine IP and port (default: http://user:password@127.0.0.1:8000/)")

parser.add_option('-u', "--users", action="store_true", help="Show active and inactive users.")

Expand All @@ -226,6 +246,7 @@ def queueTest(proxy, user, suite, fname):
parser.add_option("--status-details", action="store", help="Show detailed status for running, finished, pending, or all files.")

parser.add_option("-q", "--queue", action="store", help="Queue a file at the end of a suite. Specify queue like `suite:file`.")
parser.add_option("--dequeue", action="store", help="Un-Queue a file, using the EP and File ID. Specify like `EP-name:file-ID`.")

parser.add_option("-s", "--set", action="store", help="Set status: start/ stop/ pause. (Must also specify a config and a project)")
parser.add_option("-c", "--config", action="store", help="Path to FWMCONFIG.XML file.")
Expand All @@ -241,17 +262,18 @@ def queueTest(proxy, user, suite, fname):
print('Cannot guess the user name! Exiting!\n')
exit(1)


# Test if user did install Twister
if os.path.isdir(userHome(user) + os.sep + 'twister'):
print('\nHello, user `{}`.\n'.format(user))
else:
print('Username `{}` must install Twister before using this script !\n'.format(user))
exit(1)


# Test Central Engine valid IP + PORT
try:
proxy = xmlrpclib.ServerProxy(options.server)
proxy._ServerProxy__transport._extra_headers.append( ('username', user) )
# print('Connection to Central Engine at `{}` is ok.\n'.format(options.server))
except:
print('The server must be a valid IP and PORT combination ! Exiting !\n')
Expand All @@ -261,8 +283,8 @@ def queueTest(proxy, user, suite, fname):
try:
proxy.echo('ping')
# print('Connection to Central Engine at `{}` is ok.\n'.format(options.server))
except:
print('The Central Engine server is down ! Exiting !\n')
except Exception, e:
print('Cannot connect to Central Engine server! Error `{}` ! Exiting!\n'.format(e))
exit(1)


Expand Down Expand Up @@ -295,12 +317,23 @@ def queueTest(proxy, user, suite, fname):
# Queue a file at the end of a suite
if options.queue:
if not ':' in options.queue:
print('Must queue `suite:file`, for example `Suite1:/home/user/some_file.py`.')
print('Must queue `suite:file`, for example `Suite1:/home/user/some_file.py` !\n')
exit(1)
suite, fname = options.queue.split(':')
queueTest(proxy, user, suite, fname)
exit()


# Un-Queue a file, using the File ID
if options.dequeue:
if not ':' in options.dequeue:
print('Must dequeue `epname:file_id`, for example `EP-1001:101` !\n')
exit(1)
epname, file_id = options.dequeue.split(':')
deQueueTest(proxy, user, epname, file_id)
exit()


# If all the other options are not available, it means the command must be a status change.
if not options.set:
print('You didn\'t specify a command ! Exiting !\n')
Expand Down
2 changes: 1 addition & 1 deletion bin/start_client
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
PYTHON_PATH=/usr/bin/python

DAEMON=`echo ~/twister/bin/start_client.py`
LOG_PATH=`echo ~/twister/twisterclient.log`
LOG_PATH=`echo ~/twister/client_log.log`

NAME=twisterclient
DESC="twister client"
Expand Down
Loading

0 comments on commit bb18584

Please sign in to comment.