|
1 | 1 | // SPDX-License-Identifier: BSD-3-Clause |
2 | 2 | // |
3 | | -// Copyright(c) 2026 OrbisAI Security. All rights reserved. |
| 3 | +// Copyright(c) 2024 Intel Corporation. All rights reserved. |
4 | 4 | // |
5 | | -// Author: OrbisAI Security <mediratta01.pally@gmail.com> |
| 5 | +// Author: Security Team |
6 | 6 |
|
7 | 7 | #include <cstdio> |
8 | 8 | #include <cstdlib> |
@@ -119,21 +119,31 @@ int main(int argc, char **argv) |
119 | 119 | model_path = scratch; |
120 | 120 | } |
121 | 121 |
|
122 | | - setenv("NOISE_SUPPRESSION_MODEL_NAME", model_path.c_str(), 1); |
| 122 | + struct noise_suppression_data *nd = |
| 123 | + (struct noise_suppression_data *)std::calloc(1, sizeof(*nd)); |
| 124 | + if (!nd) { |
| 125 | + std::perror("calloc"); |
| 126 | + if (!scratch.empty()) |
| 127 | + std::remove(scratch.c_str()); |
| 128 | + return 2; |
| 129 | + } |
123 | 130 |
|
124 | | - ns_handle h = nullptr; |
125 | | - int rc = ov_ns_init(&h); |
126 | | - if (h) |
127 | | - ov_ns_free(h); |
| 131 | + int ret = ov_ns_init(nd, model_path.c_str()); |
128 | 132 |
|
129 | 133 | if (!scratch.empty()) |
130 | 134 | std::remove(scratch.c_str()); |
131 | 135 |
|
132 | | - bool rejected = (rc != 0); |
| 136 | + bool rejected = (ret != 0); |
133 | 137 | bool pass = (rejected == expect_reject); |
134 | 138 |
|
135 | | - std::printf("model=%s rc=%d expect=%s -> %s\n", model_path.c_str(), rc, |
136 | | - expect_reject ? "reject" : "ok", |
137 | | - pass ? "PASS" : "FAIL"); |
| 139 | + std::printf("%s: ov_ns_init() returned %d (%s), expected %s\n", |
| 140 | + pass ? "PASS" : "FAIL", |
| 141 | + ret, |
| 142 | + rejected ? "rejected" : "accepted", |
| 143 | + expect_reject ? "reject" : "ok"); |
| 144 | + |
| 145 | + ov_ns_free(nd); |
| 146 | + std::free(nd); |
| 147 | + |
138 | 148 | return pass ? 0 : 1; |
139 | 149 | } |
0 commit comments