Fix unit tests (#403)
ebpf_server_verify_and_load_program() cleared thread local storage after calling ebpf_verify_and_load_program() but the mock version did not. As a result, the tests did not accurately reflect actual behavior. That is, running all tests would pass by accident since they were reusing thread local storage of previous tests, but running individual tests would fail. This is why the regression in PR #381 was missed by the CI/CD tests. Compare code in https://github.com/microsoft/ebpf-for-windows/blob/master/ebpfsvc/rpc_api.cpp#L36 Signed-off-by: Dave Thaler <dthaler@microsoft.com>
This commit is contained in:
Родитель
c99a43e5e9
Коммит
98e1696e97
|
@ -73,8 +73,7 @@ ebpf_result_t
|
||||||
ebpf_rpc_load_program(ebpf_program_load_info* info, const char** logs, uint32_t* logs_size)
|
ebpf_rpc_load_program(ebpf_program_load_info* info, const char** logs, uint32_t* logs_size)
|
||||||
{
|
{
|
||||||
// Short circuit rpc call to service lib.
|
// Short circuit rpc call to service lib.
|
||||||
|
ebpf_result_t result = ebpf_verify_and_load_program(
|
||||||
return ebpf_verify_and_load_program(
|
|
||||||
&info->program_type,
|
&info->program_type,
|
||||||
info->program_handle,
|
info->program_handle,
|
||||||
info->execution_context,
|
info->execution_context,
|
||||||
|
@ -85,4 +84,7 @@ ebpf_rpc_load_program(ebpf_program_load_info* info, const char** logs, uint32_t*
|
||||||
info->byte_code,
|
info->byte_code,
|
||||||
const_cast<const char**>(logs),
|
const_cast<const char**>(logs),
|
||||||
logs_size);
|
logs_size);
|
||||||
|
|
||||||
|
ebpf_clear_thread_local_storage();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче