The script ended with a grep pipeline, so a failed compile exited 0 (and, before the ocloc check was added at the end, a good build exited 1). A build.sh && next-step chain then ran after a failure. The status of cmake --build is kept and the script exits with it. The test runs the real script with a stub cmake on PATH (good build: 0, failed compile: 1; the old script exits 0 on the failed compile).