Remove some duplication from the tests

Get rid of some of the duplication from the command line interface tests
by extracting a decorator that checks that the proper exception is
thrown when we run a command without one of its required arguments.

Change-Id: Ifd2b93b7ff1bb249c002f1b03c0a242feb1f39f9
diff --git a/tests/cli/testllvmbuild.py b/tests/cli/testllvmbuild.py
index a395d0f..e7295b0 100644
--- a/tests/cli/testllvmbuild.py
+++ b/tests/cli/testllvmbuild.py
@@ -10,7 +10,7 @@
 from subprocess import CalledProcessError
 from tempfile import mkdtemp
 
-from llvmtestcase import LLVMTestCase, debug
+from llvmtestcase import LLVMTestCase, require_command_arg, debug
 
 
 def create_empty_file(path):
@@ -29,14 +29,10 @@
     def tearDown(self):
         rmtree(self.buildDir)
 
+    @require_command_arg("--build-dir")
     def test_build_dir_is_compulsory(self):
         """Test that we get an error if we don't pass the build dir."""
-        with self.assertRaises(CalledProcessError) as context:
-            self.run_with_output(self.llvm_build())
-
-        self.assertRegex(
-            str(context.exception.output),
-            "(.*\n)*the following arguments are required: --build-dir(.*\n)*")
+        self.run_with_output(self.llvm_build())
 
     def test_dry_run(self):
         """