@@ -1593,6 +1593,7 @@ run_schedule(const char *schedule, test_function tfunc)
1593
1593
FILE * scf ;
1594
1594
int line_num = 0 ;
1595
1595
1596
+ memset (tests , 0 , sizeof (tests ));
1596
1597
memset (resultfiles , 0 , sizeof (resultfiles ));
1597
1598
memset (expectfiles , 0 , sizeof (expectfiles ));
1598
1599
memset (tags , 0 , sizeof (tags ));
@@ -1615,16 +1616,6 @@ run_schedule(const char *schedule, test_function tfunc)
1615
1616
1616
1617
line_num ++ ;
1617
1618
1618
- /* clear out string lists left over from previous line */
1619
- for (i = 0 ; i < MAX_PARALLEL_TESTS ; i ++ )
1620
- {
1621
- if (resultfiles [i ] == NULL )
1622
- break ;
1623
- free_stringlist (& resultfiles [i ]);
1624
- free_stringlist (& expectfiles [i ]);
1625
- free_stringlist (& tags [i ]);
1626
- }
1627
-
1628
1619
/* strip trailing whitespace, especially the newline */
1629
1620
i = strlen (scbuf );
1630
1621
while (i > 0 && isspace ((unsigned char ) scbuf [i - 1 ]))
@@ -1657,24 +1648,35 @@ run_schedule(const char *schedule, test_function tfunc)
1657
1648
1658
1649
num_tests = 0 ;
1659
1650
inword = false;
1660
- for (c = test ; * c ; c ++ )
1651
+ for (c = test ;; c ++ )
1661
1652
{
1662
- if (isspace ((unsigned char ) * c ))
1653
+ if (* c == '\0' || isspace ((unsigned char ) * c ))
1663
1654
{
1664
- * c = '\0' ;
1665
- inword = false;
1655
+ if (inword )
1656
+ {
1657
+ /* Reached end of a test name */
1658
+ char sav ;
1659
+
1660
+ if (num_tests >= MAX_PARALLEL_TESTS )
1661
+ {
1662
+ fprintf (stderr , _ ("too many parallel tests (more than %d) in schedule file \"%s\" line %d: %s\n" ),
1663
+ MAX_PARALLEL_TESTS , schedule , line_num , scbuf );
1664
+ exit (2 );
1665
+ }
1666
+ sav = * c ;
1667
+ * c = '\0' ;
1668
+ tests [num_tests ] = pg_strdup (test );
1669
+ num_tests ++ ;
1670
+ * c = sav ;
1671
+ inword = false;
1672
+ }
1673
+ if (* c == '\0' )
1674
+ break ; /* loop exit is here */
1666
1675
}
1667
1676
else if (!inword )
1668
1677
{
1669
- if (num_tests >= MAX_PARALLEL_TESTS )
1670
- {
1671
- /* can't print scbuf here, it's already been trashed */
1672
- fprintf (stderr , _ ("too many parallel tests (more than %d) in schedule file \"%s\" line %d\n" ),
1673
- MAX_PARALLEL_TESTS , schedule , line_num );
1674
- exit (2 );
1675
- }
1676
- tests [num_tests ] = c ;
1677
- num_tests ++ ;
1678
+ /* Start of a test name */
1679
+ test = c ;
1678
1680
inword = true;
1679
1681
}
1680
1682
}
@@ -1695,9 +1697,8 @@ run_schedule(const char *schedule, test_function tfunc)
1695
1697
}
1696
1698
else if (max_concurrent_tests > 0 && max_concurrent_tests < num_tests )
1697
1699
{
1698
- /* can't print scbuf here, it's already been trashed */
1699
- fprintf (stderr , _ ("too many parallel tests (more than %d) in schedule file \"%s\" line %d\n" ),
1700
- max_concurrent_tests , schedule , line_num );
1700
+ fprintf (stderr , _ ("too many parallel tests (more than %d) in schedule file \"%s\" line %d: %s\n" ),
1701
+ max_concurrent_tests , schedule , line_num , scbuf );
1701
1702
exit (2 );
1702
1703
}
1703
1704
else if (max_connections > 0 && max_connections < num_tests )
@@ -1802,6 +1803,15 @@ run_schedule(const char *schedule, test_function tfunc)
1802
1803
1803
1804
status_end ();
1804
1805
}
1806
+
1807
+ for (i = 0 ; i < num_tests ; i ++ )
1808
+ {
1809
+ pg_free (tests [i ]);
1810
+ tests [i ] = NULL ;
1811
+ free_stringlist (& resultfiles [i ]);
1812
+ free_stringlist (& expectfiles [i ]);
1813
+ free_stringlist (& tags [i ]);
1814
+ }
1805
1815
}
1806
1816
1807
1817
free_stringlist (& ignorelist );
0 commit comments