1616data_rate_slowdown_factor = 1
1717
1818# Default values for validation parameters
19- expected_number_of_data_files = 4
2019check_for_logfile_errors = True
2120
22- wibeth_frag_hsi_trig_params = {
21+ wibeth_frag_params = {
2322 "fragment_type_description" : "WIBEth" ,
2423 "fragment_type" : "WIBEth" ,
25- "hdf5_source_subsystem" : "Detector_Readout" ,
2624 "expected_fragment_count" : (number_of_data_producers * number_of_readout_apps ),
27- "min_size_bytes" : 187272 ,
25+ "min_size_bytes" : 7272 ,
2826 "max_size_bytes" : 194472 ,
2927}
30- wibeth_frag_multi_trig_params = {
31- "fragment_type_description" : "WIBEth" ,
32- "fragment_type" : "WIBEth" ,
33- "hdf5_source_subsystem" : "Detector_Readout" ,
34- "expected_fragment_count" : (number_of_data_producers * number_of_readout_apps ),
35- "min_size_bytes" : 72 ,
36- "max_size_bytes" : 194472 ,
28+ wibeth_tpset_params = {
29+ "fragment_type_description" : "TP Stream" ,
30+ "fragment_type" : "Trigger_Primitive" ,
31+ "expected_fragment_count" : number_of_readout_apps * 3 ,
32+ "frag_counts_by_record_ordinal" : {"first" : {"min_count" : 1 , "max_count" : number_of_readout_apps * 3 },
33+ "default" : {"min_count" : number_of_readout_apps * 3 , "max_count" : number_of_readout_apps * 3 } },
34+ "min_size_bytes" : 0 , # not checked
35+ "max_size_bytes" : 0 , # not checked
36+ "debug_mask" : 0x0 ,
3737}
38+ # sizes: 128 is for one TC with zero TAs inside it (72+56)
39+ # 208 is for one TC with one TA inside it (72+56+80)
40+ # 264 is for two TCs with one TA in one of them (72+56+80+56)
3841triggercandidate_frag_params = {
3942 "fragment_type_description" : "Trigger Candidate" ,
4043 "fragment_type" : "Trigger_Candidate" ,
41- "hdf5_source_subsystem" : "Trigger" ,
4244 "expected_fragment_count" : 1 ,
43- "min_size_bytes" : 72 ,
44- "max_size_bytes" : 280 ,
45+ "min_size_bytes" : 128 ,
46+ "max_size_bytes" : 264 ,
4547}
48+ # sizes: 72 is for an empty TA fragment
49+ # 632 is for three TAs with one TP in each of them (72+5*(88+24))
4650triggeractivity_frag_params = {
4751 "fragment_type_description" : "Trigger Activity" ,
4852 "fragment_type" : "Trigger_Activity" ,
49- "hdf5_source_subsystem" : "Trigger" ,
5053 "expected_fragment_count" : 1 ,
5154 "min_size_bytes" : 72 ,
52- "max_size_bytes" : 520 ,
55+ "max_size_bytes" : 632 ,
5356}
54- triggertp_frag_params = {
55- "fragment_type_description" : "Trigger with TPs" ,
57+ # sizes: 72 is for an empty TP fragment
58+ # 1032 is for a fragment with 40 TPs in it (72+(40*24))
59+ triggerprimitive_frag_params = {
60+ "fragment_type_description" : "Trigger Primitive" ,
5661 "fragment_type" : "Trigger_Primitive" ,
57- "hdf5_source_subsystem" : "Trigger" ,
5862 "expected_fragment_count" : (3 * number_of_readout_apps ),
5963 "min_size_bytes" : 72 ,
60- "max_size_bytes" : 16000 ,
64+ "max_size_bytes" : 1032 ,
6165}
6266hsi_frag_params = {
6367 "fragment_type_description" : "HSI" ,
6468 "fragment_type" : "Hardware_Signal" ,
65- "hdf5_source_subsystem" : "HW_Signals_Interface" ,
6669 "expected_fragment_count" : 1 ,
6770 "min_size_bytes" : 72 ,
68- "max_size_bytes" : 128 ,
71+ "max_size_bytes" : 100 ,
6972}
7073ignored_logfile_problems = {
7174 "-controller" : [
7275 "Worker with pid \\ d+ was terminated due to signal 1" ,
7376 ],
74- "local-connection-server " : [
77+ "connectivity-service " : [
7578 "errorlog: -" ,
76- "Worker with pid \\ d+ was terminated due to signal 1" ,
7779 ],
78- "log_.*_multioutput_" : ["connect: Connection refused" ],
7980}
8081
8182# The next three variable declarations *must* be present as globals in the test
8485
8586object_databases = ["config/daqsystemtest/integrationtest-objects.data.xml" ]
8687
87- conf_dict = data_classes .drunc_config ()
88- conf_dict .dro_map_config .n_streams = number_of_data_producers
89- conf_dict .dro_map_config .n_apps = number_of_readout_apps
90- conf_dict .op_env = "integtest"
91- conf_dict .session = "multioutput"
92- conf_dict .tpg_enabled = False
93- conf_dict .fake_hsi_enabled = True # FakeHSI must be enabled to set trigger window width!
88+ wibtpg_conf = data_classes .drunc_config ()
89+ wibtpg_conf .dro_map_config .n_streams = number_of_data_producers
90+ wibtpg_conf .dro_map_config .n_apps = number_of_readout_apps
91+ wibtpg_conf .op_env = "integtest"
92+ wibtpg_conf .session = "multioutput"
93+ wibtpg_conf .tpg_enabled = True
94+ wibtpg_conf .fake_hsi_enabled = True
95+ wibtpg_conf .frame_file = (
96+ "asset://?checksum=dd156b4895f1b06a06b6ff38e37bd798" # WIBEth All Zeros
97+ )
9498
95- conf_dict .config_substitutions .append (
99+ wibtpg_conf .config_substitutions .append (
96100 data_classes .config_substitution (
97- obj_id = conf_dict .session ,
101+ obj_id = wibtpg_conf .session ,
98102 obj_class = "Session" ,
99103 updates = {"data_rate_slowdown_factor" : data_rate_slowdown_factor },
100104 )
101105)
102- conf_dict .config_substitutions .append (
106+ wibtpg_conf .config_substitutions .append (
103107 data_classes .config_substitution (
104108 obj_class = "LatencyBuffer" , updates = {"size" : 200000 }
105109 )
106110)
107111
108- conf_dict .config_substitutions .append (
112+ wibtpg_conf .config_substitutions .append (
109113 data_classes .config_substitution (
110114 obj_class = "FakeHSIEventGeneratorConf" ,
111115 updates = {"trigger_rate" : 10.0 },
112116 )
113117)
114118
115- conf_dict .config_substitutions .append (
119+ wibtpg_conf .config_substitutions .append (
116120 data_classes .config_substitution (
117121 obj_class = "HSISignalWindow" ,
122+ updates = {
123+ "time_before" : 1000 ,
124+ "time_after" : 500 ,
125+ },
126+ )
127+ )
128+ wibtpg_conf .config_substitutions .append (
129+ data_classes .config_substitution (
130+ obj_class = "TCReadoutMap" ,
131+ obj_id = "def-hsi-tc-map" ,
118132 updates = {
119133 "time_before" : 52000 ,
120134 "time_after" : 1000 ,
121135 },
122136 )
123137)
124- conf_dict .config_substitutions .append (
138+ wibtpg_conf .config_substitutions .append (
125139 data_classes .config_substitution (
126140 obj_class = "DataStoreConf" ,
127141 obj_id = "default" ,
128- updates = {"max_file_size" : 1074000000 },
142+ updates = {"max_file_size" : 725000000 },
129143 )
130144)
131- conf_dict .config_substitutions .append (
145+ wibtpg_conf .config_substitutions .append (
132146 data_classes .config_substitution (
133- obj_class = "TAMakerPrescaleAlgorithm " ,
134- obj_id = "dummy-ta-maker " ,
135- updates = {"prescale " : 25 },
147+ obj_class = "DataStoreConf " ,
148+ obj_id = "default_tp_store_conf " ,
149+ updates = {"max_file_size " : 275000000 },
136150 )
137151)
138-
139- conf_dict .config_substitutions .append (
152+ wibtpg_conf .config_substitutions .append (
140153 data_classes .config_substitution (
141- obj_class = "DFOConf" , updates = {"busy_threshold" : 5 , "free_threshold" : 2 }
154+ obj_class = "StreamEmulationParameters" ,
155+ obj_id = "stream-emu" ,
156+ updates = {"TP_rate_per_channel" : 5 },
142157 )
143158)
144159
145-
146- swtpg_conf = copy .deepcopy (conf_dict )
147- swtpg_conf .tpg_enabled = True
148- swtpg_conf .frame_file = (
149- "asset://?checksum=dd156b4895f1b06a06b6ff38e37bd798" # WIBEth All Zeros
150- )
151-
152- multiout_conf = copy .deepcopy (conf_dict )
153- multiout_conf .n_data_writers = 2
154- multiout_conf .config_substitutions .append (
155- data_classes .config_substitution (
156- obj_class = "DataStoreConf" ,
157- obj_id = "default" ,
158- updates = {"max_file_size" : 4 * 1024 * 1024 * 1024 },
159- )
160- )
161- multiout_conf .config_substitutions .append (
160+ wibtpg_conf .config_substitutions .append (
162161 data_classes .config_substitution (
163- obj_class = "QueueDescriptor" ,
164- obj_id = "trigger-records" ,
165- updates = {"queue_type" : "kFollyMPMCQueue" },
162+ obj_class = "DFOConf" , updates = {"busy_threshold" : 10 , "free_threshold" : 7 }
166163 )
167164)
168165
169166
170- multiout_tpg_conf = copy .deepcopy (multiout_conf )
171- multiout_tpg_conf .tpg_enabled = True
172- multiout_tpg_conf .frame_file = (
173- "asset://?checksum=dd156b4895f1b06a06b6ff38e37bd798" # WIBEth All Zeros
174- )
175-
176167confgen_arguments = {
177- "WIBEth_System (Rollover files)" : conf_dict ,
178- "Software_TPG_System (Rollover files)" : swtpg_conf ,
179- "WIBEth_System (Multiple outputs)" : multiout_conf ,
180- "Software_TPG_System (Multiple outputs)" : multiout_tpg_conf ,
168+ "WIBEth_TPG_System" : wibtpg_conf ,
181169}
182170
183171# The commands to run in nanorc, as a list
184- run_duration = 120
185172nanorc_command_list = (
186173 "boot conf wait 5" .split ()
187- + "start 101 wait 1 enable-triggers wait " .split ()
188- + [str (run_duration )]
174+ + "start --run-number 101 wait 1 enable-triggers wait 178" .split ()
189175 + "disable-triggers wait 2 drain-dataflow wait 2 stop-trigger-sources stop " .split ()
190- + "start 102 wait 1 enable-triggers wait " .split ()
191- + [str (run_duration )]
176+ + "start --run-number 102 wait 1 enable-triggers wait 128" .split ()
192177 + "disable-triggers wait 2 drain-dataflow wait 2 stop-trigger-sources stop " .split ()
193178 + " scrap terminate" .split ()
194179)
@@ -218,34 +203,43 @@ def test_log_files(run_nanorc):
218203
219204
220205def test_data_files (run_nanorc ):
221- local_file_count = expected_number_of_data_files
222- fragment_check_list = [triggercandidate_frag_params , hsi_frag_params ]
223- if run_nanorc .confgen_config .tpg_enabled :
224- local_file_count = 4 # 5
225- # fragment_check_list.append(wib1_frag_multi_trig_params) # ProtoWIB
226- # fragment_check_list.append(wib2_frag_multi_trig_params) # DuneWIB
227- fragment_check_list .append (wibeth_frag_multi_trig_params ) # WIBEth
228- fragment_check_list .append (triggertp_frag_params )
229- fragment_check_list .append (triggeractivity_frag_params )
230- else :
231- # fragment_check_list.append(wib1_frag_hsi_trig_params) # ProtoWIB
232- # fragment_check_list.append(wib2_frag_hsi_trig_params) # DuneWIB
233- fragment_check_list .append (wibeth_frag_hsi_trig_params ) # WIBEth
206+ fragment_check_list = [triggercandidate_frag_params , hsi_frag_params , wibeth_frag_params ]
207+ fragment_check_list .append (triggerprimitive_frag_params )
208+ fragment_check_list .append (triggeractivity_frag_params )
234209
235210 # Run some tests on the output data file
236- assert len (run_nanorc .data_files ) == local_file_count
211+ assert len (run_nanorc .data_files ) == 6 # three for each run
237212
213+ all_ok = True
238214 for idx in range (len (run_nanorc .data_files )):
239215 data_file = data_file_checks .DataFile (run_nanorc .data_files [idx ])
240- assert data_file_checks .sanity_check (data_file )
241- assert data_file_checks .check_file_attributes (data_file )
216+ all_ok &= data_file_checks .sanity_check (data_file )
217+ all_ok &= data_file_checks .check_file_attributes (data_file )
242218 for jdx in range (len (fragment_check_list )):
243- assert data_file_checks .check_fragment_count (
219+ all_ok &= data_file_checks .check_fragment_count (
244220 data_file , fragment_check_list [jdx ]
245221 )
246- assert data_file_checks .check_fragment_sizes (
222+ all_ok &= data_file_checks .check_fragment_sizes (
247223 data_file , fragment_check_list [jdx ]
248224 )
225+ assert all_ok
226+
227+
228+ def test_tpstream_files (run_nanorc ):
229+ tpstream_files = run_nanorc .tpset_files
230+ fragment_check_list = [wibeth_tpset_params ] # WIBEth
231+
232+ assert len (tpstream_files ) == 6 # three for each run
233+
234+ all_ok = True
235+ for idx in range (len (tpstream_files )):
236+ data_file = data_file_checks .DataFile (tpstream_files [idx ])
237+ all_ok &= data_file_checks .check_file_attributes (data_file )
238+ for jdx in range (len (fragment_check_list )):
239+ all_ok &= data_file_checks .check_fragment_count (
240+ data_file , fragment_check_list [jdx ]
241+ )
242+ assert all_ok
249243
250244
251245def test_cleanup (run_nanorc ):
@@ -255,6 +249,10 @@ def test_cleanup(run_nanorc):
255249 filelist_string += " " + str (data_file )
256250 if str (data_file .parent ) not in pathlist_string :
257251 pathlist_string += " " + str (data_file .parent )
252+ for data_file in run_nanorc .tpset_files :
253+ filelist_string += " " + str (data_file )
254+ if str (data_file .parent ) not in pathlist_string :
255+ pathlist_string += " " + str (data_file .parent )
258256
259257 if pathlist_string and filelist_string :
260258 print ("============================================" )
0 commit comments