Skip to content

Commit

Permalink
[TEST] [NODE API] negativeTesttivxCreateNodeByKernelName negative tes…
Browse files Browse the repository at this point in the history
…t case

-Negative test case which passes NULL Kernel name  to the
tivxCreateNodeByKernelName API and prints Error messagee.

[TEST] [NODE API] negativeTesttivxCreateNodeByStructure negative test case

-Negative test case which passes unacceptable ENUM name  to the
vxCreateNodeByStructure API and prints Error messagee.

[TEST] [REFERENCE] negativeTestGetReferenceParent1 negative test case
-Negative test case which passes  context to the
tivxGetReferenceParent API and expects NULL return value.

[TEST] [REFERENCE] negativeTestSetTimestamp negative test case
-Negative test case which passes NULL reference
tivxSetReferenceAttribute API and expects Invalid reference.

[TEST] [REFERENCE] negativetestSetTimestamp1 negative test case
-Negative test case which passes TIVX_REFERENCE_TIMESTAMP, TIVX_REFERENCE_INVALID and a non defined ENUM to the
tivxSetReferenceAttribute API and expects error setting reference timestamp, error setting reference validity and respectively.

[TEST] [REFERENCE] negativeTestvxReferenceExportHandle negative test case
-Negative test case which passes VX_TYPE_PYRAMID to the
tivxReferenceExportHandle API and expects Unsupported type.

[TEST] [REFERENCE] negativeTestvxIsReferenceMetaFormatEqual1 negative test case
-Negative test case which passes 1st NULL image to the
tivxIsReferenceMetaFormatEqual API and expects NULL return value.

[TEST] [REFERENCE] negativeTestvxIsReferenceMetaFormatEqual2 negative test case
-Negative test case which passes 2nd NULL image to the
tivxIsReferenceMetaFormatEqual API and expects NULL return value.

[TEST] [REFERENCE] negativeTestvxIsReferenceMetaFormatEqual3 negative test case
-Negative test case which passes 1st NULL context to the
tivxIsReferenceMetaFormatEqual API and expects NULL return value.

[TEST] [REFERENCE] negativeTesttivxReferenceImportHandle negative test case
-Negative test case which passes VX_TYPE_PYRAMID to the
tivxReferenceImportHandle API and expects Unsupported type.

[TEST] [REFERENCE] negativeTesttivxReferenceImportHandle1 negative test case
-Negative test case which passes wrong size and type is PYRAMID to the
tivxReferenceImportHandle API and expects memory size mismatch.

[TEST] [REFERENCE] negativeTesttivxReferenceImportHandle2 negative test case
-Negative test case which passes wrong size and type is KERNEL to the
tivxReferenceImportHandle API and expects memory size mismatch.

[TEST] [REFERENCE] negativeTestGetStatus1 negative test case
-Removed white space and extra lines

[TEST] [REFERENCE] testGetContext Test case
- Removed white space and extra lines

[TEST] [REFERENCE] negativeTestvxIsReferenceMetaFormatEqual3 negative test case
- Removed the unwanted APIs

[TEST] [REFERENCE] negativeTesttivxReferenceImportHandle negative test case
- Removed white spaces and extra lines

[TEST] [REFERENCE] negativeTesttivxReferenceImportHandle1 negative test case
-Removed the comment

[TEST] [REFERENCE] negativeTesttivxReferenceImportHandle2 negative test case
-Removed the comment
-Removed the unwanted APIs

[TEST] [OBJARRAY] negativeTestGetObjectArrayItem1 negative test case
-Negative test case which passes VX_TYPE_IMAGE enum type to

vxCreateObjectArray API and expects an error..

[TEST] [NODE] negativeTestGetNodeParameterNumBufByIndex negative test case
-Negative test case which passes NULL node to the
tivxSetNodeParameterNumBufByIndex and tivxGetNodeParameterNumBufByIndex API
and expects Invalid node return value.

[TEST] [NODE] negativeTestGetNodeParameterNumBufByIndex negative test case
-Negative test case which passes larger index value  to the
tivxSetNodeParameterNumBufByIndex and tivxGetNodeParameterNumBufByIndex API
and expects Invalid parameters return value.

[TEST] [NODE_API] negativeTesttivxCreateNodeByStructure1 negative test case

-Negative test case which passes a graph to the
tivxCreateNodeByKernelEnum API to achieve coverage for vxCreateNodeByStructure.

[TEST] [OBB_ARRAY] Moved the file to test_internal directory

[TEST] [NODE] negativeTestGetNodeParameterNumBufByIndex2 negative test case
-Negative test case which covers vxSetNodeTarget and
tivxSetNodeParameterNumBufByIndex API and expects VX_ERROR_NOT_SUPPORTED

[TEST] [REFERENCE] Review fixes done

[TEST] [MAIN_HEADER] Added tivxInternalObjArray

[TEST] [OBJECT ARRAY] New Test cases depending on Framework headers moved here

