/[ascend]/branches/relerrorlist/test/test-cov.py
ViewVC logotype

Contents of /branches/relerrorlist/test/test-cov.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3223 - (show annotations) (download) (as text)
Tue Oct 31 06:05:25 2017 UTC (16 months, 2 weeks ago) by jpye
File MIME type: text/x-python
File size: 2364 byte(s)
comment

1 #!/usr/bin/env python
2
3 # This script runs LCOV to generate coverage testing results from the main CUnit test suites
4 # implemented for ASCEND currently.
5
6 LCOV="/usr/local/bin/lcov"
7 GENHTML='/usr/local/bin/genhtml'
8 SCONS_CALL=["scons","-j4","MALLOC_DEBUG=1","GCOV=1","CC=gcc","CXX=g++","test","ascend","models","solvers"]
9
10 import os
11 PREFIX=os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),".."))
12 #print "PREFIX=",PREFIX
13 ORIG=os.getcwd()
14 os.chdir(PREFIX)
15
16 DEVNULL = open(os.devnull,'w')
17
18 tests = {
19 'general':[
20 'general_color','general_dstring','general_hashpjw'
21 ,'general_list','general_listio','general_mem','general_pool'
22 ,'general_pairlist'
23 ,'general_pretty','general_stack','general_table','general_tm_time'
24 ,'general_ospath','general_env','general_ltmatrix','general_ascMalloc'
25 ],'utilities':[
26 'utilities_ascEnvVar','utilities_ascPrint'
27 ,'utilities_ascSignal','utilities_readln','utilities_set'
28 ,'linear_qrrank','linear_mtx','utilities_error'
29 ],'linear':['linear_qrrank','linear_mtx']
30 ,'compiler':[
31 'compiler_basics','compiler_expr','compiler_fixfree','compiler_fixassign'
32 ],'packages':['packages_defaultall']
33 ,'solver':[
34 'solver_slv_common','solver_slvreq','solver_ipopt','solver_qrslv'
35 ,'solver_fprops','solver_lrslv'
36 ],'integrator':['integrator_lsode']
37 }
38
39 import subprocess
40 LCOV_CD=[LCOV,'-c','-d',PREFIX,'--no-external']
41 # clean
42 print "CLEANING UP"
43 subprocess.check_call(SCONS_CALL + ['-c'],stdout=DEVNULL)
44
45 #build
46 print "BUILD"
47 subprocess.check_call(SCONS_CALL,stdout=DEVNULL,stderr=DEVNULL)
48
49 #baseline
50 print "BASELINE"
51 F_BASELINE = 'mycov-0.info'
52 mycall = LCOV_CD + ['-i','-o',F_BASELINE]
53 #print "CALL:",mycall
54 subprocess.check_call(mycall,stdout=DEVNULL)
55
56 myenv = os.environ.copy()
57 myenv['ASCENDLIBRARY']='models:solvers/qrslv:solvers/ipopt:solvers/lrslv'
58 myenv['LD_LIBRARY_PATH']='.'
59
60 for t in tests:
61 print "TEST '%s'" % (t,)
62 subprocess.check_call(['test/test']+tests[t],env=myenv,stdout=DEVNULL,stderr=DEVNULL)
63 F = 'mycov-%s.info' % (t,)
64 subprocess.check_call(LCOV_CD + ['-o',F,'-t',t],stdout=DEVNULL)
65 F1 = 'mycov-%s-1.info' % (t,)
66 subprocess.check_call([LCOV,'-r',F,'*stdout*','-o',F1],stdout=DEVNULL)
67
68 subprocess.check_call([GENHTML
69 ,'-b',F_BASELINE
70 ,'-p',PREFIX
71 ,'-o','lcov-html'
72 ,'-t','ASCEND - CUnit test coverage'
73 ] + ['mycov-%s-1.info'%(t,) for t in tests]
74 )
75
76 os.chdir(ORIG)
77

Properties

Name Value
svn:executable *

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22