3
3
4
4
import pytest
5
5
6
- from access .parsers .mom_profiling import MOM5ProfilingParser , MOM6ProfilingParser
6
+ from access .parsers .fms_profiling import FMSProfilingParser
7
7
8
8
9
9
@pytest .fixture (scope = "module" )
10
- def mom5_parser ():
11
- """Fixture instantiating the MOM5 parser."""
12
- return MOM5ProfilingParser ()
10
+ def fms_hits_parser ():
11
+ """Fixture instantiating the FMS parser where hits column is present ."""
12
+ return FMSProfilingParser ()
13
13
14
14
15
15
@pytest .fixture (scope = "module" )
16
- def mom6_parser ():
17
- """Fixture instantiating the MOM6 parser."""
18
- return MOM6ProfilingParser ( )
16
+ def fms_nohits_parser ():
17
+ """Fixture instantiating the FMS parser where hits column is not present ."""
18
+ return FMSProfilingParser ( has_hits = False )
19
19
20
20
21
21
@pytest .fixture (scope = "module" )
22
- def mom5_profiling ():
23
- """Fixture returning a dict holding the parsed content of a mom6_input file ."""
22
+ def fms_nohits_profiling ():
23
+ """Fixture returning a dict holding the parsed FMS timing content without hits ."""
24
24
return {
25
25
"region" : [
26
26
"Total runtime" ,
@@ -40,8 +40,8 @@ def mom5_profiling():
40
40
41
41
42
42
@pytest .fixture (scope = "module" )
43
- def mom5_log_file ():
44
- """Fixture returning the timing content of a mom5 log file ."""
43
+ def fms_nohits_log_file ():
44
+ """Fixture returning the FMS timing content without hits column ."""
45
45
return """ MPP_DOMAINS_STACK high water mark= 747000
46
46
47
47
Tabulating mpp_clock statistics across 49 PEs...
@@ -61,8 +61,8 @@ def mom5_log_file():
61
61
62
62
63
63
@pytest .fixture (scope = "module" )
64
- def mom6_profiling ():
65
- """Fixture returning a dict holding the parsed content of a mom6_input file ."""
64
+ def fms_hits_profiling ():
65
+ """Fixture returning a dict holding the parsed FMS timing content with hits ."""
66
66
return {
67
67
"region" : [
68
68
"Total runtime" ,
@@ -122,8 +122,8 @@ def mom6_profiling():
122
122
123
123
124
124
@pytest .fixture (scope = "module" )
125
- def mom6_log_file ():
126
- """Fixture returning the timing content of a mom6 log file ."""
125
+ def fms_hits_log_file ():
126
+ """Fixture returning a dict holding the parsed FMS timing content wiht hits ."""
127
127
return """ MPP_DOMAINS_STACK high water mark= 380512
128
128
129
129
Tabulating mpp_clock statistics across 1 PEs...
@@ -144,23 +144,23 @@ def mom6_log_file():
144
144
"""
145
145
146
146
147
- def test_mom5_profiling ( mom5_parser , mom5_log_file , mom5_profiling ):
148
- """Test the correct parsing of MOM5 timing information."""
149
- mom5_parsed_log = mom5_parser .read (mom5_log_file )
150
- for idx , region in enumerate (mom5_profiling .keys ()):
151
- assert region in mom5_parsed_log , f"{ region } not found in mom5 parsed log"
147
+ def test_fms_nohits_profiling ( fms_nohits_parser , fms_nohits_log_file , fms_nohits_profiling ):
148
+ """Test the correct parsing of FMS timing information without hits column ."""
149
+ parsed_log = fms_nohits_parser .read (fms_nohits_log_file )
150
+ for idx , region in enumerate (fms_nohits_profiling .keys ()):
151
+ assert region in parsed_log , f"{ region } not found in mom5 parsed log"
152
152
for metric in ("tmin" , "tmax" , "tavg" , "tstd" ):
153
153
assert (
154
- mom5_profiling [metric ][idx ] == mom5_parsed_log [metric ][idx ]
154
+ fms_nohits_profiling [metric ][idx ] == parsed_log [metric ][idx ]
155
155
), f"Incorrect { metric } for region { region } (idx: { idx } )."
156
156
157
157
158
- def test_mom6_profiling (mom6_parser , mom6_log_file , mom6_profiling ):
159
- """Test the correct parsing of MOM6 timing information."""
160
- mom6_parsed_log = mom6_parser .read (mom6_log_file )
161
- for idx , region in enumerate (mom6_profiling .keys ()):
162
- assert region in mom6_parsed_log , f"{ region } not found in mom6 parsed log"
158
+ def test_mom6_profiling (fms_hits_parser , fms_hits_log_file , fms_hits_profiling ):
159
+ """Test the correct parsing of FMS timing information with hits column ."""
160
+ parsed_log = fms_hits_parser .read (fms_hits_log_file )
161
+ for idx , region in enumerate (fms_hits_profiling .keys ()):
162
+ assert region in parsed_log , f"{ region } not found in mom6 parsed log"
163
163
for metric in ("hits" , "tmin" , "tmax" , "tavg" , "tstd" ):
164
164
assert (
165
- mom6_profiling [metric ][idx ] == mom6_parsed_log [metric ][idx ]
165
+ fms_hits_profiling [metric ][idx ] == parsed_log [metric ][idx ]
166
166
), f"Incorrect { metric } for region { region } (idx: { idx } )."
0 commit comments