The integration (autotest) tests are handled two ways. One way uses cmake add_test(COMMAND <set of shell commands like 'sed'>) and the other moves all of that into a secondary shell script. The latter adds another moving part, but is easier to debug. Choose one and do the same thing everywhere? Maybe that is expecting too perfect a world?