amzn / hawktracer

HawkTracer is a highly portable, low-overhead, configurable profiling tool built in Amazon Video for getting performance metrics from low-end devices.
MIT License
133 stars 31 forks source link

Unit tests for chrome trace converter #85

Open nkhlktn opened 4 years ago

nkhlktn commented 4 years ago

Issue #15

Added unit tests for the chrome trace converter module.

[----------] 9 tests from TestChromeTraceConverter
[ RUN      ] TestChromeTraceConverter.CheckFileAfterOpenButNoEvents
[       OK ] TestChromeTraceConverter.CheckFileAfterOpenButNoEvents (0 ms)
[ RUN      ] TestChromeTraceConverter.CheckWhenEmptyEventProcessed
[       OK ] TestChromeTraceConverter.CheckWhenEmptyEventProcessed (1 ms)
[ RUN      ] TestChromeTraceConverter.CheckWhenOnlyTimeStampAdded
[       OK ] TestChromeTraceConverter.CheckWhenOnlyTimeStampAdded (0 ms)
[ RUN      ] TestChromeTraceConverter.CheckWhenNameTimeStampAdded
[       OK ] TestChromeTraceConverter.CheckWhenNameTimeStampAdded (0 ms)
[ RUN      ] TestChromeTraceConverter.CheckWhenLabelTimeStampAdded
[       OK ] TestChromeTraceConverter.CheckWhenLabelTimeStampAdded (1 ms)
[ RUN      ] TestChromeTraceConverter.CheckWhenNameAndDurationAdded
[       OK ] TestChromeTraceConverter.CheckWhenNameAndDurationAdded (0 ms)
[ RUN      ] TestChromeTraceConverter.CheckWhenLabelAndDurationAdded
[       OK ] TestChromeTraceConverter.CheckWhenLabelAndDurationAdded (1 ms)
[ RUN      ] TestChromeTraceConverter.CheckWithNameAndMultipleArgsAdded
[       OK ] TestChromeTraceConverter.CheckWithNameAndMultipleArgsAdded (0 ms)
[ RUN      ] TestChromeTraceConverter.CheckWithLabelAndMultipleArgsAdded
[       OK ] TestChromeTraceConverter.CheckWithLabelAndMultipleArgsAdded (0 ms)
[----------] 9 tests from TestChromeTraceConverter (4 ms total)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

loganek commented 4 years ago

@nikhilkotian22 thanks a lot for the contribution! I noticed that the tests sometimes fail (see CI results). Would you be able to have a look? Thank you

nkhlktn commented 4 years ago

@loganek I will fix this. I now realise that arguments are stored in an std::unordered_map and a string comparison therefore will not work. It will be better to do a json parse and compare.