tests: Fix tests which use grep -c

grep -c ends with non-zero status when count is equal to 0, which cause
our testing framework to generate a fatal failure. Expression like:

  assert_equals 2 $(grep -c something some_file)

would fail with a very strange message when something doesn't occur in
some_file. Replacing this with 'grep something some_file | wc -l' fixes
the issue and the error message is OK in such a case.

Change-Id: I142cb82a6a9bc5744184c465a378fe3f136e06af