Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
Embedded & IoT QAMiddleSpecialistRisk analysis

How would you test firmware under constrained stack, heap and buffer capacity?

Answer

Establish static and runtime budgets, instrument high-water marks, and exercise worst-case call depth, concurrency, message bursts and malformed input. Check allocation failures, fragmentation, stack overflow detection and buffer boundaries, then run long enough to reveal leaks. The build should fail or alarm before safety margin disappears, not only after a device crashes.

Strong answer includes

  • measures high-water marks and safety margin
  • forces allocation and buffer failures
  • combines static analysis with runtime stress

Practical example

A device passes all functional tests with 40% of its stack free on average. Nobody instruments the actual high-water mark, so nobody notices that a rare error-handling branch with deep nested calls uses 95% of the stack. Months later, a malformed network packet triggers exactly that branch in the field and causes a stack overflow crash that a worst-case stack analysis in CI would have caught in minutes.

#embedded#memory#stack#heap

Sources

KUnit — Linux Kernel Unit TestingLinux Kernel · In-kernel unit testing, dependency isolation, test harnesses, QEMU and architecture coverageTesting — Zephyr Project DocumentationZephyr Project · Embedded unit, integration, simulation and hardware test frameworks and execution