summaryrefslogtreecommitdiffstats
path: root/doc/ws_main.py
diff options
context:
space:
mode:
Diffstat (limited to 'doc/ws_main.py')
-rwxr-xr-xdoc/ws_main.py84
1 files changed, 74 insertions, 10 deletions
diff --git a/doc/ws_main.py b/doc/ws_main.py
index 237ea743..a88452b3 100755
--- a/doc/ws_main.py
+++ b/doc/ws_main.py
@@ -250,6 +250,8 @@ def scansize(self):
def options(opt):
opt.add_option('--exe', action='store_true', default=False, help='Execute the program after it is compiled')
+ opt.add_option('--performance', action='store_true', help='Build a performance report based on google analytics')
+ opt.add_option('--performance-detailed',action='store_true',help='print detailed test results (date,time, build id and results) to csv file named _detailed_table.csv.')
def configure(conf):
search_path = '~/.local/bin /usr/local/bin/ /usr/bin'
@@ -291,7 +293,7 @@ TOC_HEAD = """
<!-- load the theme CSS file -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" rel="stylesheet"/>
- <link href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" rel="stylesheet" />
+ <link href="https://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" rel="stylesheet" />
<!-- include the jQuery library -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.1/jquery.min.js">
@@ -887,8 +889,15 @@ def build_cp(bld,dir,root,callback):
-
-
+def create_analytic_report(task):
+ try:
+ import AnalyticsWebReport as analytics
+ if task.generator.bld.options.performance_detailed:
+ analytics.main(verbose = Logs.verbose,detailed_test_stats='yes')
+ else:
+ analytics.main(verbose = Logs.verbose)
+ except Exception as e:
+ raise Exception('Error importing or using AnalyticsWebReport script: %s' % e)
@@ -916,6 +925,12 @@ def build(bld):
bld(rule=my_copy, target=x)
bld.add_group()
+ if bld.options.performance or bld.options.performance_detailed:
+ bld(rule=create_analytic_report)
+ bld.add_group()
+ bld(rule=convert_to_html_toc_book, source='trex_analytics.asciidoc waf.css', target='trex_analytics.html',scan=ascii_doc_scan);
+ return
+
bld(rule=my_copy, target='my_chart.js')
build_cp(bld,'hlt_args.asciidoc','stl/trex_stl_lib', parse_hlt_args)
@@ -973,9 +988,12 @@ def build(bld):
bld(rule=convert_to_html_toc_book,
source='trex_rpc_server_spec.asciidoc waf.css', target='trex_rpc_server_spec.html',scan=ascii_doc_scan);
-
+
bld(rule=convert_to_html_toc_book,
source='trex_scapy_rpc_server.asciidoc waf.css', target='trex_scapy_rpc_server.html',scan=ascii_doc_scan);
+
+ bld(rule=convert_to_html_toc_book,
+ source='trex-analytics-howto.asciidoc waf.css', target='trex-analytics-howto.html',scan=ascii_doc_scan);
bld(rule='${ASCIIDOC} -a stylesheet=${SRC[1].abspath()} -a icons=true -a toc2 -a max-width=55em -o ${TGT} ${SRC[0].abspath()}',
source='vm_doc.asciidoc waf.css', target='vm_doc.html', scan=ascii_doc_scan)
@@ -1062,16 +1080,62 @@ def release(bld):
os.system('cp -rv build/release_notes.* '+ release_dir)
+def rsync_int(bld, src, dst):
+ cmd = 'rsync -av --del --rsh=ssh build/{src} {host}:{dir}/{dst}'.format(
+ src = src,
+ host = Env().get_local_web_server(),
+ dir = Env().get_remote_release_path() + '../doc',
+ dst = dst)
+ ret = os.system(cmd)
+ if ret:
+ bld.fatal("cmd '%s' exited with return status" % (cmd, ret))
+
+
+def rsync_ext(bld, src, dst):
+ cmd = 'rsync -avz --del -e "ssh -i {key}" --rsync-path=/usr/bin/rsync build/{src} {user}@{host}:{dir}/doc/{dst}'.format(
+ key = Env().get_trex_ex_web_key(),
+ src = src,
+ user = Env().get_trex_ex_web_user(),
+ host = Env().get_trex_ex_web_srv(),
+ dir = Env().get_trex_ex_web_path(),
+ dst = dst)
+ ret = os.system(cmd)
+ if ret:
+ bld.fatal("cmd '%s' exited with return status" % (cmd, ret))
+
+
def publish(bld):
- # copy all the files to our web server
- remote_dir = "%s:%s" % ( Env().get_local_web_server(), Env().get_remote_release_path ()+'../doc/')
- os.system('rsync -av --del --rsh=ssh build/ %s' % (remote_dir))
+ # copy all the files to internal web server
+ rsync_int(bld, '', '')
def publish_ext(bld):
- from_ = 'build/'
- os.system('rsync -avz --del -e "ssh -i %s" --rsync-path=/usr/bin/rsync %s %s@%s:%s/doc/' % (Env().get_trex_ex_web_key(),from_, Env().get_trex_ex_web_user(),Env().get_trex_ex_web_srv(),Env().get_trex_ex_web_path() ) )
-
+ # copy all the files to external web server
+ rsync_ext(bld, '', '')
+
+
+def publish_perf(bld):
+ # copy performance files to internal and external servers
+ rsync_int(bld, 'trex_analytics.html', '')
+ rsync_ext(bld, 'trex_analytics.html', '')
+ rsync_int(bld, 'trex_analytics.json', '')
+ rsync_ext(bld, 'trex_analytics.json', '')
+ rsync_int(bld, 'images/*_latest_test_*', 'images/')
+ rsync_ext(bld, 'images/*_latest_test_*', 'images/')
+ rsync_int(bld, 'images/*_trend_graph.*', 'images/')
+ rsync_ext(bld, 'images/*_trend_graph.*', 'images/')
+ rsync_int(bld, 'images/*_trend_stats.*', 'images/')
+ rsync_ext(bld, 'images/*_trend_stats.*', 'images/')
+ rsync_int(bld, 'images/_detailed_table.csv', 'images/')
+ rsync_ext(bld, 'images/_detailed_table.csv', 'images/')
+
+ rsync_int(bld, 'images/_comparison.png', 'images/')
+ rsync_ext(bld, 'images/_comparison.png', 'images/')
+
+ rsync_int(bld, 'images/_comparison_stats_table.csv', 'images/')
+ rsync_ext(bld, 'images/_comparison_stats_table.csv', 'images/')
+
+
def publish_test(bld):
# copy all the files to our web server