Skip to content

Commit

Permalink
prioritized python test script since that natturally deals with space…
Browse files Browse the repository at this point in the history
…s. Changed perl cxxtest to accept files that contain spaces in their path, but the output file uses GetOptions which also does not support spaces, so the CMakeList is changed to put test.cc in the current directory instead of global output directory in the case of perl.
  • Loading branch information
danielrh committed Aug 17, 2009
1 parent 0e15558 commit 6361722
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
4 changes: 3 additions & 1 deletion build/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,22 @@ MACRO(ADD_CXXTEST_CPP_TARGET)
#IF(CXXTEST_OUTPUTDIR)
# SET(CXXTEST_OPTIONS ${CXXTEST_OPTIONS} -o ${CXXTEST_OUTPUTDIR})
#ENDIF(CXXTEST_OUTPUTDIR)

SET(CXXTEST_CPP_FILE ${CMAKE_CURRENT_BINARY_DIR}/test.cc)
FIND_PACKAGE(PythonInterp)
IF(PYTHON_EXECUTABLE)
SET(CXXTEST_COMPILER ${PYTHON_EXECUTABLE})
SET(CXXTEST_GEN ${CXXTEST_LIBRARYDIR}/cxxtestgen.py)
ELSE()
FIND_PACKAGE(Perl)
IF(PERL_EXECUTABLE)
SET(CXXTEST_CPP_FILE test.cc) #perl cannot output to a full path.
SET(CXXTEST_COMPILER ${PERL_EXECUTABLE})
SET(CXXTEST_GEN ${CXXTEST_LIBRARYDIR}/cxxtestgen.pl)
ELSE()
MESSAGE(STATUS "!!! Cannot locate python or perl -- tests will not be compiled.")
ENDIF()
ENDIF()
SET(CXXTEST_CPP_FILE ${CMAKE_CURRENT_BINARY_DIR}/test.cc)
FOREACH(FILE ${CXXTEST_FILES})
SET(CXXTEST_H_FILE ${TOP_LEVEL}/${FILE})
SET(CXXTEST_TEST_FILES ${CXXTEST_TEST_FILES} ${CXXTEST_H_FILE})
Expand Down
34 changes: 24 additions & 10 deletions externals/cxxtest/cxxtestgen.pl
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,21 @@ ()
my (@suites, $suite, $test, $inBlock);
my $numTotalTests = 0;

sub scanInputFiles() {
foreach my $file (@ARGV) {
scanInputFile( $file );
sub scanInputFileX($) {
my ($argnum) = @_;
my ($file) = $ARGV[$argnum];
($argnum)=$argnum+1;

while(!open FILE, "<$file") {
if ($argnum > $#ARGV) {
die ("cannot open file: ".$argnum. " : ".$file);
}
my ($otherhalffile) = $ARGV[$argnum];
$argnum=$argnum+1;
$file = $file.' '.$otherhalffile;
#print ("trying ".$file."\n");
}
scalar @suites or $root or die("No tests defined\n");
}

sub scanInputFile($) {
my ($file) = @_;
open FILE, "<$file" or die("Cannot open input file \"$file\"\n");

#print "opened ".$file;
my $line;
while (defined($line = <FILE>)) {
scanLineForExceptionHandling( $line );
Expand All @@ -130,8 +134,18 @@ ($)
}
closeSuite();
close FILE;
return $argnum;
}

sub scanInputFiles() {
my $argnum=0;
while ($argnum < $#ARGV) {
$argnum=scanInputFileX($argnum);
}
scalar @suites or $root or die("No tests defined\n");
}


sub lineBelongsToSuite($$$) {
my ($suite, $lineNo, $line) = @_;
if ( !$suite->{'generated'} ) {
Expand Down

0 comments on commit 6361722

Please sign in to comment.