Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add version of simgrid into the footer of the documentation.
[simgrid.git] / buildtools / Cmake / generate_memcheck_tests.pl
index c4b6db6..bba7315 100755 (executable)
@@ -4,7 +4,7 @@ use strict;
 # input file = AddTest.txt
 
 if($#ARGV!=1) {
-    die "Usage: generate_memcheck_tests.pl <project_directory> AddTests.cmake\n";
+    die "Usage: generate_memcheck_tests.pl <CMAKE_HOME_DIRECTORY> AddTests.cmake\n";
 }
 
 my($proj_dir)=$ARGV[0];
@@ -14,7 +14,6 @@ my(@test_list)=();
 
 my($line);
 my($dump)=0;
-print "if(enable_memcheck)\n";
 while(defined($line=<MAKETEST>)) {
     chomp $line;
     if($line =~ /BEGIN TESH TESTS/) {
@@ -37,7 +36,7 @@ while(defined($line=<MAKETEST>)) {
                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;
+               $complete_tesh_file =~ s/\$\{CMAKE_HOME_DIRECTORY\}/$proj_dir/g;
                open TESH_FILE, $complete_tesh_file or die "Unable to open $complete_tesh_file $!\n";
                my($l);
                while(defined($l=<TESH_FILE>))
@@ -53,10 +52,14 @@ while(defined($line=<MAKETEST>)) {
                        $command =~ s/\$SG_EXENV_TEST //g; 
                        $command =~ s/\$EXEEXT//g;
                        $command =~ s/\${EXEEXT}//g;
-                       $command =~ s/\${srcdir}/\${PROJECT_DIRECTORY}\/src/g;
+                       $command =~ s/\${srcdir}/\${CMAKE_HOME_DIRECTORY}\/src/g;
                        $command =~ s/ \$ARGS//g;
                        $command =~ s/ \$@ //g; 
                        $command =~ s/..\/..\/bin\/smpirun/\${CMAKE_BINARY_DIR\}\/bin\/smpirun/g;
+                        if($command =~ /^[^\/\$\s]+\//) {
+                            $command = $path."/".$command;
+                            $command =~ s/\/(.?\/)+/\//g;
+                        }
                        print "ADD_TEST(memcheck-$name_test-$count $command --cd $path\/)\n";
                        #push @test_list, "memcheck-$name_test-$count";
                        $count++;
@@ -80,7 +83,6 @@ while(defined($line=<MAKETEST>)) {
     }   
 }
 close(MAKETEST);
-print "endif(enable_memcheck)\n";
 #print "set(MEMCHECK_LIST\n";
 #print (join("\n", @test_list));
 #print ")\n";