@@ -3514,102 +3514,121 @@ 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 ;
3541
+ }
3542
+
3543
+ uint32 GetTimeoutValue (const char *strTimeout)
3544
+ {
3545
+ if (strTimeout == nullptr )
3546
+ {
3547
+ return 0 ;
3548
+ }
3549
+
3550
+ char *end = nullptr ;
3551
+ _set_errno (0 );
3552
+ uint32 secTimeout = strtoul (strTimeout, &end, 10 );
3553
+ return secTimeout;
3538
3554
}
3539
3555
3540
3556
BOOL
3541
3557
GetTestInfoFromNode
3542
3558
(
3543
- const char * fileName,
3544
- Xml::Node * node,
3545
- TestInfo * testInfo
3559
+ const char * fileName,
3560
+ Xml::Node * node,
3561
+ TestInfo * testInfo
3546
3562
)
3547
3563
{
3548
- if (node == NULL )
3549
- {
3550
- return TRUE ;
3551
- }
3552
-
3553
- for (int i = 0 ; i < _TIK_COUNT; i++)
3554
- {
3555
- Xml::Node * childNode = node->GetChild (TestInfoKindName[i]);
3556
- if (childNode != NULL )
3557
- {
3558
- testInfo->hasData [i] = TRUE ;
3559
- if (i == TIK_ENV)
3560
- {
3561
- ASSERT (childNode->ChildList != NULL );
3562
- testInfo->data [i] = (char *)childNode;
3563
- }
3564
- else
3565
- {
3566
- if (childNode->ChildList != NULL )
3567
- {
3568
- CFG_ERROR_EX (fileName, node->LineNumber ,
3569
- " Expected data, not child list\n " , NULL );
3570
- childNode->Dump ();
3571
- return FALSE ;
3572
- }
3564
+ if (node == nullptr )
3565
+ {
3566
+ return TRUE ;
3567
+ }
3573
3568
3574
- 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)
3575
3576
{
3576
- char * data = childNode->Data ;
3577
- if (i == TIK_SOURCE_PATH && IsRelativePath (childNode->Data ))
3578
- {
3579
- // Make sure sourcepath is not relative, if relative make it full path
3580
- data = MakeFullPath (fileName, data);
3581
- ASSERT (data != NULL );
3582
- }
3583
- testInfo->data [i] = data;
3577
+ ASSERT (childNode->ChildList != nullptr );
3578
+ testInfo->data [i] = (char *)childNode;
3584
3579
}
3585
3580
else
3586
3581
{
3587
- 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
+ }
3588
3616
}
3617
+ }
3589
3618
3590
- 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)
3591
3625
{
3592
- // Validate the timeout string now to fail early so we don't run any tests when there is an error.
3593
- if (!IsTimeoutStringValid (testInfo->data [i])) {
3594
- CFG_ERROR_EX (fileName, node->LineNumber ,
3595
- " Invalid timeout specified. Cannot parse or too large.\n " , NULL );
3596
- childNode->Dump ();
3597
- return FALSE ;
3598
- }
3626
+ testInfo->data [i] = TestTimeout;
3599
3627
}
3600
- }
3601
- }
3602
- if (i == TIK_TIMEOUT && TestTimeout != NULL )
3603
- {
3604
- // Overriding the timeout value with the command line value (if the command line value is larger)
3605
- if (testInfo->data [i] < TestTimeout)
3606
- {
3607
- testInfo->data [i] = TestTimeout;
3608
- }
3609
- }
3610
- }
3628
+ }
3629
+ }
3611
3630
3612
- return TRUE ;
3631
+ return TRUE ;
3613
3632
}
3614
3633
3615
3634
BOOL
0 commit comments