Travis relies on the exit code on an executable to determine if the test passed or failed. Qt Test is designed so that every test class is contained in its own executable so, after the build, I end up with a bunch of tests inside my bin/tests folder.
I don't want to hard code each and every test name in my build script so I'm currently using to execute all of them.
find ./bin/tests/ -type f -perm -a=x -exec '{}' \;
The tests are all executed correctly but, even if one of the tests returns an exit code different from 0, that line itself will be interpreted as exit code 0 and the tests are always passing as much as Travis can tell.
What I'd want is the equivalent of for %a in (bin\tests\*.exe) do %a
in windows.
For a small example see https://travis-ci.org/VSRonin/QtModelUtilities/jobs/362301017
Quick solution from the top of my head.
Make a script like this:
#!/bin/bash
exit=0
while IFS= read line; do
"$line" || exit=1
done <<< "$(find ./bin/tests/ -type f -perm -a=x)"
exit $exit
Considerations: