I start a docker service on a host and start a container for one test each time.
I used to use below cmd in the end of test to check whether the test is out of memory:
dmesg | grep -F -e 'Out of memory' -e 'invoked oom-killer: gfp_mask=0x' -e ': page allocation failure: order:'
I found that journalctl can limit start_time and end_time so that below command can work well:
journalctl -k \ --since "`date -r file "+%Y-%m-%d %H:%M:%S"`" \ --until "`date "+%Y-%m-%d %H:%M:%S"`" | grep -q -F \ -e 'Out of memory' \ -e 'invoked oom-killer: gfp_mask=0x' \ -e ': page allocation failure: order:'
I take the file mtime as start time so that i can get all kernel info during test.