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

Lukáš Hrázký lhrazky at redhat.com
Thu Mar 1 15:21:28 UTC 2018


On Thu, 2018-03-01 at 10:17 +0000, Frediano Ziglio wrote:
> Options are global and should be ignored if not recognised by a
> specific plugin as they can be used by other ones.

Haven't realized that..

Acked-by: Lukáš Hrázký <lhrazky at redhat.com>

> 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())
>                  );
>              }
>          }


More information about the Spice-devel mailing list