[Spice-devel] [PATCH spice-streaming-agent] mjpeg-fallback: Ignore not recognized options

Frediano Ziglio fziglio at redhat.com
Thu Mar 1 10:17:59 UTC 2018


Options are global and should be ignored if not recognised by a
specific plugin as they can be used by other ones.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 src/mjpeg-fallback.cpp                | 2 --
 src/unittests/test-mjpeg-fallback.cpp | 7 +++----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/mjpeg-fallback.cpp b/src/mjpeg-fallback.cpp
index fd37167..68c282f 100644
--- a/src/mjpeg-fallback.cpp
+++ b/src/mjpeg-fallback.cpp
@@ -165,8 +165,6 @@ void MjpegPlugin::ParseOptions(const ConfigureOption *options)
             } catch (const std::exception &e) {
                 throw std::runtime_error("Invalid value '" + value + "' for option 'mjpeg.quality'.");
             }
-        } else {
-            throw std::runtime_error("Invalid option '" + name + "'.");
         }
     }
 }
diff --git a/src/unittests/test-mjpeg-fallback.cpp b/src/unittests/test-mjpeg-fallback.cpp
index 4a152fe..e39dc49 100644
--- a/src/unittests/test-mjpeg-fallback.cpp
+++ b/src/unittests/test-mjpeg-fallback.cpp
@@ -32,10 +32,9 @@ SCENARIO("test parsing mjpeg plugin options", "[mjpeg][options]") {
                 {NULL, NULL}
             };
 
-            THEN("ParseOptions throws an exception") {
-                REQUIRE_THROWS_WITH(
-                    plugin.ParseOptions(options.data()),
-                    "Invalid option 'wakaka'."
+            THEN("ParseOptions should ignore the option") {
+                REQUIRE_NOTHROW(
+                    plugin.ParseOptions(options.data())
                 );
             }
         }
-- 
2.14.3



More information about the Spice-devel mailing list