re-enable traceability code in repo (#393)

Co-authored-by: Jelani Brandon <jebrando@microsoft.com>
This commit is contained in:
Jelani Brandon 2024-10-21 14:40:48 -07:00 коммит произвёл GitHub
Родитель b593eda612
Коммит bbc959b9e9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 36 добавлений и 27 удалений

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

@ -12,6 +12,7 @@ resources:
jobs:
- template: /pipeline_templates/build_all_flavors.yml@c_build_tools
parameters:
cmake_options: -Drun_unittests:BOOL=ON -Drun_e2e_tests:BOOL=ON -Drun_int_tests:BOOL=ON -Drun_perf_tests:BOOL=ON -Drun_traceability:BOOL=ON -Duse_cppunittest:BOOL=ON -Drun_reals_check:BOOL=ON
GBALLOC_LL_TYPE_VALUES: ["PASSTHROUGH", "JEMALLOC"]
- template: /pipeline_templates/run_master_check.yml@c_build_tools
@ -118,5 +119,4 @@ jobs:
# targetType: filePath
# filePath: './build/linux/build_linux_iwyu.sh'
# arguments: '$(Build.Repository.LocalPath)'
# workingDirectory: '$(Build.Repository.LocalPath)'
# workingDirectory: '$(Build.Repository.LocalPath)'

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

@ -10,70 +10,75 @@ MOCKABLE_FUNCTION(, int, job_object_helper_limit_cpu, THANDLE(JOB_OBJECT_HELPER)
```
## job_object_helper_create
```c
MOCKABLE_FUNCTION(, THANDLE(JOB_OBJECT_HELPER), job_object_helper_create);
```
``job_object_helper_create`` is used to create a `JOB_OBJECT_HELPER` object.
**SRS_JOB_OBJECT_HELPER_18_016: [** `job_object_helper_create` shall allocate a `JOB_OBJECT_HELPER` object. **]**
`job_object_helper_create` shall allocate a `JOB_OBJECT_HELPER` object.
**SRS_JOB_OBJECT_HELPER_18_023: [** `job_object_helper_create` shall call `GlobalMemoryStatusEx` to get the total amount of physical memory in kb. **]**
`job_object_helper_create` shall call `GlobalMemoryStatusEx` to get the total amount of physical memory in kb.
**SRS_JOB_OBJECT_HELPER_18_024: [** `job_object_helper_create` shall call `CreateJobObject` to create a new job object passing `NULL` for both `lpJobAttributes` and `lpName`. **]**
`job_object_helper_create` shall call `CreateJobObject` to create a new job object passing `NULL` for both `lpJobAttributes` and `lpName`.
**SRS_JOB_OBJECT_HELPER_18_025: [** `job_object_helper_create` shall call `GetCurrentProcess` to get the current process handle. **]**
`job_object_helper_create` shall call `GetCurrentProcess` to get the current process handle.
**SRS_JOB_OBJECT_HELPER_18_026: [** `job_object_helper_create` shall call `AssignProcessToJobObject` to assign the current process to the new job object. **]**
`job_object_helper_create` shall call `AssignProcessToJobObject` to assign the current process to the new job object.
**SRS_JOB_OBJECT_HELPER_18_027: [** `job_object_helper_create` shall call `CloseHandle` to close the handle of the current process. **]**
`job_object_helper_create` shall call `CloseHandle` to close the handle of the current process.
**SRS_JOB_OBJECT_HELPER_18_018: [** If there are any failures, `job_object_helper_create` shall fail and return `NULL`. **]**
**SRS_JOB_OBJECT_HELPER_18_019: [** `job_object_helper_create` shall succeed and return the `JOB_OBJECT_HELPER` object. **]**
If there are any failures, `job_object_helper_create` shall fail and return `NULL`.
`job_object_helper_create` shall succeed and return the `JOB_OBJECT_HELPER` object.
## job_object_helper_dispose
```c
static void job_object_helper_dispose(JOB_OBJECT_HELPER* job_object_helper);
```
`job_object_helper_dispose` frees all of the resources used by the `JOB_OBJECT_HELPER` object.
**SRS_JOB_OBJECT_HELPER_18_033: [** `job_object_helper_dispose` shall call `CloseHandle` to close the handle to the job object. **]**
`job_object_helper_dispose` shall call `CloseHandle` to close the handle to the job object.
## job_object_helper_limit_memory
```c
MOCKABLE_FUNCTION(, int, job_object_helper_limit_memory, THANDLE(JOB_OBJECT_HELPER), job_object_helper, uint32_t, percent_physical_memory);
```
`job_object_helper_limit_memory` limits the amount of physical memory available to the current progess.
**SRS_JOB_OBJECT_HELPER_18_035: [** If `job_object_helper` is `NULL`, `job_object_helper_limit_memory` shall fail and return a non-zero value. **]**
If `job_object_helper` is `NULL`, `job_object_helper_limit_memory` shall fail and return a non-zero value.
**SRS_JOB_OBJECT_HELPER_18_036: [** If `percent_physical_memory` is `0`, `job_object_helper_limit_memory` shall fail and return a non-zero value. **]**
If `percent_physical_memory` is `0`, `job_object_helper_limit_memory` shall fail and return a non-zero value.
**SRS_JOB_OBJECT_HELPER_18_037: [** If `percent_physical_memory` is greater than `100`, `job_object_helper_limit_memory` shall fail and return a non-zero value. **]**
If `percent_physical_memory` is greater than `100`, `job_object_helper_limit_memory` shall fail and return a non-zero value.
*SRS_JOB_OBJECT_HELPER_18_039: [** `job_object_helper_limit_memory` shall call `SetInformationJobObject`, passing `JobObjectExtendedLimitInformation` and a `JOBOBJECT_EXTENDED_LIMIT_INFORMATION` object with `JOB_OBJECT_LIMIT_JOB_MEMORY` set and `JobMemoryLimit` set to the `percent_physical_memory` percent of the physical memory in bytes. **]**
`job_object_helper_limit_memory` shall call `SetInformationJobObject`, passing `JobObjectExtendedLimitInformation` and a `JOBOBJECT_EXTENDED_LIMIT_INFORMATION` object with `JOB_OBJECT_LIMIT_JOB_MEMORY` set and `JobMemoryLimit` set to the `percent_physical_memory` percent of the physical memory in bytes.
**SRS_JOB_OBJECT_HELPER_18_041: [** If there are any failures, `job_object_helper_limit_memory` shall fail and return a non-zero value. **]**
**SRS_JOB_OBJECT_HELPER_18_042: [** `job_object_helper_limit_memory` shall succeed and return `0`. **]**
If there are any failures, `job_object_helper_limit_memory` shall fail and return a non-zero value.
`job_object_helper_limit_memory` shall succeed and return `0`.
## job_object_helper_limit_cpu
```c
MOCKABLE_FUNCTION(, int, job_object_helper_limit_cpu, THANDLE(JOB_OBJECT_HELPER), job_object_helper, uint32_t, percent_cpu);
```
`job_object_helper_limit_cpu` limits the amount of CPU available to the current process.
**SRS_JOB_OBJECT_HELPER_18_043: [** If `job_object_helper` is `NULL`, `job_object_helper_limit_cpu` shall fail and return a non-zero value. **]**
`job_object_helper_limit_cpu` limits the amount of CPU available to the current process.
**SRS_JOB_OBJECT_HELPER_18_044: [** If `percent_cpu` is `0`, `job_object_helper_limit_cpu` shall fail and return a non-zero value. **]**
If `job_object_helper` is `NULL`, `job_object_helper_limit_cpu` shall fail and return a non-zero value.
**SRS_JOB_OBJECT_HELPER_18_045: [** If `percent_cpu` is greater than `100`, `job_object_helper_limit_cpu` shall fail and return a non-zero value. **]**
If `percent_cpu` is `0`, `job_object_helper_limit_cpu` shall fail and return a non-zero value.
**SRS_JOB_OBJECT_HELPER_18_047: [** `job_object_helper_limit_cpu` shall call `SetInformationJobObject` passing `JobObjectCpuRateControlInformation` and a `JOBOBJECT_CPU_RATE_CONTROL_INFORMATION` object with `JOB_OBJECT_CPU_RATE_CONTROL_ENABLE` and `JOB_OBJECT_CPU_RATE_CONTROL_HARD_CAP` set, and `CpuRate` set to `percent_cpu` times `100`. **]**
If `percent_cpu` is greater than `100`, `job_object_helper_limit_cpu` shall fail and return a non-zero value.
**SRS_JOB_OBJECT_HELPER_18_049: [** If there are any failures, `job_object_helper_limit_cpu` shall fail and return a non-zero value. **]**
`job_object_helper_limit_cpu` shall call `SetInformationJobObject` passing `JobObjectCpuRateControlInformation` and a `JOBOBJECT_CPU_RATE_CONTROL_INFORMATION` object with `JOB_OBJECT_CPU_RATE_CONTROL_ENABLE` and `JOB_OBJECT_CPU_RATE_CONTROL_HARD_CAP` set, and `CpuRate` set to `percent_cpu` times `100`.
**SRS_JOB_OBJECT_HELPER_18_050: [** `job_object_helper_limit_cpu` shall succeed and return `0`. **]**
If there are any failures, `job_object_helper_limit_cpu` shall fail and return a non-zero value.
`job_object_helper_limit_cpu` shall succeed and return `0`.

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

@ -839,6 +839,7 @@ SOCKET_HANDLE socket_transport_get_underlying_socket(SOCKET_TRANSPORT_HANDLE soc
bool socket_transport_is_valid_socket(SOCKET_TRANSPORT_HANDLE socket_transport_handle)
{
bool result;
// Codes_SOCKET_TRANSPORT_WIN32_09_093: [ If socket_transport_handle is NULL, socket_transport_is_valid_socket shall fail and return false. ]
if (socket_transport_handle == NULL)
{
result = false;
@ -846,13 +847,16 @@ bool socket_transport_is_valid_socket(SOCKET_TRANSPORT_HANDLE socket_transport_h
}
else
{
// Codes_SOCKET_TRANSPORT_WIN32_09_092: [ socket_transport_is_valid_socket checks that the internal socket is valid. ]
if (socket_transport_handle->socket == INVALID_SOCKET)
{
// Codes_SOCKET_TRANSPORT_WIN32_09_094: [ If the socket inside socket_transport_handle is an INVALID_SOCKET, socket_transport_is_valid_socket shall fail and return false. ]
result = false;
LogError("Invalid socket in argument: SOCKET_TRANSPORT_HANDLE socket_transport_handle: %p", socket_transport_handle);
}
else
{
// Codes_SOCKET_TRANSPORT_WIN32_09_095: [ On success, socket_transport_is_valid_socket shall return true. ]
result = true;
}
}