4 # input file = CMakeTest.txt
7 die "Usage: generate_memcheck_tests.pl <project_directory> <CMakeTests.txt>\n";
10 my($proj_dir)=$ARGV[0];
11 open MAKETEST, $ARGV[1] or die "Unable to open $ARGV[1]. $!\n";
17 while(defined($line=<MAKETEST>)) {
19 if($line =~ /BEGIN TESH TESTS/) {
23 if($line =~ /END TESH TESTS/) {
28 if($line =~ /ADD_TEST/) {
29 if($line =~ /ADD_TEST\(([\S]+)\s+.*\/tools\/tesh\/tesh\s*--cd\s*(\S+)\s+(.*)\)$/) {
30 my($name_test,$path,$tesh_file)=($1,$2,$3);
32 my($complete_tesh_file)=$path."/".$tesh_file;
34 $complete_tesh_file =~ s/\${PROJECT_DIRECTORY}/$proj_dir/g;
35 open TESH_FILE, $complete_tesh_file or die "Unable to open $complete_tesh_file. $!\n";
37 while(defined($l=<TESH_FILE>)) {
39 if($l =~ /^\$ (.*)$/) {
41 $command =~ s/\${srcdir:=.}/\${PROJECT_DIRECTORY}\/src/g;
42 $command =~ s/\${EXEEXT:=}//g;
43 print "ADD_TEST(memcheck-$name_test-$count /bin/sh -c 'cd $path && $command')\n";
44 push @test_list, "memcheck-$name_test-$count";
59 print "set(MEMCHECK_LIST\n";
60 print (join("\n", @test_list));