Skip to content

Commit

Permalink
issue id=660, Service Preparation when have server cases,
Browse files Browse the repository at this point in the history
-w not need target and server, it is independent
  • Loading branch information
BelHzy committed Jan 19, 2017
1 parent 1ae1574 commit d558e08
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 36 deletions.
80 changes: 45 additions & 35 deletions caliper
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import datetime
import commands
import subprocess
import glob
import ConfigParser

from argparse import ArgumentParser

Expand Down Expand Up @@ -309,48 +310,57 @@ if __name__=="__main__":
caliper_path.config_files.config_dir,
'client_config.cfg'
))
# skipping the remote_host connection to target for "web report generation" option:
if args.webpage != True:
remote_host = get_remote_host()
server_host = get_server_host()
try:
build.copy_gen_to_server(server_host,caliper_path.SERVER_SYNC_FILE_SRC)
except Exception as e:
logging.error(e)
logging.error("ERROR IN COPYTING THE %s FILE TO SERVER" % caliper_path.SERVER_SYNC_FILE_SRC)
pass

caliper_path.create_dir()
if args.build:
try:
clear = 0
if args.cleanbuild:
clear = 1
result1 = build_all_tests(remote_host,f_option,clear)
if result1:
sys.exit()
except Exception, e:
raise
sys.exit()

if args.run:
try:
result2 = run_caliper(remote_host,server_host, f_option)
if result2:
if args.webpage != True:
remote_host = get_remote_host()

if args.build or args.run:
sCfgTCTail="_cases_def.cfg"
flCfgTCSrv=os.path.join(caliper_path.config_files.tests_cfg_dir, "server"+sCfgTCTail)

config=ConfigParser.ConfigParser()
config.read(flCfgTCSrv)
sections=config.sections()
nTitleSect=len(sections)

server_host=None
if nTitleSect>0:
server_host = get_server_host()
try:
build.copy_gen_to_server(server_host,caliper_path.SERVER_SYNC_FILE_SRC)
except Exception as e:
logging.warn("put %s %s" % (caliper_path.SERVER_SYNC_FILE_SRC,e))

if args.build:
try:
clear = 0
if args.cleanbuild:
clear = 1
result1 = build_all_tests(remote_host,f_option,clear)
if result1:
sys.exit()
except Exception, e:
raise
sys.exit()

except Exception:
raise
sys.exit()
if args.run:
try:
result2 = run_caliper(remote_host,server_host, f_option)
if result2:
sys.exit()

end_time = datetime.datetime.now()
interval = end_time - start_time
except Exception:
raise
sys.exit()

if args.run:
try:
summary.output_summary_info(remote_host, interval.seconds)
except Exception, e:
raise e
end_time = datetime.datetime.now()
interval = end_time - start_time
try:
summary.output_summary_info(remote_host, interval.seconds)
except Exception, e:
raise e

if args.parse:
try:
Expand Down
6 changes: 5 additions & 1 deletion server/run/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ def run_commands(exec_dir, kind_bench, commands,
returncode = -1
output = ''

if not os.path.exists(exec_dir):
output = exec_dir + ' not exist'
return [output, returncode]

pwd = os.getcwd()
os.chdir(exec_dir)
try:
Expand Down Expand Up @@ -736,7 +740,7 @@ def caliper_run(target_exec_dir, server,target):
classify = config_files[i].split("/")[-1].strip().split("_")[0]
logging.debug(classify)

if classify == "server":
if classify == "server" and server:
try:
server_ip = settings.get_value("SERVER","ip",type=str)
server_port = settings.get_value("SERVER","port",type=int)
Expand Down

0 comments on commit d558e08

Please sign in to comment.