[TEST] [OBJECT ARRAY] Reverted to original contents, moved new Test cases to internal directory
  • Loading branch information
Kasthuri Kanmani authored and lcweaver committed Sep 25, 2023
1 parent 0cb6c06 commit 20feedb
Show file tree
Hide file tree
Showing 6 changed files with 337 additions and 15 deletions.
1 change: 1 addition & 0 deletions conformance_tests/test_internal/test_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@

#if defined(BUILD_CT_TIOVX_INTERNAL)
TESTCASE(tivxObjDescBoundary)
TESTCASE(tivxInternalObjArray)
#endif
61 changes: 61 additions & 0 deletions conformance_tests/test_internal/test_objarray.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright (c) 2015-2017 The Khronos Group Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright (c) 2022 Texas Instruments Incorporated
*/

#include "test_tiovx.h"
#include "test_engine/test.h"
#include "test_tiovx/test_tiovx.h"
#include <VX/vx.h>
#include <VX/vxu.h>
#include <VX/vx_khr_user_data_object.h>
#include <VX/vx_khr_pipelining.h>
#include <TI/tivx_test_kernels.h>
#include <TI/tivx_config.h>
#include <TI/tivx_mutex.h>
#include <TI/tivx_queue.h>

#include <tivx_event_queue.h>
#include <tivx_obj_desc_priv.h>
#include <vx_reference.h>
#include <vx_context.h>
#include <TI/tivx_capture.h>
#include <TI/tivx_task.h>
#include <TI/tivx_target_kernel.h>
#include "math.h"
#include <limits.h>

TESTCASE(tivxInternalObjArray, CT_VXContext, ct_setup_vx_context, 0)

TEST(tivxInternalObjArray, negativeTestGetObjectArrayItem1)
{
vx_context context = context_->vx_context_;
vx_object_array vxoa = NULL;
vx_reference ref = NULL;
vx_uint32 index = 0;
vx_image image;
image = (vx_image)ownCreateReference(context, (vx_enum)VX_TYPE_IMAGE, (vx_enum)VX_EXTERNAL, &context->base);
EXPECT_VX_ERROR(vxoa = vxCreateObjectArray(context, image, 2),VX_ERROR_NO_RESOURCES);
VX_CALL(ownReleaseReferenceInt((vx_reference*)&image, (vx_enum)VX_TYPE_IMAGE, (vx_enum)VX_EXTERNAL, NULL));
}

TESTCASE_TESTS(
tivxInternalObjArray,
negativeTestGetObjectArrayItem1
)

66 changes: 65 additions & 1 deletion conformance_tests/test_tiovx/test_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,67 @@ TEST(tivxNode, negativeTestSetNodeTarget)
VX_CALL(vxReleaseGraph(&graph));
}

TEST(tivxNode, negativeTestGetNodeParameterNumBufByIndex)
{
uint32_t get_num_buf;

ASSERT_EQ_VX_STATUS(VX_ERROR_INVALID_PARAMETERS,(tivxSetNodeParameterNumBufByIndex(NULL, 1, &get_num_buf)));
ASSERT_EQ_VX_STATUS(VX_ERROR_INVALID_PARAMETERS,(tivxGetNodeParameterNumBufByIndex(NULL, 1, &get_num_buf)));
}

TEST(tivxNode, negativeTestGetNodeParameterNumBufByIndex1)
{
uint32_t get_num_buf;
vx_context context = context_->vx_context_;
vx_graph graph;
vx_image d1, d2;
vx_node n1;
uint32_t width = 64;
uint32_t height = 48;

ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH);
ASSERT_VX_OBJECT(d1 = vxCreateVirtualImage(graph, width, height, VX_DF_IMAGE_U8), VX_TYPE_IMAGE);
ASSERT_VX_OBJECT(d2 = vxCreateVirtualImage(graph, width, height, VX_DF_IMAGE_U8), VX_TYPE_IMAGE);
ASSERT_VX_OBJECT(n1 = vxNotNode(graph, d1, d2), VX_TYPE_NODE);

ASSERT_EQ_VX_STATUS(VX_ERROR_INVALID_PARAMETERS,(tivxSetNodeParameterNumBufByIndex(n1, 100, &get_num_buf)));
ASSERT_EQ_VX_STATUS(VX_ERROR_INVALID_PARAMETERS,(tivxGetNodeParameterNumBufByIndex(n1, 100, &get_num_buf)));
VX_CALL(vxReleaseNode(&n1));
VX_CALL(vxReleaseImage(&d1));
VX_CALL(vxReleaseImage(&d2));
VX_CALL(vxReleaseGraph(&graph));
}

