Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 6a7fc82

Browse files
[test] Added block on fault bad argument tests for operations whose BoF flag is reserved (#310)
* added bad argument tests for bof
1 parent 5a0fc5a commit 6a7fc82

File tree

3 files changed

+123
-0
lines changed

3 files changed

+123
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*******************************************************************************
2+
* Copyright (C) 2023 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
******************************************************************************/
6+
7+
/**
8+
* @brief Contains bad argument tests for DML_OP_BATCH operation
9+
* @date 7/18/2023
10+
*
11+
*/
12+
#include "t_common.hpp"
13+
14+
namespace dml
15+
{
16+
/**
17+
* @brief Tests the operation using the reserved block on fault flag
18+
*/
19+
DML_JOB_API_TEST_GENERATOR(dml_batch, tb_bof)
20+
{
21+
if(test::variables_t::path == DML_PATH_SW){
22+
GTEST_SKIP();
23+
}
24+
25+
constexpr auto operation_count = 4u;
26+
auto batch_size = 0u;
27+
28+
auto status = dml_get_batch_size(&*lib_job, operation_count, &batch_size);
29+
EXPECT_EQ(DML_STATUS_OK, status);
30+
31+
lib_job->destination_first_ptr = dml::test::global_allocator::allocate_ptr(batch_size);
32+
lib_job->destination_length = batch_size;
33+
lib_job->operation = DML_OP_BATCH;
34+
lib_job->flags = DML_FLAG_BLOCK_ON_FAULT;
35+
36+
for(int i = 0; i < operation_count; i++){
37+
status = dml_batch_set_nop_by_index(&*lib_job, i, 0u);
38+
EXPECT_EQ(DML_STATUS_OK, status);
39+
}
40+
41+
// Reference job initialization
42+
ref_job.status = DML_STATUS_JOB_FLAGS_ERROR;
43+
44+
}
45+
46+
// Test registers
47+
DML_JOB_API_TEST_REGISTER(dml_batch, tb_bof);
48+
49+
} // namespace dml
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*******************************************************************************
2+
* Copyright (C) 2023 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
******************************************************************************/
6+
7+
/**
8+
* @brief Contains bad argument tests for DML_OP_DRAIN operation
9+
* @date 7/18/2023
10+
*
11+
*/
12+
#include "t_common.hpp"
13+
14+
namespace dml
15+
{
16+
17+
/**
18+
* @brief Tests the operation using the reserved block on fault flag
19+
*/
20+
DML_JOB_API_TEST_GENERATOR(dml_drain, tb_bof)
21+
{
22+
if(test::variables_t::path == DML_PATH_SW){
23+
GTEST_SKIP();
24+
}
25+
26+
lib_job->operation = DML_OP_DRAIN;
27+
lib_job->flags = DML_FLAG_BLOCK_ON_FAULT;
28+
29+
ref_job.status = DML_STATUS_JOB_FLAGS_ERROR;
30+
}
31+
32+
// Test registers
33+
DML_JOB_API_TEST_REGISTER(dml_drain, tb_bof);
34+
35+
}

tools/tests/job_api_tests/tb_nop.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*******************************************************************************
2+
* Copyright (C) 2023 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
******************************************************************************/
6+
7+
/**
8+
* @brief Contains bad argument tests for DML_OP_NOP operation
9+
* @date 7/18/2023
10+
*
11+
*/
12+
#include "t_common.hpp"
13+
14+
15+
namespace dml
16+
{
17+
18+
/**
19+
* @brief Tests the operation using the reserved block on fault flag
20+
*/
21+
DML_JOB_API_TEST_GENERATOR(dml_nop, tb_bof)
22+
{
23+
if(test::variables_t::path == DML_PATH_SW){
24+
GTEST_SKIP();
25+
}
26+
27+
// Library job initialization
28+
lib_job->operation = DML_OP_NOP;
29+
lib_job->flags = DML_FLAG_BLOCK_ON_FAULT;
30+
31+
// Reference job initialization
32+
ref_job.status = DML_STATUS_JOB_FLAGS_ERROR;
33+
}
34+
35+
36+
// Test registers
37+
DML_JOB_API_TEST_REGISTER(dml_nop, tb_bof)
38+
39+
}

0 commit comments

Comments
 (0)