clean up context on build completion & add test Upstream-commit: 6eef7de396f3da6fbe2fab82fd29894bc9d73719 Component: engine