@@ -3514,27 +3514,30 @@ FindTest(
3514
3514
}
3515
3515
3516
3516
BOOL
3517
- IsTimeoutStringValid (const char *strTimeout) {
3518
- char *end;
3519
- _set_errno (0 );
3517
+ IsTimeoutStringValid (const char *strTimeout)
3518
+ {
3519
+ char *end;
3520
+ _set_errno (0 );
3520
3521
3521
- uint32 secTimeout = strtoul (strTimeout, &end, 10 );
3522
+ uint32 secTimeout = strtoul (strTimeout, &end, 10 );
3522
3523
3523
- if (errno != 0 || *end != 0 ) {
3524
- return FALSE ;
3525
- }
3524
+ if (errno != 0 || *end != 0 )
3525
+ {
3526
+ return FALSE ;
3527
+ }
3526
3528
3527
- // Check to see if the value is too large and would cause overflow
3529
+ // Check to see if the value is too large and would cause overflow
3528
3530
3529
- // Do the multiplication using 64-bit unsigned math.
3530
- unsigned __int64 millisecTimeout = 1000ui64 * static_cast <unsigned __int64>(secTimeout);
3531
+ // Do the multiplication using 64-bit unsigned math.
3532
+ unsigned __int64 millisecTimeout = 1000ui64 * static_cast <unsigned __int64>(secTimeout);
3531
3533
3532
- // Does the result fit in 32-bits?
3533
- if (millisecTimeout >= (1ui64 << 32 )) {
3534
- return FALSE ;
3535
- }
3534
+ // Does the result fit in 32-bits?
3535
+ if (millisecTimeout >= (1ui64 << 32 ))
3536
+ {
3537
+ return FALSE ;
3538
+ }
3536
3539
3537
- return TRUE ;
3540
+ return TRUE ;
3538
3541
}
3539
3542
3540
3543
uint32 GetTimeoutValue (const char *strTimeout)
@@ -3553,79 +3556,79 @@ uint32 GetTimeoutValue(const char *strTimeout)
3553
3556
BOOL
3554
3557
GetTestInfoFromNode
3555
3558
(
3556
- const char * fileName,
3557
- Xml::Node * node,
3558
- TestInfo * testInfo
3559
+ const char * fileName,
3560
+ Xml::Node * node,
3561
+ TestInfo * testInfo
3559
3562
)
3560
3563
{
3561
- if (node == NULL )
3562
- {
3563
- return TRUE ;
3564
- }
3565
-
3566
- for (int i = 0 ; i < _TIK_COUNT; i++)
3567
- {
3568
- Xml::Node * childNode = node->GetChild (TestInfoKindName[i]);
3569
- if (childNode != NULL )
3570
- {
3571
- testInfo->hasData [i] = TRUE ;
3572
- if (i == TIK_ENV)
3573
- {
3574
- ASSERT (childNode->ChildList != NULL );
3575
- testInfo->data [i] = (char *)childNode;
3576
- }
3577
- else
3578
- {
3579
- if (childNode->ChildList != NULL )
3580
- {
3581
- CFG_ERROR_EX (fileName, node->LineNumber ,
3582
- " Expected data, not child list\n " , NULL );
3583
- childNode->Dump ();
3584
- return FALSE ;
3585
- }
3564
+ if (node == nullptr )
3565
+ {
3566
+ return TRUE ;
3567
+ }
3586
3568
3587
- if (childNode->Data != NULL && childNode->Data [0 ] != ' \0 ' )
3569
+ for (int i = 0 ; i < _TIK_COUNT; i++)
3570
+ {
3571
+ Xml::Node * childNode = node->GetChild (TestInfoKindName[i]);
3572
+ if (childNode != nullptr )
3573
+ {
3574
+ testInfo->hasData [i] = TRUE ;
3575
+ if (i == TIK_ENV)
3588
3576
{
3589
- char * data = childNode->Data ;
3590
- if (i == TIK_SOURCE_PATH && IsRelativePath (childNode->Data ))
3591
- {
3592
- // Make sure sourcepath is not relative, if relative make it full path
3593
- data = MakeFullPath (fileName, data);
3594
- ASSERT (data != NULL );
3595
- }
3596
- testInfo->data [i] = data;
3577
+ ASSERT (childNode->ChildList != nullptr );
3578
+ testInfo->data [i] = (char *)childNode;
3597
3579
}
3598
3580
else
3599
3581
{
3600
- testInfo->data [i] = NULL ;
3582
+ if (childNode->ChildList != nullptr )
3583
+ {
3584
+ CFG_ERROR_EX (fileName, node->LineNumber ,
3585
+ " Expected data, not child list\n " , nullptr );
3586
+ childNode->Dump ();
3587
+ return FALSE ;
3588
+ }
3589
+
3590
+ if (childNode->Data != nullptr && childNode->Data [0 ] != ' \0 ' )
3591
+ {
3592
+ char * data = childNode->Data ;
3593
+ if (i == TIK_SOURCE_PATH && IsRelativePath (childNode->Data ))
3594
+ {
3595
+ // Make sure sourcepath is not relative, if relative make it full path
3596
+ data = MakeFullPath (fileName, data);
3597
+ ASSERT (data != nullptr );
3598
+ }
3599
+ testInfo->data [i] = data;
3600
+ }
3601
+ else
3602
+ {
3603
+ testInfo->data [i] = nullptr ;
3604
+ }
3605
+
3606
+ if (i == TIK_TIMEOUT)
3607
+ {
3608
+ // Validate the timeout string now to fail early so we don't run any tests when there is an error.
3609
+ if (!IsTimeoutStringValid (testInfo->data [i])) {
3610
+ CFG_ERROR_EX (fileName, node->LineNumber ,
3611
+ " Invalid timeout specified. Cannot parse or too large.\n " , nullptr );
3612
+ childNode->Dump ();
3613
+ return FALSE ;
3614
+ }
3615
+ }
3601
3616
}
3617
+ }
3602
3618
3603
- if (i == TIK_TIMEOUT)
3619
+ if (i == TIK_TIMEOUT && TestTimeout != nullptr )
3620
+ {
3621
+ // Overriding the timeout value with the command line value (if the command line value is larger)
3622
+ uint32 xmlTimeoutValue = GetTimeoutValue (testInfo->data [i]);
3623
+ uint32 testTimeoutValue = GetTimeoutValue (TestTimeout);
3624
+ if (xmlTimeoutValue < testTimeoutValue)
3604
3625
{
3605
- // Validate the timeout string now to fail early so we don't run any tests when there is an error.
3606
- if (!IsTimeoutStringValid (testInfo->data [i])) {
3607
- CFG_ERROR_EX (fileName, node->LineNumber ,
3608
- " Invalid timeout specified. Cannot parse or too large.\n " , NULL );
3609
- childNode->Dump ();
3610
- return FALSE ;
3611
- }
3626
+ testInfo->data [i] = TestTimeout;
3612
3627
}
3613
- }
3614
- }
3615
-
3616
- if (i == TIK_TIMEOUT && TestTimeout != nullptr )
3617
- {
3618
- // Overriding the timeout value with the command line value (if the command line value is larger)
3619
- uint32 xmlTimeoutValue = GetTimeoutValue (testInfo->data [i]);
3620
- uint32 testTimeoutValue = GetTimeoutValue (TestTimeout);
3621
- if (xmlTimeoutValue < testTimeoutValue)
3622
- {
3623
- testInfo->data [i] = TestTimeout;
3624
- }
3625
- }
3626
- }
3628
+ }
3629
+ }
3627
3630
3628
- return TRUE ;
3631
+ return TRUE ;
3629
3632
}
3630
3633
3631
3634
BOOL
0 commit comments