Commit 3effb1e
committed
tools: plugin: ov_noise_suppression: add regression test for adversarial model shapes
Add a regression test that exercises the input-shape guard introduced
in "tools: plugin: ov_noise_suppression: validate model input shape
dimensions". The test is a small C++ executable living next to the
module sources at
tools/plugin/modules/ov_noise_suppression/test_ns_shape_validation.cpp
and wired into the module's CMakeLists.txt inside the existing
if(OpenVINO_FOUND) block, so when OpenVINO is not installed the test
is skipped along with the module itself.
The test drives the public C API of the module
(ov_ns_init / ov_ns_free / NOISE_SUPPRESSION_MODEL_NAME) rather than
reaching into private structs, and is configurable from the command
line:
--model PATH use a caller-supplied OpenVINO model XML file.
--dim N [--dim N ...] synthesize a minimal model XML with the given
input-port dimensions, write it to a temporary
file (mkstemps), and use that.
--expect ok|reject expected outcome; default "reject".
-h, --help print usage describing what the test does and
how to run it.
The mock-model writer emits the smallest XML that ov::Core::read_model()
will accept for a Parameter input with the configured shape, so
ov_ns_init() reaches the dimension-validation loop the previous commit
added. The test then asserts that ov_ns_init() returned 0 for
--expect ok and non-zero for --expect reject, and exits 0 (PASS) or 1
(FAIL) accordingly.
Two ctest cases are registered at CMake time covering the two
adversarial shapes that motivated the fix:
ns_shape_zero --dim 0 --dim 480 # zero dim
ns_shape_overflow --dim 9223372036854775807 --dim 1024 # overflow
Real models can be exercised by invoking the executable directly with
--model PATH --expect ok.
Addresses review comments on PR #10886:
r3403937663 - move test next to the module, build via the module's
CMakeLists so OpenVINO/dep checks are reused.
r3403939540 - take the model file / shape parameters on the command
line instead of hard-coding /tmp/test_model_<pid>.xml.
r3403944866 - add a -h help option describing the test and its usage.
r3403950342 - add the missing SPDX-License-Identifier and copyright
header; let CMake gate the build on OpenVINO presence.
Signed-off-by: OrbisAI Security <mediratta01.pally@gmail.com>1 parent e65ff91 commit 3effb1e
2 files changed
Lines changed: 157 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
42 | 60 | | |
Lines changed: 139 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
0 commit comments