Skip to content

Commit d49e78f

Browse files
committed
Expanded netsh pin/unpin test to run for native.
1 parent 2d6c48a commit d49e78f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/end_to_end/netsh_test.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,14 +1156,14 @@ _test_pin_unpin_program(ebpf_execution_type_t execution_type)
11561156

11571157
DECLARE_ALL_TEST_CASES("pin/unpin program", "[netsh][pin]", _test_pin_unpin_program);
11581158

1159-
#if !defined(CONFIG_BPF_JIT_DISABLED) || !defined(CONFIG_BPF_INTERPRETER_DISABLED)
1160-
TEST_CASE("pin/unpin map", "[netsh][pin]")
1159+
static void
1160+
_test_pin_unpin_map(ebpf_execution_type_t execution_type)
11611161
{
11621162
_test_helper_netsh test_helper;
11631163
test_helper.initialize();
11641164
int result = 0;
1165-
auto output =
1166-
_run_netsh_command(handle_ebpf_add_program, L"bindmonitor.o", L"bind", L"pinpath=bindmonitor", &result);
1165+
const wchar_t* file_name = (execution_type == EBPF_EXECUTION_NATIVE ? L"bindmonitor_um.dll" : L"bindmonitor.o");
1166+
auto output = _run_netsh_command(handle_ebpf_add_program, file_name, L"bind", L"pinpath=bindmonitor", &result);
11671167
REQUIRE(result == EBPF_SUCCESS);
11681168
const char prefix[] = "Loaded with ID";
11691169
REQUIRE(output.substr(0, sizeof(prefix) - 1) == prefix);
@@ -1178,7 +1178,8 @@ TEST_CASE("pin/unpin map", "[netsh][pin]")
11781178
REQUIRE(id > 0);
11791179
auto sid = std::to_wstring(id);
11801180

1181-
auto offset = output.find("audit_map", digit + 1);
1181+
const char* map_name = (execution_type == EBPF_EXECUTION_NATIVE ? "limits_map" : "audit_map");
1182+
auto offset = output.find(map_name, digit + 1);
11821183
REQUIRE(offset != std::string::npos);
11831184
auto pins = strtoul(output.c_str() + offset - 4, nullptr, 10);
11841185
REQUIRE(pins == 0);
@@ -1212,4 +1213,5 @@ TEST_CASE("pin/unpin map", "[netsh][pin]")
12121213

12131214
_run_netsh_command(handle_ebpf_delete_program, std::to_wstring(pid).c_str(), nullptr, nullptr, &result);
12141215
}
1215-
#endif // !defined(CONFIG_BPF_JIT_DISABLED) || !defined(CONFIG_BPF_INTERPRETER_DISABLED)
1216+
1217+
DECLARE_ALL_TEST_CASES("pin/unpin map", "[netsh][pin]", _test_pin_unpin_map);

0 commit comments

Comments
 (0)