Project

General

Profile

Overview

Library to generate and simulate OOM conditions for unit testing.

It can be compiled static or dynamic. It includes a /pkg-config/ description file. It can be installed system-wide on build machines.

In the generate mode, it relies on POSIX rlimit features. It can set an hardlimit on the current process and its childrens to avoid eating the whole system RAM. It has protections to avoid including swap memory in the specified limit to avoid consuming swap. Then, it has an enable/disable function pair to temporarily lower the soft rlimit in order to adjust for specific tests and machines. Finally, it has a fill/free function pair to quickly consume/free the whole RAM, keeping only the specified Heap/Stack available bytes. These last functions are designed to be placed IMMEDIATELY before and after the test execution, but the test result check should occurs OUTSIDE of this pair, a test condition, a printf, coverage instrumentation, ... would probably fail if called between these two guys.

In the simulation mode, it overloads malloc/free/realloc functions with stub functions using dlopen. The stub functions can be configured with a countdown counter to make specific calls fail with NULL, and simulate an OOM condition.

I can not guaranty that this library is compatible with Valgrind mecanisms neither with GNU gcc's -fsanitize=address or -fsanitize=leak, probably not.

Releases

Version 1.0.0 released

Issue tracking  Details

open closed Total
Anomalie 0 0 0
Evolution 0 0 0
Feature request 0 2 2

View all issues | Summary

Time tracking

  • Estimated time: 6:00 hours
  • Spent time: 0:00 hour

Details | Report

Members

Manager : François Cerbelle