tests: add cppcheck.sh test.

Runs cppcheck as part of the test suite when cppcheck is installed.