X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7a8207992d6e3fb13af3d4bc5777ddc1458b0592..a83769229c16e7cb7293c762be1d5ce432d0aefb:/buildtools/Cmake/generate_memcheck_tests.pl diff --git a/buildtools/Cmake/generate_memcheck_tests.pl b/buildtools/Cmake/generate_memcheck_tests.pl index 502f4a92fa..c4b6db63a2 100755 --- a/buildtools/Cmake/generate_memcheck_tests.pl +++ b/buildtools/Cmake/generate_memcheck_tests.pl @@ -1,10 +1,10 @@ #!/usr/bin/perl -w use strict; -# input file = CMakeTest.txt +# input file = AddTest.txt if($#ARGV!=1) { - die "Usage: generate_memcheck_tests.pl \n"; + die "Usage: generate_memcheck_tests.pl AddTests.cmake\n"; } my($proj_dir)=$ARGV[0]; @@ -14,6 +14,7 @@ my(@test_list)=(); my($line); my($dump)=0; +print "if(enable_memcheck)\n"; while(defined($line=)) { chomp $line; if($line =~ /BEGIN TESH TESTS/) { @@ -25,37 +26,61 @@ while(defined($line=)) { last; } if($dump) { - if($line =~ /ADD_TEST/) { - if($line =~ /ADD_TEST\(([\S]+)\s+.*\/tools\/tesh\/tesh\s*--cd\s*(\S+)\s+(.*)\)$/) { + if($line =~ /ADD_TEST/) + { + if($line =~ /ADD_TEST\(([\S]+)\s+.*\$\{CMAKE_BINARY_DIR\}\/bin\/tesh\s*--cd\s*(\S+)\s+(.*)\)$/) + { my($name_test,$path,$tesh_file)=($1,$2,$3); $path=~ s/\"//g; my($complete_tesh_file)=$path."/".$tesh_file; my($count)=0; - $complete_tesh_file =~ s/\${PROJECT_DIRECTORY}/$proj_dir/g; - open TESH_FILE, $complete_tesh_file or die "Unable to open $complete_tesh_file. $!\n"; + my($count_first)=0; + my($count_second)=0; + $complete_tesh_file =~ s/\$\{CMAKE_BINARY_DIR\}/$proj_dir/g; + $complete_tesh_file =~ s/\$\{PROJECT_DIRECTORY\}/$proj_dir/g; + open TESH_FILE, $complete_tesh_file or die "Unable to open $complete_tesh_file $!\n"; my($l); - while(defined($l=)) { + while(defined($l=)) + { chomp $l; - if($l =~ /^\$ (.*)$/) { - my($command)=$1; - $command =~ s/\${srcdir:=.}/\${PROJECT_DIRECTORY}\/src/g; + if($l =~ /^\$ (.*)$/) + { + my($command) = $1; + $command =~ s/\${srcdir:=.}/./g; $command =~ s/\${EXEEXT:=}//g; - print "ADD_TEST(memcheck-$name_test-$count /bin/sh -c 'cd $path && $command')\n"; - push @test_list, "memcheck-$name_test-$count"; + $command =~ s/\$SG_TEST_EXENV //g; + $command =~ s/\$SG_TEST_ENV //g; + $command =~ s/\$SG_EXENV_TEST //g; + $command =~ s/\$EXEEXT//g; + $command =~ s/\${EXEEXT}//g; + $command =~ s/\${srcdir}/\${PROJECT_DIRECTORY}\/src/g; + $command =~ s/ \$ARGS//g; + $command =~ s/ \$@ //g; + $command =~ s/..\/..\/bin\/smpirun/\${CMAKE_BINARY_DIR\}\/bin\/smpirun/g; + print "ADD_TEST(memcheck-$name_test-$count $command --cd $path\/)\n"; + #push @test_list, "memcheck-$name_test-$count"; $count++; } + if($l =~ /^\& (.*)$/) + { + last; + } } close(TESH_FILE); - } else { + } + else + { next; } - } else { + } + else + { print $line."\n"; } } } close(MAKETEST); - -print "set(MEMCHECK_LIST\n"; -print (join("\n", @test_list)); -print ")\n"; +print "endif(enable_memcheck)\n"; +#print "set(MEMCHECK_LIST\n"; +#print (join("\n", @test_list)); +#print ")\n";