|
15 | 15 | parser = OptionParser()
|
16 | 16 | parser.add_option('-j', '--parallel', dest='n_procs', default='1',
|
17 | 17 | help="Number of parallel jobs.")
|
18 |
| -parser.add_option('-v', '--verbose', action="store_true", dest="verbose", |
| 18 | +parser.add_option('-v', '--verbose', action="store_true", dest='verbose', |
19 | 19 | default=False, help="Make CTest verbose.")
|
20 | 20 | parser.add_option('-R', '--tests-regex', dest='regex_tests',
|
21 | 21 | help="Run tests matching regular expression. "
|
|
26 | 26 | "Specific build configurations can be printed out with "
|
27 | 27 | "optional argument -p, --print. This uses standard "
|
28 | 28 | "regex syntax to select build configurations.")
|
29 |
| -parser.add_option('-c', '--coverage', dest='coverage', |
30 |
| - help="Run tests with coverage.py to output Python code " |
31 |
| - "coverage.") |
| 29 | +parser.add_option('-c', '--coverage', action="store_true", dest='coverage', |
| 30 | + default=False, help="Run tests with coverage.py to output " |
| 31 | + "Python code coverage.") |
32 | 32 | parser.add_option('-l', '--list', action="store_true",
|
33 | 33 | dest="list_build_configs", default=False,
|
34 | 34 | help="List out build configurations.")
|
@@ -82,6 +82,14 @@ def run_cmake(self):
|
82 | 82 |
|
83 | 83 | cmake_cmd = ['cmake', '-H..', '-Bbuild']
|
84 | 84 |
|
| 85 | + # Run tests with coverage option or not |
| 86 | + if options.coverage: |
| 87 | + cmake_cmd += ['-DPYTHON_EXECUTABLE=' + shutil.which('coverage')] |
| 88 | + cmake_cmd += ['-DCOVERAGE=True'] |
| 89 | + cmake_cmd += ['-DOMIT=test*'] |
| 90 | + else: |
| 91 | + cmake_cmd += ['-DPYTHON_EXECUTABLE=' + sys.executable] |
| 92 | + |
85 | 93 | # Run CMake
|
86 | 94 | rc = subprocess.call(cmake_cmd)
|
87 | 95 |
|
@@ -128,7 +136,7 @@ def add_test(name, cc='gcc', num_threads=1, debug=False, ):
|
128 | 136 | # List of all tests that may be run. User can add -C to command line to specify
|
129 | 137 | # a subset of these configurations
|
130 | 138 | add_test('normal-gcc', cc='gcc', num_threads=1)
|
131 |
| -#add_test('normal-openmp-gcc', cc='gcc', num_threads=4) |
| 139 | +add_test('normal-openmp-gcc', cc='gcc', num_threads=4) |
132 | 140 | #add_test('normal-icpc', cc='icpc', num_threads=1)
|
133 | 141 | #add_test('normal-openmp-icpc', cc='icpc', num_threads=4)
|
134 | 142 | #add_test('normal-clang', cc='clang', num_threads=1)
|
@@ -192,12 +200,12 @@ def add_test(name, cc='gcc', num_threads=1, debug=False, ):
|
192 | 200 | shutil.copy(logfile[0], logfilename)
|
193 | 201 |
|
194 | 202 | # Combine all coverage files
|
195 |
| -if coverage == True: |
| 203 | +if options.coverage: |
196 | 204 | os.system('coverage combine test*/.coverage')
|
197 | 205 |
|
198 | 206 | # Clear build directory and remove binary and hdf5 files
|
199 | 207 | shutil.rmtree('build', ignore_errors=True)
|
200 |
| -if coverage == False: |
| 208 | +if not options.coverage: |
201 | 209 | shutil.rmtree('openmoc', ignore_errors=True)
|
202 | 210 | subprocess.call(['./cleanup'])
|
203 | 211 |
|
|
0 commit comments