scripts/unit-test: Use the meson option parser

This will make parsing more consistent with meson itself and allow us
to extract other data about options for a build.

Change-Id: Ifac630be74345373914ed585e017c67df422ef27
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index 95021cb..8895d11 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -8,6 +8,7 @@
 """
 
 from git import Repo
+from mesonbuild import optinterpreter
 from urllib.parse import urljoin
 from subprocess import check_call, call, CalledProcessError
 import os
@@ -770,14 +771,9 @@
         Parameters:
         options_file        The file containing options
         """
-        options_contents = ''
-        with open(options_file, "rt") as f:
-            options_contents += f.read()
-        options = set()
-        pattern = 'option\\(\\s*\'([^\']*)\''
-        for match in re.compile(pattern).finditer(options_contents):
-            options.add(match.group(1))
-        return options
+        oi = optinterpreter.OptionInterpreter('')
+        oi.process(options_file)
+        return oi.options
 
     def _configure_feature(self, val):
         """
@@ -801,7 +797,7 @@
 
     def configure(self, build_for_testing):
         self.build_for_testing = build_for_testing
-        meson_options = set()
+        meson_options = {}
         if os.path.exists("meson_options.txt"):
             meson_options = self._parse_options("meson_options.txt")
         meson_flags = [