TEST(tivxNode, negativeTestGetNodeParameterNumBufByIndex2)
{
vx_context context = context_->vx_context_;
vx_image input, output;
vx_enum target = NULL;
vx_enum interp = VX_INTERPOLATION_NEAREST_NEIGHBOR;
vx_remap map;
vx_graph graph;
vx_node node;
uint32_t get_num_buf;

ASSERT_VX_OBJECT(input = vxCreateImage(context, 16, 32, VX_DF_IMAGE_U8), VX_TYPE_IMAGE);
ASSERT_VX_OBJECT(output = vxCreateImage(context, 128, 64, VX_DF_IMAGE_U8), VX_TYPE_IMAGE);
ASSERT_VX_OBJECT(map = vxCreateRemap(context, 16, 32, 128, 64), VX_TYPE_REMAP);
ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH);
ASSERT_VX_OBJECT(node = vxRemapNode(graph, input, map, VX_INTERPOLATION_NEAREST_NEIGHBOR, output), VX_TYPE_NODE);

vxVerifyGraph(graph);

ASSERT_EQ_VX_STATUS(VX_ERROR_NOT_SUPPORTED, vxSetNodeTarget((node), target, "ABC"));
ASSERT_EQ_VX_STATUS(VX_ERROR_NOT_SUPPORTED,(tivxSetNodeParameterNumBufByIndex(node, 100, &get_num_buf)));

VX_CALL(vxReleaseNode(&node));
VX_CALL(vxReleaseGraph(&graph));
VX_CALL(vxReleaseRemap(&map));
VX_CALL(vxReleaseImage(&output));
VX_CALL(vxReleaseImage(&input));
}


TESTCASE_TESTS(
tivxNode,
negativeTestCreateGenericNode,
Expand All @@ -209,6 +270,9 @@ TESTCASE_TESTS(
negativeTestAssignNodeCallback,
negativeTestRetrieveNodeCallback,
negativeTestReplicateNode,
negativeTestSetNodeTarget
negativeTestSetNodeTarget,
negativeTestGetNodeParameterNumBufByIndex,
negativeTestGetNodeParameterNumBufByIndex1,
negativeTestGetNodeParameterNumBufByIndex2
)

47 changes: 46 additions & 1 deletion conformance_tests/test_tiovx/test_node_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
#include <VX/vxu.h>
#include <TI/tivx_config.h>
#include <TI/tivx.h>
#include <TI/tivx_test_kernels.h>
#include <TI/tivx_capture.h>

#include "test_engine/test.h"

#define VX_KERNEL_CONFORMANCE_TEST_USER_SOURCE1_NAME1 "org.khronos.openvx.test.user_source_1"

TESTCASE(tivxNodeApi, CT_VXContext, ct_setup_vx_context, 0)

TEST(tivxNodeApi, negativeTestWarpAffineNode)
Expand Down Expand Up @@ -66,10 +70,51 @@ TEST(tivxNodeApi, negativeTestRemapNode)
ASSERT(NULL == vxRemapNode(graph, input, table, policy, output));
}

/* tivxCreateNodeByKernelName , if(kernel!=NULL)*/
TEST(tivxNodeApi, negativeTesttivxCreateNodeByKernelName)
{
vx_context context = context_->vx_context_;
vx_graph graph = NULL;
vx_remap table = NULL;
vx_reference prms[]= {NULL};
ASSERT(NULL == tivxCreateNodeByKernelName(graph, NULL, prms,dimof(prms)));
}

/* vxCreateNodeByStructure , #line 71*/
TEST(tivxNodeApi, negativeTesttivxCreateNodeByStructure)
{
vx_context context = context_->vx_context_;
vx_graph graph = NULL;
vx_remap table = NULL;
vx_reference prms[]= {NULL};

ASSERT(NULL == tivxCreateNodeByKernelRef(graph, TIVX_KERNEL_SCALAR_SOURCE_NAME, prms,dimof(prms)));
}

TEST(tivxNodeApi, negativeTesttivxCreateNodeByStructure1)
{
vx_context context = context_->vx_context_;
vx_graph graph;
vx_image image;

ASSERT_VX_OBJECT(image = vxCreateImage(context, 640, 480, VX_DF_IMAGE_U8), VX_TYPE_IMAGE);
ASSERT_VX_OBJECT(graph = vxCreateGraph(context), VX_TYPE_GRAPH);
vx_reference params[2] =
{
(vx_reference)image
};
ASSERT(NULL == tivxCreateNodeByKernelEnum(graph, VX_KERNEL_ABSDIFF, params, 2));
VX_CALL(vxReleaseImage(&image));
VX_CALL(vxReleaseGraph(&graph));
}

TESTCASE_TESTS(
tivxNodeApi,
negativeTestWarpAffineNode,
negativeTestWarpPerspectiveNode,
negativeTestRemapNode
negativeTestRemapNode,
negativeTesttivxCreateNodeByKernelName,
negativeTesttivxCreateNodeByStructure,
negativeTesttivxCreateNodeByStructure1
)

1 change: 0 additions & 1 deletion conformance_tests/test_tiovx/test_objarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,3 @@ TESTCASE_TESTS(
negativeTestGetObjectArrayItem,
negativeTestQueryObjectArray
)

Loading

0 comments on commit 20feedb

Please sign in to comment.