def test_macintelpower_init(macintelpower_obj): """Tests that the MacIntelPower object is correctly initialized.""" assert macintelpower_obj.ipg_path assert macintelpower_obj.ipg assert macintelpower_obj._os == "darwin" assert macintelpower_obj._cpu == "intel"
def test_macintelpower_measuring(macintelpower_obj): """Tests that measurement initialization and finalization works for the MacIntelPower object. """ assertnot macintelpower_obj.start_time assertnot macintelpower_obj.ipg._running assertnot macintelpower_obj.ipg._output_files
macintelpower_obj.initialize_power_measurements()
# Check that initialization set start_time, and started the # IPG measurer thread.
# Wait a bit for thread to start, then check it
timeout = 10
start = time.time() while time.time() - start < timeout andnot macintelpower_obj.ipg._running:
time.sleep(1)
with mock.patch( "mozpower.intel_power_gadget.IPGResultsHandler.clean_ipg_data"
) as _: with mock.patch( "mozpower.intel_power_gadget.IPGResultsHandler." "format_ipg_data_to_partial_perfherder"
) as formatter:
formatter.side_effect = formatter_side_effect
# Check that finalization set the end_time, stopped the IPG measurement # thread, added atleast one output file name, and initialized # an IPGResultsHandler object assert macintelpower_obj.end_time assertnot macintelpower_obj.ipg._running assert macintelpower_obj.ipg._output_files assert macintelpower_obj.ipg_results_handler
# Check that the IPGResultHandler's methods were # called
macintelpower_obj.ipg_results_handler.clean_ipg_data.assert_called()
macintelpower_obj.ipg_results_handler.format_ipg_data_to_partial_perfherder.assert_called_once_with( # NOQA: E501
macintelpower_obj.end_time - macintelpower_obj.start_time, "power-testing",
)
# Make sure we can get the expected perfherder data # after formatting assert macintelpower_obj.get_perfherder_data() == test_data
if __name__ == "__main__":
mozunit.main()
Messung V0.5
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.