tests: bring testing trace.dat back to life

Testing trace.dat was removed in fa532d24c8fb ("tests: don't depend on
trace-cmd being installed").  Patrick is still invoking cr2 and
expecting it to generate the text version of the trace, so bring the
test code back in.  Untested code is dead code.

Skip the tests if trace-cmd is not installed.  This avoids the reason
why it was removed in the first place.

Change-Id: I900b24a3d41694451a089fb694119abdc41e3945
diff --git a/tests/utils_tests.py b/tests/utils_tests.py
index c0aa33f..a7ac216 100644
--- a/tests/utils_tests.py
+++ b/tests/utils_tests.py
@@ -2,10 +2,22 @@
 
 import unittest
 import os
-import shutil, tempfile
+import shutil
+import subprocess
+import tempfile
 
 TESTS_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
 
+def trace_cmd_installed():
+    """Return true if trace-cmd is installed, false otherwise"""
+    with open(os.devnull) as devnull:
+        try:
+            subprocess.check_call(["trace-cmd", "options"], stdout=devnull)
+        except OSError:
+            return False
+
+    return True
+
 class SetupDirectory(unittest.TestCase):
     def __init__(self, files_to_copy, *args, **kwargs):
         self.files_to_copy = files_to_copy