From c44b5b6ae3c1d762d73c5e16eb51e244f9d708a2 Mon Sep 17 00:00:00 2001 From: Matthias Diener Date: Tue, 2 Aug 2022 14:31:24 -0500 Subject: [PATCH] Fix indentation of test_waitlists.cpp (#1459) * fix indentation of test_waitlists.cpp Followup of #1458 * run formatter --- test_conformance/events/test_waitlists.cpp | 169 ++++++++++++--------- 1 file changed, 100 insertions(+), 69 deletions(-) diff --git a/test_conformance/events/test_waitlists.cpp b/test_conformance/events/test_waitlists.cpp index e23cacf4..ebf5da9b 100644 --- a/test_conformance/events/test_waitlists.cpp +++ b/test_conformance/events/test_waitlists.cpp @@ -28,10 +28,13 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que cl_int status[ 3 ]; cl_int error; - if (multiple) - log_info("\tExecuting reference event 0, then reference event 1 with reference event 0 in its waitlist, then test event 2 with reference events 0 and 1 in its waitlist.\n"); - else - log_info("\tExecuting reference event 0, then test event 2 with reference event 0 in its waitlist.\n"); + if (multiple) + log_info("\tExecuting reference event 0, then reference event 1 with " + "reference event 0 in its waitlist, then test event 2 with " + "reference events 0 and 1 in its waitlist.\n"); + else + log_info("\tExecuting reference event 0, then test event 2 with " + "reference event 0 in its waitlist.\n"); // Set up the first base action to wait against error = actions[ 0 ].Setup( device, context, queue ); @@ -49,7 +52,7 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que test_error( error, "Unable to set up test event" ); // Execute all events now - if (PRINT_OPS) log_info("\tExecuting action 0...\n"); + if (PRINT_OPS) log_info("\tExecuting action 0...\n"); error = actions[ 0 ].Execute( queue, 0, NULL, &events[ 0 ] ); test_error( error, "Unable to execute first event" ); @@ -61,17 +64,20 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que } // Sanity check - if( multiple ) { - if (PRINT_OPS) log_info("\tChecking status of action 1...\n"); + if (multiple) + { + if (PRINT_OPS) log_info("\tChecking status of action 1...\n"); error = clGetEventInfo( events[ 1 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 1 ] ), &status[ 1 ], NULL ); - test_error( error, "Unable to get event status" ); - } - if (PRINT_OPS) log_info("\tChecking status of action 0...\n"); + test_error(error, "Unable to get event status"); + } + if (PRINT_OPS) log_info("\tChecking status of action 0...\n"); error = clGetEventInfo( events[ 0 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 0 ] ), &status[ 0 ], NULL ); - test_error( error, "Unable to get event status" ); + test_error(error, "Unable to get event status"); - log_info("\t\tEvent status after starting reference events: reference event 0: %s, reference event 1: %s, test event 2: %s.\n", - IGetStatusString( status[ 0 ] ), (multiple ? IGetStatusString( status[ 1 ] ) : "N/A"), "N/A"); + log_info("\t\tEvent status after starting reference events: reference " + "event 0: %s, reference event 1: %s, test event 2: %s.\n", + IGetStatusString(status[0]), + (multiple ? IGetStatusString(status[1]) : "N/A"), "N/A"); if( ( status[ 0 ] == CL_COMPLETE ) || ( multiple && status[ 1 ] == CL_COMPLETE ) ) { @@ -79,25 +85,29 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que return 0; } - if (PRINT_OPS) log_info("\tExecuting action to test...\n"); + if (PRINT_OPS) log_info("\tExecuting action to test...\n"); error = actionToTest->Execute( queue, ( multiple ) ? 2 : 1, &events[ 0 ], &events[ 2 ] ); test_error( error, "Unable to execute test event" ); // Hopefully, the first event is still running - if (PRINT_OPS) log_info("\tChecking status of action to test 2...\n"); + if (PRINT_OPS) log_info("\tChecking status of action to test 2...\n"); error = clGetEventInfo( events[ 2 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 2 ] ), &status[ 2 ], NULL ); test_error( error, "Unable to get event status" ); - if( multiple ) { - if (PRINT_OPS) log_info("\tChecking status of action 1...\n"); + if (multiple) + { + if (PRINT_OPS) log_info("\tChecking status of action 1...\n"); error = clGetEventInfo( events[ 1 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 1 ] ), &status[ 1 ], NULL ); - test_error( error, "Unable to get event status" ); - } - if (PRINT_OPS) log_info("\tChecking status of action 0...\n"); + test_error(error, "Unable to get event status"); + } + if (PRINT_OPS) log_info("\tChecking status of action 0...\n"); error = clGetEventInfo( events[ 0 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 0 ] ), &status[ 0 ], NULL ); - test_error( error, "Unable to get event status" ); + test_error(error, "Unable to get event status"); - log_info("\t\tEvent status after starting test event: reference event 0: %s, reference event 1: %s, test event 2: %s.\n", - IGetStatusString( status[ 0 ] ), (multiple ? IGetStatusString( status[ 1 ] ) : "N/A"), IGetStatusString( status[ 2 ] )); + log_info("\t\tEvent status after starting test event: reference event 0: " + "%s, reference event 1: %s, test event 2: %s.\n", + IGetStatusString(status[0]), + (multiple ? IGetStatusString(status[1]) : "N/A"), + IGetStatusString(status[2])); if( multiple ) { @@ -108,12 +118,15 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que return 0; } - if(status[1] == CL_COMPLETE && status[0] != CL_COMPLETE) - { - log_error("ERROR: Test failed because the second wait event is complete and the first is not.(status: 0: %s and 1: %s)\n", IGetStatusString( status[ 0 ] ), IGetStatusString( status[ 1 ] ) ); + if (status[1] == CL_COMPLETE && status[0] != CL_COMPLETE) + { + log_error( + "ERROR: Test failed because the second wait event is complete " + "and the first is not.(status: 0: %s and 1: %s)\n", + IGetStatusString(status[0]), IGetStatusString(status[1])); clFinish( queue ); return -1; - } + } } else { @@ -139,25 +152,29 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que } // Now wait for the first reference event - if (PRINT_OPS) log_info("\tWaiting for action 1 to finish...\n"); + if (PRINT_OPS) log_info("\tWaiting for action 1 to finish...\n"); error = clWaitForEvents( 1, &events[ 0 ] ); test_error( error, "Unable to wait for reference event" ); // Grab statuses again - if (PRINT_OPS) log_info("\tChecking status of action to test 2...\n"); + if (PRINT_OPS) log_info("\tChecking status of action to test 2...\n"); error = clGetEventInfo( events[ 2 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 2 ] ), &status[ 2 ], NULL ); test_error( error, "Unable to get event status" ); - if( multiple ) { - if (PRINT_OPS) log_info("\tChecking status of action 1...\n"); + if (multiple) + { + if (PRINT_OPS) log_info("\tChecking status of action 1...\n"); error = clGetEventInfo( events[ 1 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 1 ] ), &status[ 1 ], NULL ); - test_error( error, "Unable to get event status" ); - } - if (PRINT_OPS) log_info("\tChecking status of action 0...\n"); + test_error(error, "Unable to get event status"); + } + if (PRINT_OPS) log_info("\tChecking status of action 0...\n"); error = clGetEventInfo( events[ 0 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 0 ] ), &status[ 0 ], NULL ); - test_error( error, "Unable to get event status" ); + test_error(error, "Unable to get event status"); - log_info("\t\tEvent status after waiting for reference event 0: reference event 0: %s, reference event 1: %s, test event 2: %s.\n", - IGetStatusString( status[ 0 ] ), (multiple ? IGetStatusString( status[ 1 ] ) : "N/A"), IGetStatusString( status[ 2 ] )); + log_info("\t\tEvent status after waiting for reference event 0: reference " + "event 0: %s, reference event 1: %s, test event 2: %s.\n", + IGetStatusString(status[0]), + (multiple ? IGetStatusString(status[1]) : "N/A"), + IGetStatusString(status[2])); // Sanity if( status[ 0 ] != CL_COMPLETE ) @@ -170,11 +187,12 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que // If we're multiple, and the second event isn't complete, then our test event should still be queued if( multiple && status[ 1 ] != CL_COMPLETE ) { - if( status[ 1 ] == CL_RUNNING && status[ 2 ] == CL_RUNNING ) { - log_error("ERROR: Test event and second event are both running.\n"); - clFinish( queue ); - return -1; - } + if (status[1] == CL_RUNNING && status[2] == CL_RUNNING) + { + log_error("ERROR: Test event and second event are both running.\n"); + clFinish(queue); + return -1; + } if( status[ 2 ] != CL_QUEUED && status[ 2 ] != CL_SUBMITTED ) { log_error( "ERROR: Test event did not wait for second event before starting! (status of ref: 1: %s, of test: 2: %s)\n", IGetStatusString( status[ 1 ] ), IGetStatusString( status[ 2 ] ) ); @@ -183,25 +201,33 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que } // Now wait for second event to complete, too - if (PRINT_OPS) log_info("\tWaiting for action 1 to finish...\n"); + if (PRINT_OPS) log_info("\tWaiting for action 1 to finish...\n"); error = clWaitForEvents( 1, &events[ 1 ] ); test_error( error, "Unable to wait for second reference event" ); // Grab statuses again - if (PRINT_OPS) log_info("\tChecking status of action to test 2...\n"); - error = clGetEventInfo( events[ 2 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 2 ] ), &status[ 2 ], NULL ); - test_error( error, "Unable to get event status" ); - if( multiple ) { - if (PRINT_OPS) log_info("\tChecking status of action 1...\n"); - error = clGetEventInfo( events[ 1 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 1 ] ), &status[ 1 ], NULL ); - test_error( error, "Unable to get event status" ); - } - if (PRINT_OPS) log_info("\tChecking status of action 0...\n"); - error = clGetEventInfo( events[ 0 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 0 ] ), &status[ 0 ], NULL ); - test_error( error, "Unable to get event status" ); + if (PRINT_OPS) log_info("\tChecking status of action to test 2...\n"); + error = clGetEventInfo(events[2], CL_EVENT_COMMAND_EXECUTION_STATUS, + sizeof(status[2]), &status[2], NULL); + test_error(error, "Unable to get event status"); + if (multiple) + { + if (PRINT_OPS) log_info("\tChecking status of action 1...\n"); + error = clGetEventInfo(events[1], CL_EVENT_COMMAND_EXECUTION_STATUS, + sizeof(status[1]), &status[1], NULL); + test_error(error, "Unable to get event status"); + } + if (PRINT_OPS) log_info("\tChecking status of action 0...\n"); + error = clGetEventInfo(events[0], CL_EVENT_COMMAND_EXECUTION_STATUS, + sizeof(status[0]), &status[0], NULL); + test_error(error, "Unable to get event status"); - log_info("\t\tEvent status after waiting for reference event 1: reference event 0: %s, reference event 1: %s, test event 2: %s.\n", - IGetStatusString( status[ 0 ] ), (multiple ? IGetStatusString( status[ 1 ] ) : "N/A"), IGetStatusString( status[ 2 ] )); + log_info( + "\t\tEvent status after waiting for reference event 1: reference " + "event 0: %s, reference event 1: %s, test event 2: %s.\n", + IGetStatusString(status[0]), + (multiple ? IGetStatusString(status[1]) : "N/A"), + IGetStatusString(status[2])); // Sanity if( status[ 1 ] != CL_COMPLETE ) @@ -227,25 +253,30 @@ int test_waitlist( cl_device_id device, cl_context context, cl_command_queue que } // Wait for the test event, then return - if (PRINT_OPS) log_info("\tWaiting for action 2 to test to finish...\n"); + if (PRINT_OPS) log_info("\tWaiting for action 2 to test to finish...\n"); error = clWaitForEvents( 1, &events[ 2 ] ); test_error( error, "Unable to wait for test event" ); - error |= clGetEventInfo( events[ 2 ], CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof( status[ 2 ] ), &status[ 2 ], NULL ); - test_error( error, "Unable to get event status" ); + error |= clGetEventInfo(events[2], CL_EVENT_COMMAND_EXECUTION_STATUS, + sizeof(status[2]), &status[2], NULL); + test_error(error, "Unable to get event status"); - log_info("\t\tEvent status after waiting for test event: reference event 0: %s, reference event 1: %s, test event 2: %s.\n", - IGetStatusString( status[ 0 ] ), (multiple ? IGetStatusString( status[ 1 ] ) : "N/A"), IGetStatusString( status[ 2 ] )); + log_info("\t\tEvent status after waiting for test event: reference event " + "0: %s, reference event 1: %s, test event 2: %s.\n", + IGetStatusString(status[0]), + (multiple ? IGetStatusString(status[1]) : "N/A"), + IGetStatusString(status[2])); - // Sanity - if( status[ 2 ] != CL_COMPLETE ) - { - log_error( "ERROR: Test event didn't complete (status: 2: %s)\n", IGetStatusString( status[ 2 ] ) ); - clFinish( queue ); - return -1; - } + // Sanity + if (status[2] != CL_COMPLETE) + { + log_error("ERROR: Test event didn't complete (status: 2: %s)\n", + IGetStatusString(status[2])); + clFinish(queue); + return -1; + } - clFinish(queue); + clFinish(queue); return 0; }