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:
Dave Thaler 2021-08-20 12:43:43 -07:00 коммит произвёл GitHub
Родитель c99a43e5e9
Коммит 98e1696e97
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -73,8 +73,7 @@ ebpf_result_t
ebpf_rpc_load_program(ebpf_program_load_info* info, const char** logs, uint32_t* logs_size)
{
// Short circuit rpc call to service lib.
return ebpf_verify_and_load_program(
ebpf_result_t result = ebpf_verify_and_load_program(
&info->program_type,
info->program_handle,
info->execution_context,
@ -85,4 +84,7 @@ ebpf_rpc_load_program(ebpf_program_load_info* info, const char** logs, uint32_t*
info->byte_code,
const_cast<const char**>(logs),
logs_size);
ebpf_clear_thread_local_storage();
return result;
}